Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
fb27a687
Commit
fb27a687
authored
Oct 30, 2020
by
Matthias Betz
Browse files
added global parameters to validation configuration
parent
4178bc72
Pipeline
#1120
passed with stage
in 2 minutes and 7 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
View file @
fb27a687
...
@@ -338,6 +338,10 @@ public class Checker {
...
@@ -338,6 +338,10 @@ public class Checker {
for
(
Entry
<
CheckId
,
CheckConfiguration
>
e
:
config
.
getChecks
().
entrySet
())
{
for
(
Entry
<
CheckId
,
CheckConfiguration
>
e
:
config
.
getChecks
().
entrySet
())
{
if
(
e
.
getValue
().
isEnabled
())
{
if
(
e
.
getValue
().
isEnabled
())
{
Check
c
=
checkConfig
.
getCheckForId
(
e
.
getKey
());
Check
c
=
checkConfig
.
getCheckForId
(
e
.
getKey
());
Map
<
String
,
String
>
parameters
=
new
HashMap
<>();
parameters
.
putAll
(
e
.
getValue
().
getParameters
());
parameters
.
put
(
"numberOfRoundedPlaces"
,
""
+
config
.
getNumberOfRoundingPlaces
());
parameters
.
put
(
"minVertexDistance"
,
""
+
config
.
getMinVertexDistance
());
// initialize checks with parameters
// initialize checks with parameters
c
.
init
(
e
.
getValue
().
getParameters
(),
parserConfig
);
c
.
init
(
e
.
getValue
().
getParameters
(),
parserConfig
);
checks
.
add
(
c
);
checks
.
add
(
c
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/ValidationConfiguration.java
View file @
fb27a687
...
@@ -64,6 +64,8 @@ public class ValidationConfiguration implements Serializable {
...
@@ -64,6 +64,8 @@ public class ValidationConfiguration implements Serializable {
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
ValidationConfiguration
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
ValidationConfiguration
.
class
);
private
int
numberOfRoundingPlaces
=
8
;
private
int
numberOfRoundingPlaces
=
8
;
private
double
minVertexDistance
=
0.0001
;
private
String
schematronFilePath
=
null
;
private
String
schematronFilePath
=
null
;
private
boolean
xmlValidation
=
false
;
private
boolean
xmlValidation
=
false
;
...
@@ -111,31 +113,33 @@ public class ValidationConfiguration implements Serializable {
...
@@ -111,31 +113,33 @@ public class ValidationConfiguration implements Serializable {
@Override
@Override
protected
NodeTuple
representJavaBeanProperty
(
Object
javaBean
,
Property
property
,
Object
propertyValue
,
protected
NodeTuple
representJavaBeanProperty
(
Object
javaBean
,
Property
property
,
Object
propertyValue
,
Tag
customTag
)
{
Tag
customTag
)
{
if
(
propertyValue
==
null
)
{
if
(
propertyValue
==
null
)
{
return
null
;
return
null
;
}
else
{
}
else
{
NodeTuple
tuple
=
super
.
representJavaBeanProperty
(
javaBean
,
property
,
propertyValue
,
NodeTuple
tuple
=
super
.
representJavaBeanProperty
(
javaBean
,
property
,
propertyValue
,
customTag
);
customTag
);
Node
valueNode
=
tuple
.
getValueNode
();
Node
valueNode
=
tuple
.
getValueNode
();
if
(
Tag
.
NULL
.
equals
(
valueNode
.
getTag
()))
{
if
(
Tag
.
NULL
.
equals
(
valueNode
.
getTag
()))
{
// skip 'null' values
return
null
;
// skip 'null' values
return
null
;
}
}
if
(
valueNode
instanceof
CollectionNode
)
{
if
(
valueNode
instanceof
CollectionNode
)
{
if
(
Tag
.
SEQ
.
equals
(
valueNode
.
getTag
()))
{
if
(
Tag
.
SEQ
.
equals
(
valueNode
.
getTag
()))
{
SequenceNode
seq
=
(
SequenceNode
)
valueNode
;
SequenceNode
seq
=
(
SequenceNode
)
valueNode
;
if
(
seq
.
getValue
().
isEmpty
())
{
if
(
seq
.
getValue
().
isEmpty
())
{
return
null
;
// skip empty lists
// skip empty lists
}
return
null
;
}
}
if
(
Tag
.
MAP
.
equals
(
valueNode
.
getTag
()))
{
}
MappingNode
seq
=
(
MappingNode
)
valueNode
;
if
(
Tag
.
MAP
.
equals
(
valueNode
.
getTag
()))
{
if
(
seq
.
getValue
().
isEmpty
())
{
MappingNode
seq
=
(
MappingNode
)
valueNode
;
return
null
;
// skip empty maps
if
(
seq
.
getValue
().
isEmpty
())
{
}
// skip empty maps
}
return
null
;
}
}
return
tuple
;
}
}
}
return
tuple
;
}
}
}
};
};
rep
.
addClassTag
(
ValidationConfiguration
.
class
,
Tag
.
MAP
);
rep
.
addClassTag
(
ValidationConfiguration
.
class
,
Tag
.
MAP
);
...
@@ -211,7 +215,7 @@ public class ValidationConfiguration implements Serializable {
...
@@ -211,7 +215,7 @@ public class ValidationConfiguration implements Serializable {
}
}
insertMissingParametersWithDefaultParameters
(
e
,
c
);
insertMissingParametersWithDefaultParameters
(
e
,
c
);
}
}
if
(
schematronFilePath
!=
null
)
{
if
(
schematronFilePath
!=
null
&&
!
schematronFilePath
.
isEmpty
()
)
{
File
f
=
new
File
(
schematronFilePath
);
File
f
=
new
File
(
schematronFilePath
);
if
(!
f
.
exists
()
||
!
f
.
isFile
())
{
if
(!
f
.
exists
()
||
!
f
.
isFile
())
{
schematronFilePath
=
null
;
schematronFilePath
=
null
;
...
@@ -249,4 +253,11 @@ public class ValidationConfiguration implements Serializable {
...
@@ -249,4 +253,11 @@ public class ValidationConfiguration implements Serializable {
this
.
parserConfig
=
parserConfig
;
this
.
parserConfig
=
parserConfig
;
}
}
public
void
setMinVertexDistance
(
double
minVertexDistance
)
{
this
.
minVertexDistance
=
minVertexDistance
;
}
public
double
getMinVertexDistance
()
{
return
minVertexDistance
;
}
}
}
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/DuplicatePointsCheck.java
View file @
fb27a687
...
@@ -29,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
...
@@ -29,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.CheckType
;
import
de.hft.stuttgart.citydoctor2.check.CheckType
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.check.DefaultParameter
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.Unit
;
import
de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError
;
import
de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError
;
import
de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError
;
import
de.hft.stuttgart.citydoctor2.check.error.DuplicatePointError
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
...
@@ -55,7 +53,6 @@ public class DuplicatePointsCheck extends Check {
...
@@ -55,7 +53,6 @@ public class DuplicatePointsCheck extends Check {
private
static
final
List
<
CheckId
>
dependencies
;
private
static
final
List
<
CheckId
>
dependencies
;
private
static
final
List
<
Class
<?
extends
Checkable
>>
applicableToClasses
;
private
static
final
List
<
Class
<?
extends
Checkable
>>
applicableToClasses
;
private
static
final
List
<
DefaultParameter
>
defaultParameters
;
static
{
static
{
ArrayList
<
CheckId
>
deps
=
new
ArrayList
<>();
ArrayList
<
CheckId
>
deps
=
new
ArrayList
<>();
...
@@ -67,9 +64,6 @@ public class DuplicatePointsCheck extends Check {
...
@@ -67,9 +64,6 @@ public class DuplicatePointsCheck extends Check {
classes
.
add
(
LinearRing
.
class
);
classes
.
add
(
LinearRing
.
class
);
applicableToClasses
=
Collections
.
unmodifiableList
(
classes
);
applicableToClasses
=
Collections
.
unmodifiableList
(
classes
);
ArrayList
<
DefaultParameter
>
defaultParameter
=
new
ArrayList
<>();
defaultParameter
.
add
(
new
DefaultParameter
(
EPSILON_NAME
,
"0.0001"
,
Unit
.
METER
));
defaultParameters
=
Collections
.
unmodifiableList
(
defaultParameter
);
}
}
private
double
epsilon
=
0.0001
;
private
double
epsilon
=
0.0001
;
...
@@ -88,11 +82,6 @@ public class DuplicatePointsCheck extends Check {
...
@@ -88,11 +82,6 @@ public class DuplicatePointsCheck extends Check {
super
(
CheckId
.
C_GE_R_DUPLICATE_POINT
);
super
(
CheckId
.
C_GE_R_DUPLICATE_POINT
);
}
}
@Override
public
List
<
DefaultParameter
>
getDefaultParameter
()
{
return
defaultParameters
;
}
@Override
@Override
public
List
<
CheckId
>
getDependencies
()
{
public
List
<
CheckId
>
getDependencies
()
{
return
dependencies
;
return
dependencies
;
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/RingSelfIntCheck.java
View file @
fb27a687
...
@@ -29,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
...
@@ -29,9 +29,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.CheckType
;
import
de.hft.stuttgart.citydoctor2.check.CheckType
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.check.DefaultParameter
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.Unit
;
import
de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError
;
import
de.hft.stuttgart.citydoctor2.check.error.EdgeIntersectionError
;
import
de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError
;
import
de.hft.stuttgart.citydoctor2.check.error.PointTouchesEdgeError
;
import
de.hft.stuttgart.citydoctor2.datastructure.Edge
;
import
de.hft.stuttgart.citydoctor2.datastructure.Edge
;
...
@@ -49,7 +47,6 @@ public class RingSelfIntCheck extends Check {
...
@@ -49,7 +47,6 @@ public class RingSelfIntCheck extends Check {
private
static
final
List
<
CheckId
>
dependencies
;
private
static
final
List
<
CheckId
>
dependencies
;
private
static
final
List
<
Class
<?
extends
Checkable
>>
applicableToClasses
;
private
static
final
List
<
Class
<?
extends
Checkable
>>
applicableToClasses
;
private
static
final
List
<
DefaultParameter
>
defaultParameters
;
static
{
static
{
...
@@ -63,10 +60,6 @@ public class RingSelfIntCheck extends Check {
...
@@ -63,10 +60,6 @@ public class RingSelfIntCheck extends Check {
classes
.
add
(
LinearRing
.
class
);
classes
.
add
(
LinearRing
.
class
);
applicableToClasses
=
Collections
.
unmodifiableList
(
classes
);
applicableToClasses
=
Collections
.
unmodifiableList
(
classes
);
ArrayList
<
DefaultParameter
>
defaultParameter
=
new
ArrayList
<>();
defaultParameter
.
add
(
new
DefaultParameter
(
EPSILON_NAME
,
"0.0001"
,
Unit
.
METER
));
defaultParameters
=
Collections
.
unmodifiableList
(
defaultParameter
);
}
}
private
double
epsilon
=
0.0001
;
private
double
epsilon
=
0.0001
;
...
@@ -163,11 +156,6 @@ public class RingSelfIntCheck extends Check {
...
@@ -163,11 +156,6 @@ public class RingSelfIntCheck extends Check {
return
applicableToClasses
;
return
applicableToClasses
;
}
}
@Override
public
List
<
DefaultParameter
>
getDefaultParameter
()
{
return
defaultParameters
;
}
@Override
@Override
public
CheckType
getType
()
{
public
CheckType
getType
()
{
return
CheckType
.
GEOMETRY
;
return
CheckType
.
GEOMETRY
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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