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
be7abbb1
Commit
be7abbb1
authored
Feb 13, 2026
by
Luna Riegel
Browse files
Refactor: Change intersection util function
parent
3c5ade13
Changes
2
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/ValidationConfiguration.java
View file @
be7abbb1
...
...
@@ -91,6 +91,9 @@ public class ValidationConfiguration implements Serializable {
ValidationConfiguration
config
=
new
ValidationConfiguration
();
config
.
requirements
=
new
HashMap
<>();
for
(
CheckPrototype
c
:
Checks
.
getCheckPrototypes
())
{
if
(
c
.
getType
()
==
RequirementType
.
TOPOLOGY
){
continue
;
}
for
(
Requirement
req
:
c
.
checksRequirements
())
{
RequirementConfiguration
reqConfig
=
new
RequirementConfiguration
();
reqConfig
.
setEnabled
(
true
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/topology/FeatureCollisionCheck.java
View file @
be7abbb1
...
...
@@ -11,7 +11,9 @@ import de.hft.stuttgart.citydoctor2.check.RequirementType;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.error.FeatureCollisionError
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.geometry.SolidSelfIntCheck
;
import
de.hft.stuttgart.citydoctor2.checks.util.GeometryCollisionUtil
;
import
de.hft.stuttgart.citydoctor2.checks.util.SelfIntersectionUtil
;
import
de.hft.stuttgart.citydoctor2.database.CityObjectCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
...
...
@@ -27,6 +29,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.TopLevelTransportFeature;
import
de.hft.stuttgart.citydoctor2.datastructure.Vegetation
;
import
de.hft.stuttgart.citydoctor2.edge.PolygonPolygonIntersection
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection
;
import
java.util.ArrayList
;
import
java.util.Collection
;
...
...
@@ -136,21 +139,35 @@ public class FeatureCollisionCheck extends Check{
List
<
CollisionRecord
>
collisions
=
new
ArrayList
<>();
subjGeoms
.
forEach
(
sGeo
->{
candidates
.
forEach
(
candidate
->{
if
(
candidate
.
getGmlId
().
equals
(
subject
.
getGmlId
()))
return
;
candidate
.
accept
(
new
CheckableUtilsVisitor
()
{
@Override
public
void
check
(
Geometry
geom
)
{
List
<
PolygonPolygonIntersection
>
intersections
=
GeometryCollisionUtil
.
getGeometryIntersections
(
sGeo
,
geom
,
epsilon
);
if
(!
intersections
.
isEmpty
()){
List
<
PolygonIntersection
>
intersections
=
getPolygonIntersections
(
sGeo
,
geom
);
if
(!
intersections
.
isEmpty
()){
CollisionRecord
collRec
=
new
CollisionRecord
(
sGeo
,
geom
,
candidate
);
intersections
.
forEach
(
ppi
->
collRec
.
addCollision
(
ppi
.
getPolygon1
().
getOriginal
(),
ppi
.
getPolygon2
().
getOriginal
()));
collisions
.
add
(
collRec
);
for
(
PolygonIntersection
intersection
:
intersections
)
{
if
(
intersection
.
getType
()
==
PolygonIntersection
.
IntersectionType
.
NONE
){
continue
;
}
collRec
.
addCollision
(
intersection
.
getP1
(),
intersection
.
getP2
());
}
if
(!
collRec
.
getCollisionMap
().
isEmpty
())
collisions
.
add
(
collRec
);
}
// List<PolygonPolygonIntersection> intersections =
// GeometryCollisionUtil.getGeometryIntersections(sGeo, geom, epsilon);
// if(!intersections.isEmpty()){
// CollisionRecord collRec = new CollisionRecord(sGeo, geom, candidate);
// intersections.forEach(ppi ->
// collRec.addCollision(ppi.getPolygon1().getOriginal(), ppi.getPolygon2().getOriginal()));
// collisions.add(collRec);
// }
}
});
});
});
if
(
collisions
.
isEmpty
()){
subject
.
addCheckResult
(
new
CheckResult
(
this
,
ResultStatus
.
OK
,
null
));
}
else
{
...
...
@@ -165,7 +182,16 @@ public class FeatureCollisionCheck extends Check{
}
}
private
List
<
PolygonIntersection
>
getPolygonIntersections
(
Geometry
subject
,
Geometry
candidate
){
List
<
PolygonIntersection
>
intersections
=
new
ArrayList
<>();
for
(
Polygon
sPoly
:
subject
.
getPolygons
()){
for
(
Polygon
cPoly
:
candidate
.
getPolygons
()){
intersections
.
add
(
SelfIntersectionUtil
.
polygonIntersection
(
sPoly
,
cPoly
,
0.001
,
epsilon
));
}
}
return
intersections
;
}
private
static
class
CollisionRecord
{
...
...
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