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
197b48b3
Commit
197b48b3
authored
Sep 04, 2026
by
Luna Riegel
Browse files
Fix: Fix bug reported in
#122
parent
7f0c003c
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java
View file @
197b48b3
...
...
@@ -44,8 +44,9 @@ public class ConcretePolygon extends Polygon {
private
LinearRing
exterior
;
private
List
<
LinearRing
>
innerRings
;
private
BoundarySurface
partOfSurface
;
private
Installation
partfOfInstallation
;
private
BoundarySurface
partOfSurface
=
null
;
private
Installation
partfOfInstallation
=
null
;
private
AbstractFurniture
partOfFurniture
=
null
;
private
CompositeCollection
partOfComposite
=
null
;
private
PatchCollection
partOfPatch
=
null
;
private
Geometry
parent
;
...
...
@@ -286,6 +287,16 @@ public class ConcretePolygon extends Polygon {
return
partfOfInstallation
;
}
@Override
public
void
setPartOfFurniture
(
AbstractFurniture
furn
)
{
this
.
partOfFurniture
=
furn
;
}
@Override
public
AbstractFurniture
getPartOfFurniture
()
{
return
partOfFurniture
;
}
/*
* (non-Javadoc)
*
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java
View file @
197b48b3
...
...
@@ -260,6 +260,17 @@ public class LinkedPolygon extends Polygon {
return
poly
.
getPartOfInstallation
();
}
@Override
public
void
setPartOfFurniture
(
AbstractFurniture
furn
)
{
poly
.
setPartOfFurniture
(
furn
);
}
@Override
public
AbstractFurniture
getPartOfFurniture
()
{
return
poly
.
getPartOfFurniture
();
}
@Override
public
boolean
hasPointAsCorner
(
Vertex
v
)
{
return
poly
.
hasPointAsCorner
(
v
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Polygon.java
View file @
197b48b3
...
...
@@ -67,6 +67,10 @@ public abstract class Polygon extends GmlElement {
public
abstract
Installation
getPartOfInstallation
();
public
abstract
void
setPartOfFurniture
(
AbstractFurniture
furn
);
public
abstract
AbstractFurniture
getPartOfFurniture
();
public
abstract
boolean
hasPointAsCorner
(
Vertex
v
);
public
abstract
void
removeRings
();
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
197b48b3
...
...
@@ -593,6 +593,19 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdBridgeInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdBridgeInst
,
Orientation
.
OUTWARD
);
for
(
BoundarySurface
bs
:
cdBridgeInst
.
getBoundarySurfaces
())
{
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
cdBridgeInst
);
}
}
}
for
(
Geometry
geom
:
cdBridgeInst
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
cdBridgeInst
);
}
}
return
cdBridgeInst
;
}
...
...
@@ -621,6 +634,18 @@ public class Citygml3FeatureMapper extends ObjectWalker {
var
dProp
=
bridgeFurn
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdFurn
,
Orientation
.
OUTWARD
);
for
(
BoundarySurface
bs:
cdFurn
.
getBoundarySurfaces
())
{
for
(
Geometry
geom:
bs
.
getGeometries
()){
for
(
Polygon
poly:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdFurn
);
}
}
}
for
(
Geometry
geom
:
cdFurn
.
getGeometries
()){
for
(
Polygon
poly
:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdFurn
);
}
}
return
cdFurn
;
}
...
...
@@ -733,6 +758,19 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdTunnelInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdTunnelInst
,
Orientation
.
OUTWARD
);
for
(
BoundarySurface
bs
:
cdTunnelInst
.
getBoundarySurfaces
())
{
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
cdTunnelInst
);
}
}
}
for
(
Geometry
geom
:
cdTunnelInst
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
cdTunnelInst
);
}
}
return
cdTunnelInst
;
}
...
...
@@ -762,6 +800,20 @@ public class Citygml3FeatureMapper extends ObjectWalker {
var
dProp
=
tunnelFurn
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdTunnelFurn
,
Orientation
.
OUTWARD
);
for
(
BoundarySurface
bs:
cdTunnelFurn
.
getBoundarySurfaces
())
{
for
(
Geometry
geom:
bs
.
getGeometries
()){
for
(
Polygon
poly:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdTunnelFurn
);
}
}
}
for
(
Geometry
geom
:
cdTunnelFurn
.
getGeometries
()){
for
(
Polygon
poly
:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdTunnelFurn
);
}
}
return
cdTunnelFurn
;
}
...
...
@@ -1353,6 +1405,18 @@ public class Citygml3FeatureMapper extends ObjectWalker {
var
dProp
=
buildingFurn
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdFurn
,
Orientation
.
OUTWARD
);
for
(
BoundarySurface
bs:
cdFurn
.
getBoundarySurfaces
())
{
for
(
Geometry
geom:
bs
.
getGeometries
()){
for
(
Polygon
poly:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdFurn
);
}
}
}
for
(
Geometry
geom
:
cdFurn
.
getGeometries
()){
for
(
Polygon
poly
:
geom
.
getPolygons
()){
poly
.
setPartOfFurniture
(
cdFurn
);
}
}
return
cdFurn
;
}
...
...
@@ -1459,12 +1523,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdInst
,
Orientation
.
OUTWARD
);
return
cdInst
;
}
private
void
mapAbstractInstallation
(
AbstractInstallation
abstractInst
,
Installation
cdInst
)
{
mapAbstractOccupiedSpace
(
abstractInst
,
cdInst
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
abstractInst
,
cdInst
);
for
(
BoundarySurface
bs
:
cdInst
.
getBoundarySurfaces
())
{
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
...
...
@@ -1477,6 +1535,13 @@ public class Citygml3FeatureMapper extends ObjectWalker {
p
.
setPartOfInstallation
(
cdInst
);
}
}
return
cdInst
;
}
private
void
mapAbstractInstallation
(
AbstractInstallation
abstractInst
,
Installation
cdInst
)
{
mapAbstractOccupiedSpace
(
abstractInst
,
cdInst
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
abstractInst
,
cdInst
);
}
private
void
parseAndAddAbstractGeometry
(
GeometryProperty
<?>
geomProp
,
Lod
lod
,
CityObject
co
,
Orientation
orientation
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/SurfaceMapper.java
View file @
197b48b3
...
...
@@ -18,6 +18,7 @@
*/
package
de.hft.stuttgart.citydoctor2.mapper.citygml3
;
import
de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.construction.*
;
...
...
@@ -85,6 +86,11 @@ public class SurfaceMapper extends ObjectWalker {
parseAndAddMultiSurface
(
afs
.
getLod2MultiSurface
(),
Lod
.
LOD2
,
o
);
parseAndAddMultiSurface
(
afs
.
getLod3MultiSurface
(),
Lod
.
LOD3
,
o
);
parseAndAddMultiSurface
(
afs
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
o
);
for
(
Geometry
geom
:
o
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
cdSurface
);
}
}
o
.
unsetGmlGeometries
();
}
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/semantics/PolygonWithoutSurfaceCheck.java
View file @
197b48b3
...
...
@@ -21,7 +21,7 @@ public class PolygonWithoutSurfaceCheck extends Check {
if
(
lod
==
Lod
.
LOD2
||
lod
==
Lod
.
LOD3
||
lod
==
Lod
.
LOD4
)
{
// only check LOD2-4
CheckResult
cr
;
if
(
poly
.
getPartOfSurface
()
==
null
)
{
if
(
poly
.
getPartOfSurface
()
==
null
&&
poly
.
getPartOfInstallation
()
==
null
&&
poly
.
getPartOfFurniture
()
==
null
)
{
PolygonWithoutSurfaceError
err
=
new
PolygonWithoutSurfaceError
(
poly
);
cr
=
new
CheckResult
(
this
,
ResultStatus
.
ERROR
,
err
);
}
else
{
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/semantics/PolygonWithoutSurfaceCheckTest.java
View file @
197b48b3
...
...
@@ -5,7 +5,14 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -73,4 +80,16 @@ public class PolygonWithoutSurfaceCheckTest {
assertNull
(
checkResult
);
}
@Test
public
void
testFZKModel
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setSchematronFilePathInGlobalParameters
(
null
);
CityDoctorModel
m
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/FZK_haus.gml"
,
config
.
getParserConfiguration
());
Building
fzk
=
m
.
getBuildings
().
toList
().
get
(
0
);
PolygonWithoutSurfaceCheck
check
=
new
PolygonWithoutSurfaceCheck
();
fzk
.
accept
(
check
);
assertFalse
(
fzk
.
containsError
(
CheckId
.
C_SE_POLYGON_WITHOUT_SURFACE
));
}
}
CityDoctorParent/CityDoctorValidation/src/test/resources/FZK_haus.gml
0 → 100644
View file @
197b48b3
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