Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
00e86ae5
Commit
00e86ae5
authored
Feb 09, 2026
by
Luna Riegel
Browse files
Refactor: Add cache to check initialization parameters
parent
e8e84ba2
Changes
16
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Check.java
View file @
00e86ae5
...
...
@@ -26,6 +26,7 @@ import java.util.Map;
import
java.util.Set
;
import
de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
...
...
@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
* implement the {@link Check#getApplicableToClasses()} method by returning a
* list of classes you wish to check.<br>
* CheckResult objects can be attached to every Checkable. If the check has
* parameters override the {@link Check#init(Map, ParserConfiguration)} method
* parameters override the {@link Check#init(Map, ParserConfiguration
, CityObjectCache
)} method
* to get the value of a parameter if a user has specified one in the validation
* plan. It will be contained in the Map as a string. If you have parameters you
* will need to override the {@link Check#getDefaultParameter()} method as well
...
...
@@ -338,14 +339,15 @@ public abstract non-sealed class Check implements CheckableVisitor {
* The initialization method of this check. It will be called before any check
* method will be executed. Override this if you want to have configurable
* parameters.
*
*
* @param params the parameter map containing the parameters for the check in
* String form. The key should be the same String provided by the
* {@link Requirement#getDefaultParameter()} method
* @param config sometimes there are global parameters which can be used by
* checks. Those are be stored in this container
* @param cache reference to the cache of the CityModel
*/
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java
View file @
00e86ae5
...
...
@@ -80,7 +80,6 @@ public class LinkedPolygon extends Polygon {
return
poly
.
isValidated
();
}
//TODO: Think how to handle this, as it violates class contract if ignored
@Override
public
void
prepareForChecking
()
{
// Linked polys themselves are not checked
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
View file @
00e86ae5
...
...
@@ -47,7 +47,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
javax.annotation.Nonnull
;
import
javax.annotation.Nullable
;
import
javax.xml.XMLConstants
;
import
javax.xml.transform.Result
;
...
...
@@ -639,7 +638,7 @@ public class Checker {
ArrayList
<
Check
>
checkList
=
new
ArrayList
<>();
for
(
CheckId
id
:
enabledCheck
)
{
Check
c
=
checkConfig
.
getCheckForId
(
id
);
c
.
init
(
parameterMap
,
parserConfig
);
c
.
init
(
parameterMap
,
parserConfig
,
model
.
getCache
()
);
checkList
.
add
(
c
);
}
return
checkList
;
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/CheckContainer.java
View file @
00e86ae5
...
...
@@ -22,6 +22,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -62,8 +63,8 @@ public class CheckContainer extends Check {
}
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
)
{
check
.
init
(
parameters
,
config
);
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
check
.
init
(
parameters
,
config
,
cache
);
}
@Override
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/DuplicatePointsCheck.java
View file @
00e86ae5
...
...
@@ -37,6 +37,7 @@ import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
import
de.hft.stuttgart.citydoctor2.check.error.RingDuplicatePointError
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
...
...
@@ -69,7 +70,7 @@ public class DuplicatePointsCheck extends Check {
private
double
epsilon
=
Checks
.
MIN_VERTEX_DISTANCE_DEFAULT
;
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
params
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/InteriorDisconnectedCheck.java
View file @
00e86ae5
...
...
@@ -36,6 +36,7 @@ import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import
de.hft.stuttgart.citydoctor2.check.error.PolygonInteriorDisconnectedError
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
...
...
@@ -66,7 +67,7 @@ public class InteriorDisconnectedCheck extends Check {
private
double
epsilon
=
Checks
.
MIN_VERTEX_DISTANCE_DEFAULT
;
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
params
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/NullAreaCheck.java
View file @
00e86ae5
...
...
@@ -32,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.check.RequirementType;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.error.NullAreaError
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.math.Line3d
;
...
...
@@ -57,7 +58,7 @@ public class NullAreaCheck extends Check {
}
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
params
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/PlanarCheck.java
View file @
00e86ae5
...
...
@@ -35,6 +35,7 @@ import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import
de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError
;
import
de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonNormalsDeviation
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
...
...
@@ -81,7 +82,7 @@ public class PlanarCheck extends Check {
private
double
delta
=
0.01
;
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
parameters
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/RingSelfIntCheck.java
View file @
00e86ae5
...
...
@@ -38,6 +38,7 @@ import de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError;
import
de.hft.stuttgart.citydoctor2.check.error.RingEdgeIntersectionError
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundingBox
;
import
de.hft.stuttgart.citydoctor2.datastructure.Edge
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
...
...
@@ -76,7 +77,7 @@ public class RingSelfIntCheck extends Check {
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
parameters
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/SolidSelfIntCheck.java
View file @
00e86ae5
...
...
@@ -34,6 +34,7 @@ import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import
de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.checks.util.SelfIntersectionUtil
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
...
...
@@ -73,7 +74,7 @@ public class SolidSelfIntCheck extends Check {
}
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
parameters
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
planarParameters
=
parameters
.
get
(
CheckId
.
C_GE_P_NON_PLANAR
);
if
(
planarParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/semantics/IsWallCheck.java
View file @
00e86ae5
...
...
@@ -32,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.check.RequirementType;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.error.NotWallError
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurfaceType
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
...
...
@@ -75,7 +76,7 @@ public class IsWallCheck extends Check {
private
double
upperAngleCos
=
Math
.
cos
(
135
*
Math
.
PI
/
180
);
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
params
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/semantics/RoofSurfaceUnfragmentedCheck.java
View file @
00e86ae5
...
...
@@ -31,6 +31,7 @@ import de.hft.stuttgart.citydoctor2.check.Requirement;
import
de.hft.stuttgart.citydoctor2.check.RequirementType
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.checks.util.UnfragmentedCheck
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurfaceType
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
...
...
@@ -60,7 +61,7 @@ public class RoofSurfaceUnfragmentedCheck extends Check {
}
@Override
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
)
{
public
void
init
(
Map
<
CheckId
,
Map
<
String
,
String
>>
params
,
ParserConfiguration
config
,
CityObjectCache
cache
)
{
Map
<
String
,
String
>
localParameters
=
params
.
get
(
getCheckId
());
if
(
localParameters
==
null
)
{
// no parameters
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/geometry/NumPointsCheckTest.java
View file @
00e86ae5
...
...
@@ -53,7 +53,7 @@ public class NumPointsCheckTest {
TooFewPointsCheck
check
=
new
TooFewPointsCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
lr
);
CheckResult
checkResult
=
lr
.
getCheckResult
(
check
);
...
...
@@ -75,7 +75,7 @@ public class NumPointsCheckTest {
TooFewPointsCheck
check
=
new
TooFewPointsCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
lr
);
CheckResult
checkResult
=
lr
.
getCheckResult
(
check
);
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/geometry/RingSelfIntCheckTest.java
View file @
00e86ae5
...
...
@@ -150,7 +150,7 @@ public class RingSelfIntCheckTest {
geom
.
updateEdgesAndVertices
();
RingSelfIntCheck
check
=
new
RingSelfIntCheck
();
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
2
,
false
));
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
2
,
false
)
,
null
);
check
.
check
(
lr
);
CheckResult
cr
=
lr
.
getCheckResult
(
check
);
...
...
@@ -190,7 +190,7 @@ public class RingSelfIntCheckTest {
geom
.
updateEdgesAndVertices
();
RingSelfIntCheck
check
=
new
RingSelfIntCheck
();
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
2
,
false
));
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
2
,
false
)
,
null
);
check
.
check
(
lr
);
CheckResult
cr
=
lr
.
getCheckResult
(
check
);
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/semantics/IsWallCheckTest.java
View file @
00e86ae5
...
...
@@ -74,7 +74,7 @@ public class IsWallCheckTest {
IsWallCheck
check
=
new
IsWallCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
bs
);
CheckResult
checkResult
=
bs
.
getCheckResult
(
check
);
assertNotNull
(
checkResult
);
...
...
@@ -107,7 +107,7 @@ public class IsWallCheckTest {
IsWallCheck
check
=
new
IsWallCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
bs
);
CheckResult
checkResult
=
bs
.
getCheckResult
(
check
);
assertNull
(
checkResult
);
...
...
@@ -139,7 +139,7 @@ public class IsWallCheckTest {
IsWallCheck
check
=
new
IsWallCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
bs
);
CheckResult
checkResult
=
bs
.
getCheckResult
(
check
);
assertNotNull
(
checkResult
);
...
...
@@ -172,7 +172,7 @@ public class IsWallCheckTest {
IsWallCheck
check
=
new
IsWallCheck
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
check
.
init
(
Collections
.
emptyMap
(),
config
);
check
.
init
(
Collections
.
emptyMap
(),
config
,
null
);
check
.
check
(
bs
);
CheckResult
checkResult
=
bs
.
getCheckResult
(
check
);
assertNotNull
(
checkResult
);
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/util/SelfIntersectionUtilTest.java
View file @
00e86ae5
...
...
@@ -881,7 +881,7 @@ public class SelfIntersectionUtilTest {
geom
.
updateEdgesAndVertices
();
RingSelfIntCheck
check
=
new
RingSelfIntCheck
();
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
));
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
)
,
null
);
check
.
check
(
lr
);
assertEquals
(
ResultStatus
.
OK
,
lr
.
getCheckResult
(
check
).
getResultStatus
());
...
...
@@ -912,7 +912,7 @@ public class SelfIntersectionUtilTest {
geom
.
updateEdgesAndVertices
();
RingSelfIntCheck
check
=
new
RingSelfIntCheck
();
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
));
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
)
,
null
);
check
.
check
(
lr
);
assertEquals
(
ResultStatus
.
ERROR
,
lr
.
getCheckResult
(
check
).
getResultStatus
());
}
...
...
@@ -939,7 +939,7 @@ public class SelfIntersectionUtilTest {
geom
.
updateEdgesAndVertices
();
RingSelfIntCheck
check
=
new
RingSelfIntCheck
();
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
));
check
.
init
(
Collections
.
emptyMap
(),
new
ParserConfiguration
(
8
,
false
)
,
null
);
check
.
check
(
lr
);
assertEquals
(
ResultStatus
.
OK
,
lr
.
getCheckResult
(
check
).
getResultStatus
());
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment