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
006bb2b0
Commit
006bb2b0
authored
5 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Code cleanup
parent
5a615b7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLine.java
+7
-9
...main/java/de/hft/stuttgart/citydoctor2/edge/PolyLine.java
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLineSegment.java
+1
-2
...va/de/hft/stuttgart/citydoctor2/edge/PolyLineSegment.java
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/geometry/SolidSelfIntCheckTest.java
+15
-78
...rt/citydoctor2/checks/geometry/SolidSelfIntCheckTest.java
with
23 additions
and
89 deletions
+23
-89
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLine.java
+
7
-
9
View file @
006bb2b0
...
...
@@ -78,21 +78,21 @@ public class PolyLine extends BaseEntity {
return
mpLast
;
}
public
B
oolean
isNullLine
()
{
public
b
oolean
isNullLine
()
{
return
isNullLine
(
0.00
);
}
public
B
oolean
isNullLine
(
D
ouble
tolerance
)
{
public
b
oolean
isNullLine
(
d
ouble
tolerance
)
{
// If either start or end Segment is null, return immediately
if
(
mpFirst
==
null
||
mpLast
==
null
)
{
return
true
;
}
PolyLineSegment
currentSegment
=
mpFirst
;
D
ouble
length
=
0.00
;
d
ouble
length
=
0.00
;
// Add length of all segments, starting from mpFirst
do
{
D
ouble
segmentLength
=
currentSegment
.
getLengthVector
().
getLength
();
d
ouble
segmentLength
=
currentSegment
.
getLengthVector
().
getLength
();
if
(
segmentLength
>
tolerance
)
{
length
+=
segmentLength
;
}
...
...
@@ -103,15 +103,13 @@ public class PolyLine extends BaseEntity {
}
while
(
currentSegment
.
getNext
()
!=
null
);
// Since mpLast will be missed due to loop condition add its length afterwards
D
ouble
segmentLength
=
mpLast
.
getLengthVector
().
getLength
();
d
ouble
segmentLength
=
mpLast
.
getLengthVector
().
getLength
();
if
(
segmentLength
>
tolerance
)
{
length
+=
segmentLength
;
}
// Check if total length is less than the set tolerance
if
(
length
<=
tolerance
)
{
return
true
;
}
return
false
;
return
length
<=
tolerance
;
}
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/PolyLineSegment.java
+
1
-
2
View file @
006bb2b0
...
...
@@ -59,8 +59,7 @@ public class PolyLineSegment extends BaseEntity {
}
public
Vector3d
getLengthVector
()
{
Vector3d
representation
=
mpEnd
.
getPoint
().
minus
(
mpStart
.
getPoint
());
return
representation
;
return
mpEnd
.
getPoint
().
minus
(
mpStart
.
getPoint
());
}
@Override
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/geometry/SolidSelfIntCheckTest.java
+
15
-
78
View file @
006bb2b0
...
...
@@ -21,14 +21,8 @@ package de.hft.stuttgart.citydoctor2.checks.geometry;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.logging.log4j.core.util.internal.Status
;
import
org.junit.Assert
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
...
...
@@ -84,16 +78,20 @@ public class SolidSelfIntCheckTest {
assertFalse
(
m
.
getBuildings
().
get
(
0
).
containsAnyError
());
}
@Test
p
ublic
void
test
Known
FalsePositiveExample
1
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
p
rivate
void
testFalsePositiveExample
(
String
gml_filepath
)
throws
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setSchematronFilePathInGlobalParameters
(
null
);
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SolidSelfIntTest-known_false_positive1.gml"
,
config
.
getParserConfiguration
());
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
gml_filepath
,
config
.
getParserConfiguration
());
Checker
c
=
new
Checker
(
config
,
m
);
c
.
runChecks
();
Building
building
=
m
.
getBuildings
().
get
(
0
);
System
.
out
.
println
(
building
.
containsAnyError
());
// Example1 Building has some BuildingInstallations, which throw semantic errors
/*
* The examples have no actual self-intersections, but can contain other actual model defects.
* If an error is detected, it is thus required to check if the
* False-Positive self-intersection triggered it.
*/
if
(
building
.
containsAnyError
())
{
Geometry
buildingGeom
=
building
.
getGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
);
buildingGeom
.
clearCheckResults
();
...
...
@@ -101,83 +99,22 @@ public class SolidSelfIntCheckTest {
check
.
check
(
buildingGeom
);
CheckResult
cr
=
buildingGeom
.
getCheckResult
(
check
);
assertNotNull
(
cr
);
//Ensure that
c
he
cker did not find
a self
intersection
//Ensure that
t
he
found error is not
a self
-
intersection
error
assertEquals
(
"Known False-Positive self-intersection was detected as error"
,
ResultStatus
.
OK
,
cr
.
getResultStatus
());
}
}
@Test
public
void
testKnownFalsePositiveExample2
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setSchematronFilePathInGlobalParameters
(
null
);
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SolidSelfIntTest-known_false_positive2.gml"
,
config
.
getParserConfiguration
());
Checker
c
=
new
Checker
(
config
,
m
);
c
.
runChecks
();
Building
building
=
m
.
getBuildings
().
get
(
0
);
// If an error was found, check if error is SolidSelfInt
if
(
building
.
containsAnyError
())
{
Geometry
buildingGeom
=
building
.
getGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
);
buildingGeom
.
clearCheckResults
();
SolidSelfIntCheck
check
=
new
SolidSelfIntCheck
();
check
.
check
(
buildingGeom
);
CheckResult
cr
=
buildingGeom
.
getCheckResult
(
check
);
assertNotNull
(
cr
);
//Ensure that checker did not find the false-positive self intersection
assertEquals
(
"Known False-Positive self-intersection was detected as error"
,
ResultStatus
.
OK
,
cr
.
getResultStatus
());
}
public
void
testKnownFalsePositiveExample1
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
testFalsePositiveExample
(
"src/test/resources/SolidSelfIntTest-known_false_positive1.gml"
);
}
@Ignore
(
"Only run this test locally. The big mesh causes the CI/CD-Runner to crash due to running out of RAM"
)
@Test
public
void
testKnownFalsePositiveExample_BigMesh1
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setSchematronFilePathInGlobalParameters
(
null
);
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SolidSelfIntTest-known_false_positive_Big_Mesh1.gml"
,
config
.
getParserConfiguration
());
Checker
c
=
new
Checker
(
config
,
m
);
c
.
runChecks
();
Building
building
=
m
.
getBuildings
().
get
(
0
);
// If an error was found, check if error is SolidSelfInt
if
(
building
.
containsAnyError
())
{
Geometry
buildingGeom
=
building
.
getGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
);
buildingGeom
.
clearCheckResults
();
SolidSelfIntCheck
check
=
new
SolidSelfIntCheck
();
check
.
check
(
buildingGeom
);
CheckResult
cr
=
buildingGeom
.
getCheckResult
(
check
);
assertNotNull
(
cr
);
assertEquals
(
"Known False-Positive self-intersection was detected as error"
,
ResultStatus
.
OK
,
cr
.
getResultStatus
());
}
public
void
testKnownFalsePositiveExample2
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
testFalsePositiveExample
(
"src/test/resources/SolidSelfIntTest-known_false_positive2.gml"
);
}
@Ignore
(
"Only run this test locally. The big mesh causes the CI/CD-Runner to crash due to running out of RAM"
)
@Test
public
void
testKnownFalsePositiveExample_BigMesh2
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setSchematronFilePathInGlobalParameters
(
null
);
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SolidSelfIntTest-known_false_positive_Big_Mesh2.gml"
,
config
.
getParserConfiguration
());
Checker
c
=
new
Checker
(
config
,
m
);
c
.
runChecks
();
Building
building
=
m
.
getBuildings
().
get
(
0
);
// If an error was found, check if error is SolidSelfInt
if
(
building
.
containsAnyError
())
{
Geometry
buildingGeom
=
building
.
getGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
);
buildingGeom
.
clearCheckResults
();
SolidSelfIntCheck
check
=
new
SolidSelfIntCheck
();
check
.
check
(
buildingGeom
);
CheckResult
cr
=
buildingGeom
.
getCheckResult
(
check
);
assertNotNull
(
cr
);
//Ensure that checker did not find the false-positive self intersection
assertEquals
(
"Known False-Positive self-intersection was detected as error"
,
ResultStatus
.
OK
,
cr
.
getResultStatus
());
}
}
}
This diff is collapsed.
Click to expand it.
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