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
03fbe199
Commit
03fbe199
authored
Mar 12, 2026
by
Luna Riegel
Browse files
Refactor: Unify and generalize CityGml3FeatureMapper
parent
8abf5e03
Pipeline
#12357
failed with stage
in 1 minute and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelPart.java
View file @
03fbe199
...
@@ -9,18 +9,17 @@ public class TunnelPart extends AbstractTunnel {
...
@@ -9,18 +9,17 @@ public class TunnelPart extends AbstractTunnel {
private
Tunnel
parent
;
private
Tunnel
parent
;
private
TunnelPart
()
{
public
TunnelPart
()
{
}
public
TunnelPart
(
Tunnel
parent
)
{
this
.
parent
=
parent
;
parent
.
addTunnelPart
(
this
);
}
}
public
Tunnel
getParent
()
{
public
Tunnel
getParent
()
{
return
parent
;
return
parent
;
}
}
public
void
setParent
(
Tunnel
parent
)
{
this
.
parent
=
parent
;
}
@Override
@Override
public
CityObject
getTopLevelCityObject
()
{
public
CityObject
getTopLevelCityObject
()
{
return
getParent
().
getTopLevelCityObject
();
return
getParent
().
getTopLevelCityObject
();
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
03fbe199
...
@@ -24,11 +24,21 @@ import java.util.HashMap;
...
@@ -24,11 +24,21 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.StringJoiner
;
import
java.util.StringJoiner
;
import
java.util.stream.Collectors
;
import
de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor
;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractBridgeObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractBuildingSubdivision
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractConstructiveFillingElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractConstructiveFillingElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractFurniture
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundedSpace
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundingBox
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundingBox
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeObjectPart
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeRoom
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeRoomFurniture
;
import
de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.DoorObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.DoorObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.FeatureType
;
import
de.hft.stuttgart.citydoctor2.datastructure.FeatureType
;
import
de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject
;
...
@@ -39,12 +49,13 @@ import org.citygml4j.core.model.CityGMLVersion;
...
@@ -39,12 +49,13 @@ import org.citygml4j.core.model.CityGMLVersion;
import
org.citygml4j.core.model.bridge.AbstractBridge
;
import
org.citygml4j.core.model.bridge.AbstractBridge
;
import
org.citygml4j.core.model.bridge.Bridge
;
import
org.citygml4j.core.model.bridge.Bridge
;
import
org.citygml4j.core.model.bridge.BridgeConstructiveElementProperty
;
import
org.citygml4j.core.model.bridge.BridgeConstructiveElementProperty
;
import
org.citygml4j.core.model.bridge.BridgeFurniture
;
import
org.citygml4j.core.model.bridge.BridgeFurnitureProperty
;
import
org.citygml4j.core.model.bridge.BridgeInstallation
;
import
org.citygml4j.core.model.bridge.BridgeInstallation
;
import
org.citygml4j.core.model.bridge.BridgeInstallationProperty
;
import
org.citygml4j.core.model.bridge.BridgeInstallationProperty
;
import
org.citygml4j.core.model.bridge.BridgePart
;
import
org.citygml4j.core.model.bridge.BridgePartProperty
;
import
org.citygml4j.core.model.bridge.BridgePartProperty
;
import
org.citygml4j.core.model.bridge.BridgeRoomProperty
;
import
org.citygml4j.core.model.building.AbstractBuildingSubdivisionProperty
;
import
org.citygml4j.core.model.building.AbstractBuildingSubdivisionProperty
;
import
org.citygml4j.core.model.building.BuildingConstructiveElement
;
import
org.citygml4j.core.model.building.BuildingConstructiveElementProperty
;
import
org.citygml4j.core.model.building.BuildingConstructiveElementProperty
;
import
org.citygml4j.core.model.building.BuildingFurniture
;
import
org.citygml4j.core.model.building.BuildingFurniture
;
import
org.citygml4j.core.model.building.BuildingFurnitureProperty
;
import
org.citygml4j.core.model.building.BuildingFurnitureProperty
;
...
@@ -52,11 +63,13 @@ import org.citygml4j.core.model.building.BuildingInstallationProperty;
...
@@ -52,11 +63,13 @@ import org.citygml4j.core.model.building.BuildingInstallationProperty;
import
org.citygml4j.core.model.building.BuildingPartProperty
;
import
org.citygml4j.core.model.building.BuildingPartProperty
;
import
org.citygml4j.core.model.building.BuildingRoomProperty
;
import
org.citygml4j.core.model.building.BuildingRoomProperty
;
import
org.citygml4j.core.model.building.BuildingUnit
;
import
org.citygml4j.core.model.building.BuildingUnit
;
import
org.citygml4j.core.model.building.BuildingUnitProperty
;
import
org.citygml4j.core.model.building.Storey
;
import
org.citygml4j.core.model.building.Storey
;
import
org.citygml4j.core.model.
construction.AbstractConstruction
;
import
org.citygml4j.core.model.
building.StoreyProperty
;
import
org.citygml4j.core.model.construction.AbstractConstructiveElement
;
import
org.citygml4j.core.model.construction.AbstractConstructiveElement
;
import
org.citygml4j.core.model.construction.AbstractFillingElement
;
import
org.citygml4j.core.model.construction.AbstractFillingElement
;
import
org.citygml4j.core.model.construction.AbstractFillingElementProperty
;
import
org.citygml4j.core.model.construction.AbstractFillingElementProperty
;
import
org.citygml4j.core.model.construction.AbstractInstallation
;
import
org.citygml4j.core.model.construction.Door
;
import
org.citygml4j.core.model.construction.Door
;
import
org.citygml4j.core.model.construction.OtherConstruction
;
import
org.citygml4j.core.model.construction.OtherConstruction
;
import
org.citygml4j.core.model.construction.Window
;
import
org.citygml4j.core.model.construction.Window
;
...
@@ -249,119 +262,100 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -249,119 +262,100 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
@Override
@Override
public
void
visit
(
OtherConstruction
gmlOc
){
public
void
visit
(
OtherConstruction
gmlOtherConstruction
){
OtherConstructionObject
oco
=
new
OtherConstructionObject
();
OtherConstructionObject
cdOtherConstruction
=
new
OtherConstructionObject
();
oco
.
setGmlObject
(
gmlOc
);
cdOtherConstruction
.
setGmlObject
(
gmlOtherConstruction
);
mapAbstractOccupiedSpace
(
gmlOc
,
oco
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
gmlOtherConstruction
,
cdOtherConstruction
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
gmlOtherConstruction
,
cdOtherConstruction
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
finishFeatureConstruction
(
cdOtherConstruction
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlOc
.
getBoundaries
())
{
model
.
addOtherCityObject
(
cdOtherConstruction
);
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
oco
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
finishCityObjectConstruction
(
oco
);
model
.
addOtherCityObject
(
oco
);
}
}
@Override
@Override
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
cityfurniture
.
CityFurniture
gmlCityFurniture
)
{
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
cityfurniture
.
CityFurniture
gmlCityFurniture
)
{
CityFurniture
cf
=
new
CityFurniture
();
CityFurniture
cdCityFurniture
=
new
CityFurniture
();
cf
.
setGmlObject
(
gmlCityFurniture
);
cdCityFurniture
.
setGmlObject
(
gmlCityFurniture
);
mapAbstractOccupiedSpace
(
gmlCityFurniture
,
cf
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
gmlCityFurniture
,
cdCityFurniture
,
Orientation
.
OUTWARD
);
finishCityObjectConstruction
(
cf
);
mapBoundedSpace
(
gmlCityFurniture
,
cdCityFurniture
);
model
.
addCityFurniture
(
cf
);
var
dProp
=
gmlCityFurniture
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod1Geometry
(),
Lod
.
LOD1
,
cdCityFurniture
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdCityFurniture
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdCityFurniture
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdCityFurniture
,
Orientation
.
OUTWARD
);
finishFeatureConstruction
(
cdCityFurniture
);
model
.
addCityFurniture
(
cdCityFurniture
);
}
}
@Override
@Override
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
generics
.
GenericOccupiedSpace
gos
)
{
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
generics
.
GenericOccupiedSpace
gmlGenericOccupiedSpace
)
{
GenericCityObject
gco
=
new
GenericCityObject
();
GenericCityObject
cdGenericOccupiedSpace
=
new
GenericCityObject
();
gco
.
setGmlObject
(
gos
);
cdGenericOccupiedSpace
.
setGmlObject
(
gmlGenericOccupiedSpace
);
GeometryProperty
<?>
agLod1
=
gos
.
getDeprecatedProperties
().
getLod1Geometry
();
GeometryProperty
<?>
agLod4
=
gos
.
getDeprecatedProperties
().
getLod4Geometry
();
mapAbstractOccupiedSpace
(
gmlGenericOccupiedSpace
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
if
(
agLod1
!=
null
&&
agLod1
.
getObject
()
!=
null
&&
agLod1
.
getObject
()
instanceof
MultiSurface
ms
)
{
mapBoundedSpace
(
gmlGenericOccupiedSpace
,
cdGenericOccupiedSpace
);
gco
.
addGeometry
(
parseMultiSurface
(
ms
,
Lod
.
LOD1
));
}
var
dProp
=
gmlGenericOccupiedSpace
.
getDeprecatedProperties
();
if
(
agLod4
!=
null
&&
agLod4
.
getObject
()
!=
null
)
{
parseAndAddAbstractGeometry
(
dProp
.
getLod0Geometry
(),
Lod
.
LOD0
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
if
(
agLod4
.
getObject
()
instanceof
MultiSurface
ms
)
{
parseAndAddAbstractGeometry
(
dProp
.
getLod1Geometry
(),
Lod
.
LOD1
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
gco
.
addGeometry
(
parseMultiSurface
(
ms
,
Lod
.
LOD4
));
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
}
else
if
(
agLod4
.
getObject
()
instanceof
AbstractSolid
solid
)
{
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
gco
.
addGeometry
(
parseSolid
(
solid
,
Lod
.
LOD4
,
Orientation
.
OUTWARD
));
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdGenericOccupiedSpace
,
Orientation
.
OUTWARD
);
}
}
finishFeatureConstruction
(
cdGenericOccupiedSpace
);
mapAbstractOccupiedSpace
(
gos
,
gco
,
Orientation
.
OUTWARD
);
model
.
addOtherCityObject
(
cdGenericOccupiedSpace
);
finishCityObjectConstruction
(
gco
);
model
.
addOtherCityObject
(
gco
);
}
}
@Override
@Override
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
building
.
Building
gmlBuilding
)
{
public
void
visit
(
org
.
citygml4j
.
core
.
model
.
building
.
Building
gmlBuilding
)
{
Building
cdBuilding
=
new
Building
();
Building
cdBuilding
=
new
Building
();
read
AbstractBuilding
(
gmlBuilding
,
cdBuilding
);
map
AbstractBuilding
(
gmlBuilding
,
cdBuilding
);
for
(
BuildingPartProperty
bpProp
:
gmlBuilding
.
getBuildingParts
())
{
for
(
BuildingPartProperty
bpProp
:
gmlBuilding
.
getBuildingParts
())
{
if
(!
bpProp
.
isSetObject
())
{
if
(!
bpProp
.
isSetObject
())
{
continue
;
continue
;
}
}
BuildingPart
part
=
new
BuildingPart
(
cdBuilding
);
BuildingPart
part
=
new
BuildingPart
(
cdBuilding
);
readAbstractBuilding
(
bpProp
.
getObject
(),
part
);
mapAbstractBuilding
(
bpProp
.
getObject
(),
part
);
cdBuilding
.
addBuildingPart
(
part
);
}
}
finish
CityObject
Construction
(
cdBuilding
);
finish
Feature
Construction
(
cdBuilding
);
model
.
addBuilding
(
cdBuilding
);
model
.
addBuilding
(
cdBuilding
);
}
}
@Override
@Override
public
void
visit
(
WaterBody
waterBody
)
{
public
void
visit
(
WaterBody
waterBody
)
{
WaterObject
wo
=
new
WaterObject
();
WaterObject
cdWaterObject
=
new
WaterObject
();
wo
.
setGmlObject
(
waterBody
);
cdWaterObject
.
setGmlObject
(
waterBody
);
mapAbstractOccupiedSpace
(
waterBody
,
wo
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
waterBody
,
cdWaterObject
,
Orientation
.
OUTWARD
);
parseAndAddMultiSurface
(
waterBody
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
wo
);
mapBoundedSpace
(
waterBody
,
cdWaterObject
);
parseAndAddSolid
(
waterBody
.
getDeprecatedProperties
().
getLod4Solid
(),
Lod
.
LOD4
,
wo
,
Orientation
.
OUTWARD
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
var
dProp
=
waterBody
.
getDeprecatedProperties
();
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
waterBody
.
getBoundaries
())
{
parseAndAddMultiSurface
(
dProp
.
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdWaterObject
);
if
(!
surfaceProp
.
isSetObject
())
{
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdWaterObject
,
Orientation
.
OUTWARD
);
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
wo
.
addBoundarySurface
(
bs
);
}
finishCityObjectConstruction
(
wo
);
finishFeatureConstruction
(
cdWaterObject
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
model
.
addWater
(
cdWaterObject
);
updateEdgesAndVertices
(
bs
);
}
model
.
addWater
(
wo
);
}
}
@Override
@Override
public
void
visit
(
LandUse
l
andUse
)
{
public
void
visit
(
LandUse
gmlL
andUse
)
{
LandObject
lo
=
new
LandObject
(
l
andUse
);
LandObject
cdLandObject
=
new
LandObject
(
gmlL
andUse
);
mapAbstractThematicSurface
(
l
andUse
,
lo
);
mapAbstractThematicSurface
(
gmlL
andUse
,
cdLandObject
);
finish
CityObject
Construction
(
lo
);
finish
Feature
Construction
(
cdLandObject
);
model
.
addLand
(
lo
);
model
.
addLand
(
cdLandObject
);
}
}
public
void
visit
(
ReliefFeature
relief
)
{
@Override
ReliefObject
ro
=
new
ReliefObject
(
relief
);
public
void
visit
(
ReliefFeature
gmlRelief
)
{
mapAbstractSpaceBoundary
(
relief
,
ro
);
ReliefObject
cdRelief
=
new
ReliefObject
(
gmlRelief
);
mapReliefFeature
(
relief
,
ro
);
mapAbstractSpaceBoundary
(
gmlRelief
,
cdRelief
);
finishCityObjectConstruction
(
ro
);
mapReliefFeature
(
gmlRelief
,
cdRelief
);
model
.
addRelief
(
ro
);
finishFeatureConstruction
(
cdRelief
);
model
.
addRelief
(
cdRelief
);
}
}
public
void
mapReliefFeature
(
ReliefFeature
relief
,
ReliefObject
reliefObject
)
{
public
void
mapReliefFeature
(
ReliefFeature
relief
,
ReliefObject
reliefObject
)
{
...
@@ -423,10 +417,11 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -423,10 +417,11 @@ public class Citygml3FeatureMapper extends ObjectWalker {
veg
.
setGmlObject
(
plantCover
);
veg
.
setGmlObject
(
plantCover
);
mapAbstractVegetationObject
(
plantCover
,
veg
);
mapAbstractVegetationObject
(
plantCover
,
veg
);
parseAndAddMultiSurface
(
plantCover
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
veg
);
var
dProp
=
plantCover
.
getDeprecatedProperties
();
parseAndAddMultiSurface
(
plantCover
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
veg
);
parseAndAddMultiSurface
(
dProp
.
getLod1MultiSurface
(),
Lod
.
LOD1
,
veg
);
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
veg
);
finish
CityObject
Construction
(
veg
);
finish
Feature
Construction
(
veg
);
model
.
addVegetation
(
veg
);
model
.
addVegetation
(
veg
);
}
}
...
@@ -436,21 +431,19 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -436,21 +431,19 @@ public class Citygml3FeatureMapper extends ObjectWalker {
veg
.
setGmlObject
(
solitaryVegetationObject
);
veg
.
setGmlObject
(
solitaryVegetationObject
);
mapAbstractVegetationObject
(
solitaryVegetationObject
,
veg
);
mapAbstractVegetationObject
(
solitaryVegetationObject
,
veg
);
parseAndAddAbstractGeometry
(
solitaryVegetationObject
.
getDeprecatedProperties
().
getLod1Geometry
(),
Lod
.
LOD1
,
var
dProp
=
solitaryVegetationObject
.
getDeprecatedProperties
();
veg
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod1Geometry
(),
Lod
.
LOD1
,
veg
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
solitaryVegetationObject
.
getDeprecatedProperties
().
getLod2Geometry
(),
Lod
.
LOD2
,
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
veg
,
Orientation
.
OUTWARD
);
veg
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
veg
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
solitaryVegetationObject
.
getDeprecatedProperties
().
getLod3Geometry
(),
Lod
.
LOD3
,
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
veg
,
Orientation
.
OUTWARD
);
veg
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
solitaryVegetationObject
.
getDeprecatedProperties
().
getLod4Geometry
(),
Lod
.
LOD4
,
veg
,
Orientation
.
OUTWARD
);
finish
CityObject
Construction
(
veg
);
finish
Feature
Construction
(
veg
);
model
.
addVegetation
(
veg
);
model
.
addVegetation
(
veg
);
}
}
private
void
mapAbstractVegetationObject
(
AbstractVegetationObject
avo
,
Vegetation
veg
)
{
private
void
mapAbstractVegetationObject
(
AbstractVegetationObject
avo
,
Vegetation
veg
)
{
mapAbstractOccupiedSpace
(
avo
,
veg
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
avo
,
veg
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
avo
,
veg
);
}
}
private
void
mapAbstractOccupiedSpace
(
AbstractOccupiedSpace
aos
,
CityObject
co
,
Orientation
orientation
)
{
private
void
mapAbstractOccupiedSpace
(
AbstractOccupiedSpace
aos
,
CityObject
co
,
Orientation
orientation
)
{
...
@@ -482,404 +475,314 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -482,404 +475,314 @@ public class Citygml3FeatureMapper extends ObjectWalker {
@Override
@Override
public
void
visit
(
Bridge
bridge
)
{
public
void
visit
(
Bridge
bridge
)
{
BridgeObject
bo
=
new
BridgeObject
(
bridge
);
BridgeObject
bo
=
new
BridgeObject
(
bridge
);
// parse deprecated geometries
parseAndAddMultiSurface
(
bridge
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
bo
);
parseAndAddMultiSurface
(
bridge
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
bo
);
parseAndAddSolid
(
bridge
.
getDeprecatedProperties
().
getLod4Solid
(),
Lod
.
LOD4
,
bo
,
Orientation
.
OUTWARD
);
mapAbstractBridge
(
bridge
,
bo
);
mapAbstractBridge
(
bridge
,
bo
);
for
(
BridgePartProperty
bPartProperty
:
bridge
.
getBridgeParts
())
{
for
(
BridgePartProperty
bPartProperty
:
bridge
.
getBridgeParts
())
{
if
(!
bPartProperty
.
isSetObject
())
{
var
gmlPart
=
bPartProperty
.
getObject
();
if
(
gmlPart
==
null
)
{
continue
;
continue
;
}
}
BridgePart
gmlBridgePart
=
bPartProperty
.
getObject
();
BridgeObjectPart
bPart
=
new
BridgeObjectPart
(
gmlPart
);
BridgeObject
bPart
=
new
BridgeObject
(
gmlBridgePart
,
bo
);
mapAbstractBridge
(
gmlPart
,
bPart
);
mapAbstractBridge
(
gmlBridgePart
,
bPart
);
bo
.
addBridgePart
(
bPart
);
bo
.
addBridgePart
(
bPart
);
}
}
finishCityObjectConstruction
(
bo
);
finishFeatureConstruction
(
bo
);
for
(
BridgeObject
part
:
bo
.
getParts
())
{
updateEdgesAndVertices
(
part
);
}
for
(
BridgeConstructiveElement
ele
:
bo
.
getConstructiveElements
())
{
updateEdgesAndVertices
(
ele
);
for
(
BoundarySurface
bs
:
ele
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
}
}
for
(
Installation
bi
:
bo
.
getBridgeInstallations
())
{
updateEdgesAndVertices
(
bi
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
}
}
model
.
addBridge
(
bo
);
model
.
addBridge
(
bo
);
}
}
private
void
mapAbstractBridge
(
AbstractBridge
ab
,
BridgeObject
bo
)
{
private
void
mapAbstractBridge
(
AbstractBridge
gmlBridge
,
AbstractBridgeObject
cdBridge
)
{
mapAbstractConstruction
(
ab
,
bo
);
mapAbstractOccupiedSpace
(
gmlBridge
,
cdBridge
,
Orientation
.
OUTWARD
);
for
(
BridgeConstructiveElementProperty
eleProp
:
ab
.
getBridgeConstructiveElements
())
{
mapBoundedSpace
(
gmlBridge
,
cdBridge
);
if
(!
eleProp
.
isSetObject
())
{
var
dProp
=
gmlBridge
.
getDeprecatedProperties
();
parseAndAddMultiSurface
(
dProp
.
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBridge
);
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBridge
);
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdBridge
,
Orientation
.
OUTWARD
);
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeConstructiveElement
>
elements
=
readBridgeConstructiveElementProperties
(
gmlBridge
.
getBridgeConstructiveElements
());
elements
.
forEach
(
cdBridge:
:
addConstructiveElement
);
List
<
BridgeRoomFurniture
>
furniture
=
readBridgeFurnitureProperties
(
gmlBridge
.
getBridgeFurniture
());
furniture
.
forEach
(
cdBridge:
:
addFurniture
);
List
<
Installation
>
installations
=
readBridgeInstallationProperties
(
gmlBridge
.
getBridgeInstallations
());
installations
.
forEach
(
cdBridge:
:
addInstallation
);
List
<
BridgeRoom
>
rooms
=
readBridgeRoomProperties
(
gmlBridge
.
getBridgeRooms
());
rooms
.
forEach
(
cdBridge:
:
addRoom
);
}
private
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeConstructiveElement
>
readBridgeConstructiveElementProperties
(
List
<
BridgeConstructiveElementProperty
>
properties
){
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeConstructiveElement
>
elements
=
new
ArrayList
<>();
for
(
BridgeConstructiveElementProperty
eleProp
:
properties
)
{
var
gmlBce
=
eleProp
.
getObject
();
if
(
gmlBce
==
null
)
{
continue
;
continue
;
}
}
org
.
citygml4j
.
core
.
model
.
bridge
.
BridgeConstructiveElement
constructiveElement
=
eleProp
.
getObject
();
BridgeConstructiveElement
cdEle
=
parseBridgeConstructiveElement
(
gmlBce
);
BridgeConstructiveElement
cdEle
=
new
BridgeConstructiveElement
(
constructiveElement
);
elements
.
add
(
cdEle
);
mapConstructiveElement
(
constructiveElement
,
cdEle
);
bo
.
addConstructiveElement
(
cdEle
);
}
}
return
elements
;
}
List
<
Bridge
Installation
Property
>
b
ridgeInstallation
s
=
ab
.
get
BridgeInstallation
s
();
private
List
<
Installation
>
readB
ridgeInstallation
Properties
(
List
<
BridgeInstallation
Property
>
properties
){
for
(
Bridge
Installation
Property
installation
Prop
:
bridgeInstallations
)
{
List
<
Installation
>
installation
s
=
new
ArrayList
<>();
var
gmlBi
=
installationProp
.
getObject
();
for
(
BridgeInstallationProperty
installationProp
:
properties
)
{
if
(
gmlBi
==
null
)
{
var
gmlBce
=
installationProp
.
getObject
();
// ignore empty properties
if
(
gmlBce
==
null
)
{
continue
;
continue
;
}
}
Installation
bi
=
map
BridgeInstallation
(
gmlB
i
);
Installation
inst
=
parse
BridgeInstallation
(
gmlB
ce
);
bo
.
addBridgeI
nstallation
(
bi
);
i
nstallation
s
.
add
(
inst
);
}
}
return
installations
;
}
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
private
List
<
BridgeRoom
>
readBridgeRoomProperties
(
List
<
BridgeRoomProperty
>
properties
){
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
ab
.
getBoundaries
())
{
List
<
BridgeRoom
>
rooms
=
new
ArrayList
<>();
if
(!
surfaceProp
.
isSetObject
())
{
for
(
BridgeRoomProperty
roomProp
:
properties
)
{
var
gmlRoom
=
roomProp
.
getObject
();
if
(
gmlRoom
==
null
)
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
BridgeRoom
room
=
parseBridgeRoom
(
gmlRoom
);
surface
.
accept
(
surfaceMapper
);
rooms
.
add
(
room
);
}
updatePartOfSurface
(
bo
,
surfaceMapper
);
for
(
BoundarySurface
bs
:
bo
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
}
}
return
rooms
;
}
}
private
Installation
mapBridgeInstallation
(
BridgeInstallation
gmlBi
)
{
private
List
<
BridgeRoomFurniture
>
readBridgeFurnitureProperties
(
List
<
BridgeFurnitureProperty
>
properties
){
Installation
bi
=
new
Installation
();
List
<
BridgeRoomFurniture
>
rooms
=
new
ArrayList
<>();
bi
.
setGmlObject
(
gmlBi
);
for
(
BridgeFurnitureProperty
furnProp
:
properties
)
{
mapAbstractOccupiedSpace
(
gmlBi
,
bi
,
Orientation
.
OUTWARD
);
var
gmlFurn
=
furnProp
.
getObject
();
GeometryProperty
<?>
lod2Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
();
if
(
gmlFurn
==
null
)
{
parseAndAddAbstractGeometry
(
lod2Prop
,
Lod
.
LOD2
,
bi
,
Orientation
.
OUTWARD
);
GeometryProperty
<?>
lod3Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod3Geometry
();
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
,
Orientation
.
OUTWARD
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
,
Orientation
.
OUTWARD
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
BridgeRoomFurniture
furn
=
parseBridgeFurniture
(
gmlFurn
);
surface
.
accept
(
surfaceMapper
);
rooms
.
add
(
furn
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bi
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
p
.
setPartOfInstallation
(
bi
);
}
}
}
for
(
Geometry
geom
:
bi
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
bi
);
}
}
}
return
rooms
;
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeConstructiveElement
parseBridgeConstructiveElement
(
org
.
citygml4j
.
core
.
model
.
bridge
.
BridgeConstructiveElement
gmlBridgeCE
){
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeConstructiveElement
cdBuildingCE
=
new
BridgeConstructiveElement
(
gmlBridgeCE
);
mapAbstractConstructiveElement
(
gmlBridgeCE
,
cdBuildingCE
);
var
dProp
=
gmlBridgeCE
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod1Geometry
(),
Lod
.
LOD1
,
cdBuildingCE
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdBuildingCE
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdBuildingCE
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdBuildingCE
,
Orientation
.
OUTWARD
);
return
bi
;
return
cdBuildingCE
;
}
private
Installation
parseBridgeInstallation
(
BridgeInstallation
gmlBridgeInst
)
{
Installation
cdBridgeInst
=
new
Installation
();
cdBridgeInst
.
setGmlObject
(
gmlBridgeInst
);
mapAbstractInstallation
(
gmlBridgeInst
,
cdBridgeInst
);
var
dProp
=
gmlBridgeInst
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdBridgeInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdBridgeInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdBridgeInst
,
Orientation
.
OUTWARD
);
return
cdBridgeInst
;
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeRoom
parseBridgeRoom
(
org
.
citygml4j
.
core
.
model
.
bridge
.
BridgeRoom
gmlBridgeRoom
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BridgeRoom
cdRoom
=
new
BridgeRoom
();
cdRoom
.
setGmlObject
(
gmlBridgeRoom
);
mapAbstractUnoccupiedSpace
(
gmlBridgeRoom
,
cdRoom
,
Orientation
.
INWARD
);
mapBoundedSpace
(
gmlBridgeRoom
,
cdRoom
);
var
dProp
=
gmlBridgeRoom
.
getDeprecatedProperties
();
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdRoom
);
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdRoom
,
Orientation
.
INWARD
);
List
<
BridgeRoomFurniture
>
furniture
=
readBridgeFurnitureProperties
(
gmlBridgeRoom
.
getBridgeFurniture
());
furniture
.
forEach
(
cdRoom:
:
addFurniture
);
List
<
Installation
>
installations
=
readBridgeInstallationProperties
(
gmlBridgeRoom
.
getBridgeInstallations
());
installations
.
forEach
(
cdRoom:
:
addInstallation
);
return
cdRoom
;
}
private
BridgeRoomFurniture
parseBridgeFurniture
(
BridgeFurniture
bridgeFurn
)
{
BridgeRoomFurniture
cdFurn
=
new
BridgeRoomFurniture
();
mapAbstractFurniture
(
bridgeFurn
,
cdFurn
);
var
dProp
=
bridgeFurn
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdFurn
,
Orientation
.
OUTWARD
);
return
cdFurn
;
}
}
@Override
@Override
public
void
visit
(
Tunnel
tunnel
)
{
public
void
visit
(
Tunnel
tunnel
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Tunnel
tu
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Tunnel
();
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Tunnel
cdTunnel
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Tunnel
();
mapAbstractTunnel
(
tunnel
,
cdTunnel
);
for
(
TunnelPartProperty
tPartProperty
:
tunnel
.
getTunnelParts
())
{
for
(
TunnelPartProperty
tPartProperty
:
tunnel
.
getTunnelParts
())
{
if
(!
tPartProperty
.
isSetObject
())
{
var
gmlTunnelpart
=
tPartProperty
.
getObject
();
if
(
gmlTunnelpart
==
null
)
{
continue
;
continue
;
}
}
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelPart
gml
TunnelPart
=
tPartProperty
.
getObjec
t
();
TunnelPart
cd
TunnelPart
=
new
TunnelPar
t
();
TunnelPart
tPar
t
=
new
TunnelPart
(
tu
);
cd
TunnelPart
.
se
tPar
ent
(
cdTunnel
);
read
AbstractTunnel
(
gmlTunnel
P
art
,
t
Part
);
map
AbstractTunnel
(
gmlTunnel
p
art
,
cdTunnel
Part
);
tu
.
addTunnelPart
(
t
Part
);
cdTunnel
.
addTunnelPart
(
cdTunnel
Part
);
}
}
readAbstractTunnel
(
tunnel
,
tu
);
finishCityObjectConstruction
(
tu
);
finishFeatureConstruction
(
cdTunnel
);
for
(
TunnelPart
part
:
tu
.
getTunnelParts
())
{
model
.
addTunnel
(
cdTunnel
);
updateEdgesAndVertices
(
part
);
}
model
.
addTunnel
(
tu
);
}
}
private
void
readAbstractTunnel
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
private
void
mapAbstractTunnel
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
mapAbstractOccupiedSpace
(
gmlTunnel
,
cdTunnel
,
Orientation
.
OUTWARD
);
cdTunnel
.
setGmlObject
(
gmlTunnel
);
cdTunnel
.
setGmlObject
(
gmlTunnel
);
mapAbstractOccupiedSpace
(
gmlTunnel
,
cdTunnel
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
gmlTunnel
,
cdTunnel
);
// parse deprecated geometries
// parse deprecated geometries
parseAndAddMultiSurface
(
gmlTunnel
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdTunnel
);
var
dProp
=
gmlTunnel
.
getDeprecatedProperties
();
parseAndAddMultiSurface
(
gmlTunnel
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdTunnel
);
parseAndAddMultiSurface
(
dProp
.
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdTunnel
);
parseAndAddSolid
(
gmlTunnel
.
getDeprecatedProperties
().
getLod4Solid
(),
Lod
.
LOD4
,
cdTunnel
,
Orientation
.
OUTWARD
);
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdTunnel
);
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdTunnel
,
Orientation
.
OUTWARD
);
parseTunnelInstallations
(
gmlTunnel
,
cdTunnel
);
parseHollowSpaces
(
gmlTunnel
,
cdTunnel
);
parseTunnelFurniture
(
gmlTunnel
,
cdTunnel
);
parseTunnelConstructiveElements
(
gmlTunnel
,
cdTunnel
);
parseTunnelBoundarySurfaces
(
gmlTunnel
);
for
(
Installation
ti
:
cdTunnel
.
getTunnelInstallations
())
{
updateEdgesAndVertices
(
ti
);
for
(
BoundarySurface
bs
:
ti
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
updateEdgesAndVertices
(
o
);
}
}
}
}
private
void
parseTunnelBoundarySurfaces
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
)
{
List
<
Installation
>
installations
=
readTunnelInstallationProperties
(
gmlTunnel
.
getTunnelInstallations
());
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
installations
.
forEach
(
cdTunnel:
:
addInstallation
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTunnel
.
getBoundaries
())
{
List
<
TunnelHollow
>
hollows
=
readTunnelHollowSpaceProperties
(
gmlTunnel
.
getHollowSpaces
());
if
(!
surfaceProp
.
isSetObject
())
{
hollows
.
forEach
(
cdTunnel:
:
addRoom
);
continue
;
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
TunnelConstructiveElement
>
elements
=
readTunnelConstructiveElementProperties
(
gmlTunnel
.
getTunnelConstructiveElements
());
}
elements
.
forEach
(
cdTunnel:
:
addConstructiveElement
);
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
List
<
TunnelFurniture
>
furniture
=
readTunnelFurnitureProperties
(
gmlTunnel
.
getTunnelFurniture
());
surface
.
accept
(
surfaceMapper
);
furniture
.
forEach
(
cdTunnel:
:
addFurniture
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
updateEdgesAndVertices
(
o
);
}
}
}
}
private
void
parseTunnelConstructiveElements
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
for
(
TunnelConstructiveElementProperty
teProp
:
gmlTunnel
.
getTunnelConstructiveElements
())
{
private
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
TunnelConstructiveElement
>
readTunnelConstructiveElementProperties
(
List
<
TunnelConstructiveElementProperty
>
properties
)
{
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
TunnelConstructiveElement
>
elements
=
new
ArrayList
<>();
for
(
TunnelConstructiveElementProperty
teProp
:
properties
)
{
var
gmlTc
=
teProp
.
getObject
();
var
gmlTc
=
teProp
.
getObject
();
if
(
gmlTc
==
null
)
{
if
(
gmlTc
==
null
)
{
continue
;
continue
;
}
}
TunnelConstructiveElement
tc
=
map
TunnelConstructiveElement
(
gmlTc
);
TunnelConstructiveElement
tc
=
parse
TunnelConstructiveElement
(
gmlTc
);
cdTunnel
.
addTunnelConstructiveElement
(
tc
);
elements
.
add
(
tc
);
}
}
return
elements
;
}
}
private
void
parseTunnelFurniture
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
private
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
TunnelFurniture
>
readTunnelFurnitureProperties
(
List
<
TunnelFurnitureProperty
>
properties
)
{
for
(
TunnelFurnitureProperty
tfProp
:
gmlTunnel
.
getTunnelFurniture
())
{
List
<
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
TunnelFurniture
>
furniture
=
new
ArrayList
<>();
for
(
TunnelFurnitureProperty
tfProp
:
properties
)
{
var
gmlTf
=
tfProp
.
getObject
();
var
gmlTf
=
tfProp
.
getObject
();
if
(
gmlTf
==
null
)
{
if
(
gmlTf
==
null
)
{
continue
;
continue
;
}
}
TunnelFurniture
tf
=
map
TunnelFurniture
(
gmlTf
);
TunnelFurniture
tf
=
parse
TunnelFurniture
(
gmlTf
);
cdTunnel
.
addTunnelF
urniture
(
tf
);
f
urniture
.
add
(
tf
);
}
}
return
furniture
;
}
}
private
void
parseHollowSpaces
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
private
List
<
TunnelHollow
>
readTunnelHollowSpaceProperties
(
List
<
HollowSpaceProperty
>
properties
)
{
for
(
HollowSpaceProperty
thProp
:
gmlTunnel
.
getHollowSpaces
())
{
List
<
TunnelHollow
>
hollows
=
new
ArrayList
<>();
for
(
HollowSpaceProperty
thProp
:
properties
)
{
var
gmlTh
=
thProp
.
getObject
();
var
gmlTh
=
thProp
.
getObject
();
if
(
gmlTh
==
null
)
{
if
(
gmlTh
==
null
)
{
continue
;
continue
;
}
}
TunnelHollow
br
=
map
TunnelHollow
(
gmlTh
);
TunnelHollow
br
=
parse
TunnelHollow
(
gmlTh
);
cdTunnel
.
addTunnelHollow
(
br
);
hollows
.
add
(
br
);
}
}
return
hollows
;
}
}
private
void
parseTunnelInstallations
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
,
AbstractTunnel
cdTunnel
)
{
private
List
<
Installation
>
readTunnelInstallationProperties
(
List
<
TunnelInstallationProperty
>
properties
)
{
for
(
TunnelInstallationProperty
tiProp
:
gmlTunnel
.
getTunnelInstallations
())
{
List
<
Installation
>
installations
=
new
ArrayList
<>();
for
(
TunnelInstallationProperty
tiProp
:
properties
)
{
var
gmlTi
=
tiProp
.
getObject
();
var
gmlTi
=
tiProp
.
getObject
();
if
(
gmlTi
==
null
)
{
if
(
gmlTi
==
null
)
{
// ignore empty properties
// ignore empty properties
continue
;
continue
;
}
}
Installation
ti
=
map
TunnelInstallation
(
gmlTi
,
Orientation
.
OUTWARD
);
Installation
ti
=
parse
TunnelInstallation
(
gmlTi
);
cdTunnel
.
addTunnelI
nstallation
(
ti
);
i
nstallation
s
.
add
(
ti
);
}
}
return
installations
;
}
}
private
Installation
mapTunnelInstallation
(
TunnelInstallation
gmlTi
,
Orientation
orientation
)
{
private
Installation
parseTunnelInstallation
(
TunnelInstallation
gmlTunnelInst
)
{
Installation
ti
=
new
Installation
();
Installation
cdTunnelInst
=
new
Installation
();
ti
.
setGmlObject
(
gmlTi
);
cdTunnelInst
.
setGmlObject
(
gmlTunnelInst
);
mapAbstractOccupiedSpace
(
gmlTi
,
ti
,
Orientation
.
OUTWARD
);
mapAbstractInstallation
(
gmlTunnelInst
,
cdTunnelInst
);
GeometryProperty
<?>
lod2Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod2Geometry
();
parseAndAddAbstractGeometry
(
lod2Prop
,
Lod
.
LOD2
,
ti
,
orientation
);
GeometryProperty
<?>
lod3Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod3Geometry
();
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
ti
,
orientation
);
GeometryProperty
<?>
lod4Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
ti
,
orientation
);
var
dProp
=
gmlTunnelInst
.
getDeprecatedProperties
();
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdTunnelInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdTunnelInst
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdTunnelInst
,
Orientation
.
OUTWARD
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
return
cdTunnelInst
;
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTi
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
ti
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
p
.
setPartOfInstallation
(
ti
);
}
}
}
for
(
Geometry
geom
:
ti
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
ti
);
}
}
return
ti
;
}
}
private
TunnelHollow
mapTunnelHollow
(
HollowSpace
gmlHo
)
{
private
TunnelHollow
parseTunnelHollow
(
HollowSpace
gmlHollow
)
{
TunnelHollow
tHollow
=
new
TunnelHollow
();
TunnelHollow
cdHollow
=
new
TunnelHollow
();
tHollow
.
setGmlObject
(
gmlHo
);
cdHollow
.
setGmlObject
(
gmlHollow
);
mapAbstractUnoccupiedSpace
(
gmlHo
,
tHollow
,
Orientation
.
INWARD
);
mapAbstractUnoccupiedSpace
(
gmlHollow
,
cdHollow
,
Orientation
.
INWARD
);
mapBoundedSpace
(
gmlHollow
,
cdHollow
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
var
dProp
=
gmlHollow
.
getDeprecatedProperties
();
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlHo
.
getBoundaries
())
{
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdHollow
);
if
(!
surfaceProp
.
isSetObject
())
{
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdHollow
,
Orientation
.
OUTWARD
);
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
tHollow
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
for
(
TunnelInstallationProperty
tiProp
:
gmlHo
.
getTunnelInstallations
())
{
var
gmlTi
=
tiProp
.
getObject
();
if
(
gmlTi
==
null
)
{
// ignore empty properties
continue
;
}
Installation
bi
=
mapTunnelInstallation
(
gmlTi
,
Orientation
.
INWARD
);
tHollow
.
addRoomInstallation
(
bi
);
}
for
(
TunnelFurnitureProperty
tfProp
:
gmlHo
.
getTunnelFurniture
())
{
var
gmlHref
=
tfProp
.
getHref
();
if
(
gmlHref
==
null
)
{
continue
;
}
tHollow
.
addFurnitureRef
(
tfProp
);
}
return
tHollow
;
}
private
TunnelFurniture
mapTunnelFurniture
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelFurniture
gmlTf
)
{
List
<
Installation
>
installations
=
readTunnelInstallationProperties
(
gmlHollow
.
getTunnelInstallations
());
TunnelFurniture
tf
=
new
TunnelFurniture
(
);
installations
.
forEach
(
cdHollow:
:
addInstallation
);
tf
.
setGmlObject
(
gmlTf
);
List
<
TunnelFurniture
>
furniture
=
readTunnelFurnitureProperties
(
gmlHollow
.
getTunnelFurniture
()
);
mapAbstractOccupiedSpace
(
gmlTf
,
tf
,
Orientation
.
OUTWARD
);
furniture
.
forEach
(
cdHollow:
:
addFurniture
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
return
cdHollow
;
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTf
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
tf
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
return
tf
;
}
}
private
TunnelConstructiveElement
mapTunnelConstructiveElement
(
private
TunnelFurniture
parseTunnelFurniture
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelFurniture
tunnelFurn
)
{
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelConstructiveElement
gmlTe
)
{
TunnelFurniture
cdTunnelFurn
=
new
TunnelFurniture
();
TunnelConstructiveElement
te
=
new
TunnelConstructiveElement
(
gmlTe
);
cdTunnelFurn
.
setGmlObject
(
tunnelFurn
);
mapAbstractOccupiedSpace
(
gmlTe
,
te
,
Orientation
.
OUTWARD
);
mapAbstractFurniture
(
tunnelFurn
,
cdTunnelFurn
);
List
<
BoundarySurface
>
boundarySurfaces
=
mapConstructiveElementSurfaces
(
gmlTe
);
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
te
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
return
te
;
}
private
List
<
BoundarySurface
>
mapConstructiveElementSurfaces
(
AbstractConstructiveElement
ace
)
{
var
dProp
=
tunnelFurn
.
getDeprecatedProperties
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdTunnelFurn
,
Orientation
.
OUTWARD
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
ace
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
AbstractFillingElementProperty
fillProp
:
ace
.
getFillings
())
{
if
(!
fillProp
.
isSetObject
())
{
continue
;
}
AbstractFillingElement
filling
=
fillProp
.
getObject
();
filling
.
accept
(
surfaceMapper
);
}
return
surfaceMapper
.
getSurfaces
();
}
private
void
updatePartOfSurface
(
BridgeObject
bo
,
SurfaceMapper
surfaceMapper
)
{
return
cdTunnelFurn
;
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bo
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
}
}
private
void
mapConstructiveElement
(
org
.
citygml4j
.
core
.
model
.
bridge
.
BridgeConstructiveElement
ele
,
private
TunnelConstructiveElement
parseTunnelConstructiveElement
(
BridgeConstructiveElement
bce
)
{
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelConstructiveElement
gmlTunnelCE
)
{
mapAbstractConstructiveElement
(
ele
,
bce
);
TunnelConstructiveElement
cdTunnelCE
=
new
TunnelConstructiveElement
(
gmlTunnelCE
);
mapAbstractConstructiveElement
(
gmlTunnelCE
,
cdTunnelCE
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
return
cdTunnelCE
;
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
ele
.
getBoundaries
())
{
}
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
private
List
<
AbstractConstructiveFillingElement
>
readAbstractFillingElements
(
List
<
AbstractFillingElementProperty
>
properties
){
}
List
<
AbstractConstructiveFillingElement
>
fillings
=
new
ArrayList
<>();
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
for
(
AbstractFillingElementProperty
fillProp
:
properties
)
{
surface
.
accept
(
surfaceMapper
);
var
gmlFi
=
fillProp
.
getObject
();
}
if
(
gmlFi
==
null
)
{
for
(
AbstractFillingElementProperty
fillProp
:
ele
.
getFillings
())
{
if
(!
fillProp
.
isSetObject
())
{
continue
;
continue
;
}
}
AbstractFillingElement
filling
=
fillProp
.
getObject
();
AbstractConstructiveFillingElement
filling
=
parseAbstractFillingElement
(
gmlFi
);
bce
.
addFilling
(
mapAbstractFillingElement
(
filling
));
fillings
.
add
(
filling
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bce
.
addBoundarySurface
(
bs
);
}
}
return
fillings
;
}
}
private
AbstractConstructiveFillingElement
map
AbstractFillingElement
(
AbstractFillingElement
ele
){
private
AbstractConstructiveFillingElement
parse
AbstractFillingElement
(
AbstractFillingElement
gmlFilling
){
AbstractConstructiveFillingElement
fill
;
AbstractConstructiveFillingElement
fill
;
if
(
ele
instanceof
Door
d
){
if
(
gmlFilling
instanceof
Door
d
){
fill
=
new
DoorObject
(
d
);
fill
=
new
DoorObject
(
d
);
}
else
if
(
ele
instanceof
Window
w
){
}
else
if
(
gmlFilling
instanceof
Window
w
){
fill
=
new
WindowObject
(
w
);
fill
=
new
WindowObject
(
w
);
}
else
{
}
else
{
fill
=
new
AbstractConstructiveFillingElement
(
ele
)
{
fill
=
new
AbstractConstructiveFillingElement
(
gmlFilling
)
{
@Override
@Override
public
String
getDisplayText
(){
public
String
getDisplayText
(){
return
String
.
format
(
"[Unknown filling element] %s"
,
this
.
getGmlId
().
toString
());
return
String
.
format
(
"[Unknown filling element] %s"
,
this
.
getGmlId
().
toString
());
...
@@ -891,17 +794,9 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -891,17 +794,9 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
};
};
}
}
mapAbstractOccupiedSpace
(
ele
,
fill
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
gmlFilling
,
fill
,
Orientation
.
OUTWARD
);
return
fill
;
}
private
void
mapAbstractConstructiveElement
(
org
.
citygml4j
.
core
.
model
.
bridge
.
BridgeConstructiveElement
ele
,
return
fill
;
BridgeConstructiveElement
bce
)
{
mapAbstractOccupiedSpace
(
ele
,
bce
,
Orientation
.
OUTWARD
);
}
private
void
mapAbstractConstruction
(
AbstractConstruction
ac
,
BridgeObject
bo
)
{
mapAbstractOccupiedSpace
(
ac
,
bo
,
Orientation
.
OUTWARD
);
}
}
@Override
@Override
...
@@ -909,7 +804,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -909,7 +804,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
track
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
track
);
mapSectionsAndIntersections
(
track
.
getSections
(),
track
.
getIntersections
(),
top
);
mapSectionsAndIntersections
(
track
.
getSections
(),
track
.
getIntersections
(),
top
);
mapAbstractTransportationSpace
(
track
,
top
);
mapAbstractTransportationSpace
(
track
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
@Override
@Override
...
@@ -917,7 +813,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -917,7 +813,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
road
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
road
);
mapSectionsAndIntersections
(
road
.
getSections
(),
road
.
getIntersections
(),
top
);
mapSectionsAndIntersections
(
road
.
getSections
(),
road
.
getIntersections
(),
top
);
mapAbstractTransportationSpace
(
road
,
top
);
mapAbstractTransportationSpace
(
road
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
@Override
@Override
...
@@ -925,7 +822,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -925,7 +822,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
waterway
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
waterway
);
mapSectionsAndIntersections
(
waterway
.
getSections
(),
waterway
.
getIntersections
(),
top
);
mapSectionsAndIntersections
(
waterway
.
getSections
(),
waterway
.
getIntersections
(),
top
);
mapAbstractTransportationSpace
(
waterway
,
top
);
mapAbstractTransportationSpace
(
waterway
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
@Override
@Override
...
@@ -933,21 +831,24 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -933,21 +831,24 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
railway
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
railway
);
mapSectionsAndIntersections
(
railway
.
getSections
(),
railway
.
getIntersections
(),
top
);
mapSectionsAndIntersections
(
railway
.
getSections
(),
railway
.
getIntersections
(),
top
);
mapAbstractTransportationSpace
(
railway
,
top
);
mapAbstractTransportationSpace
(
railway
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
@Override
@Override
public
void
visit
(
Square
square
)
{
public
void
visit
(
Square
square
)
{
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
square
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
square
);
mapAbstractTransportationSpace
(
square
,
top
);
mapAbstractTransportationSpace
(
square
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
@Override
@Override
public
void
visit
(
TransportationComplex
tc
)
{
public
void
visit
(
TransportationComplex
tc
)
{
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
tc
);
TopLevelTransportFeature
top
=
TopLevelTransportFeature
.
from
(
tc
);
mapAbstractTransportationSpace
(
tc
,
top
);
mapAbstractTransportationSpace
(
tc
,
top
);
finishTransportationMapping
(
top
);
finishFeatureConstruction
(
top
);
model
.
addTransportation
(
top
);
}
}
...
@@ -982,16 +883,27 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -982,16 +883,27 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
void
finishTransportationMapping
(
TransportationObject
to
)
{
private
void
finishTransportationMapping
(
TransportationObject
to
)
{
finish
CityObject
Construction
(
to
);
finish
Feature
Construction
(
to
);
model
.
addTransportation
(
to
);
model
.
addTransportation
(
to
);
}
}
private
void
finishFeatureConstruction
(
CityObject
co
)
{
resolveAndClearReferences
(
co
);
co
.
accept
(
new
CheckableUtilsVisitor
()
{
@Override
public
void
check
(
CityObject
co
)
{
finishCityObjectConstruction
(
co
);
}
});
co
.
setBbox
(
BoundingBox
.
of
(
co
));
}
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
parseId
(
co
.
getGmlObject
(),
co
);
co
.
clearGmlGeometries
();
co
.
clearGmlGeometries
();
resolveAndClearReferences
(
co
);
updateEdgesAndVertices
(
co
);
updateEdgesAndVertices
(
co
);
co
.
setBbox
(
BoundingBox
.
of
(
co
));
if
(
co
.
getGmlId
()
==
null
){
parseId
(
co
.
getGmlObject
(),
co
);
}
}
}
private
void
mapAbstractTransportationSpace
(
AbstractTransportationSpace
ats
,
TransportationSpace
trsp
)
{
private
void
mapAbstractTransportationSpace
(
AbstractTransportationSpace
ats
,
TransportationSpace
trsp
)
{
...
@@ -1019,7 +931,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1019,7 +931,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TransportSection
sect
=
new
TransportSection
(
TransportSection
.
SectionType
.
SECTION
);
TransportSection
sect
=
new
TransportSection
(
TransportSection
.
SectionType
.
SECTION
);
sect
.
setGmlObject
(
sectionProp
.
getObject
());
sect
.
setGmlObject
(
sectionProp
.
getObject
());
mapAbstractTransportationSpace
(
sectionProp
.
getObject
(),
sect
);
mapAbstractTransportationSpace
(
sectionProp
.
getObject
(),
sect
);
finish
CityObject
Construction
(
sect
);
finish
Feature
Construction
(
sect
);
top
.
addSection
(
sect
);
top
.
addSection
(
sect
);
}
}
}
}
...
@@ -1028,7 +940,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1028,7 +940,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TransportSection
isect
=
new
TransportSection
(
TransportSection
.
SectionType
.
INTERSECTION
);
TransportSection
isect
=
new
TransportSection
(
TransportSection
.
SectionType
.
INTERSECTION
);
isect
.
setGmlObject
(
intersectionProp
.
getObject
());
isect
.
setGmlObject
(
intersectionProp
.
getObject
());
mapAbstractTransportationSpace
(
intersectionProp
.
getObject
(),
isect
);
mapAbstractTransportationSpace
(
intersectionProp
.
getObject
(),
isect
);
finish
CityObject
Construction
(
isect
);
finish
Feature
Construction
(
isect
);
top
.
addIntersection
(
isect
);
top
.
addIntersection
(
isect
);
}
}
}
}
...
@@ -1046,7 +958,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1046,7 +958,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
tso
.
addTrafficArea
(
tao
);
tso
.
addTrafficArea
(
tao
);
}
}
}
}
finishCityObjectConstruction
(
tso
);
}
}
private
void
mapAuxiliaryTrafficSpace
(
AuxiliaryTrafficSpace
ats
,
TrafficSpaceObject
tso
)
{
private
void
mapAuxiliaryTrafficSpace
(
AuxiliaryTrafficSpace
ats
,
TrafficSpaceObject
tso
)
{
...
@@ -1060,7 +971,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1060,7 +971,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
tso
.
addTrafficArea
(
tao
);
tso
.
addTrafficArea
(
tao
);
}
}
}
}
finishCityObjectConstruction
(
tso
);
}
}
private
void
mapTrafficArea
(
TrafficArea
ta
,
TrafficAreaObject
tao
)
{
private
void
mapTrafficArea
(
TrafficArea
ta
,
TrafficAreaObject
tao
)
{
...
@@ -1070,7 +980,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1070,7 +980,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface
(
ta
.
getLod2MultiSurface
(),
Lod
.
LOD2
,
tao
);
parseAndAddMultiSurface
(
ta
.
getLod2MultiSurface
(),
Lod
.
LOD2
,
tao
);
parseAndAddMultiSurface
(
ta
.
getLod3MultiSurface
(),
Lod
.
LOD3
,
tao
);
parseAndAddMultiSurface
(
ta
.
getLod3MultiSurface
(),
Lod
.
LOD3
,
tao
);
parseAndAddMultiSurface
(
ta
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
tao
);
parseAndAddMultiSurface
(
ta
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
tao
);
finishCityObjectConstruction
(
tao
);
}
}
private
void
mapAuxiliaryTrafficArea
(
AuxiliaryTrafficArea
ats
,
TrafficAreaObject
tao
)
{
private
void
mapAuxiliaryTrafficArea
(
AuxiliaryTrafficArea
ats
,
TrafficAreaObject
tao
)
{
...
@@ -1080,7 +989,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1080,7 +989,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddMultiSurface
(
ats
.
getLod2MultiSurface
(),
Lod
.
LOD2
,
tao
);
parseAndAddMultiSurface
(
ats
.
getLod2MultiSurface
(),
Lod
.
LOD2
,
tao
);
parseAndAddMultiSurface
(
ats
.
getLod3MultiSurface
(),
Lod
.
LOD3
,
tao
);
parseAndAddMultiSurface
(
ats
.
getLod3MultiSurface
(),
Lod
.
LOD3
,
tao
);
parseAndAddMultiSurface
(
ats
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
tao
);
parseAndAddMultiSurface
(
ats
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
tao
);
finishCityObjectConstruction
(
tao
);
}
}
private
void
mapAbstractUnoccupiedSpace
(
AbstractUnoccupiedSpace
aus
,
CityObject
co
,
Orientation
orientation
)
{
private
void
mapAbstractUnoccupiedSpace
(
AbstractUnoccupiedSpace
aus
,
CityObject
co
,
Orientation
orientation
)
{
...
@@ -1225,294 +1133,333 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1225,294 +1133,333 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
}
private
void
read
AbstractBuilding
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
private
void
map
AbstractBuilding
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
AbstractBuilding
cdBuilding
)
{
mapAbstractOccupiedSpace
(
gmlAb
,
cdBuilding
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
gmlAb
,
cdBuilding
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
gmlAb
,
cdBuilding
);
cdBuilding
.
setGmlObject
(
gmlAb
);
cdBuilding
.
setGmlObject
(
gmlAb
);
// parse deprecated geometries
// parse deprecated geometries
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBuilding
);
var
dProp
=
gmlAb
.
getDeprecatedProperties
();
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBuilding
);
parseAndAddMultiSurface
(
dProp
.
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBuilding
);
parseAndAddSolid
(
gmlAb
.
getDeprecatedProperties
().
getLod4Solid
(),
Lod
.
LOD4
,
cdBuilding
,
Orientation
.
OUTWARD
);
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBuilding
);
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdBuilding
,
Orientation
.
OUTWARD
);
parseBuildingConstructiveElements
(
gmlAb
,
cdBuilding
);
parseBuildingInstallations
(
gmlAb
,
cdBuilding
);
List
<
BuildingConstructiveElement
>
elements
=
readBuildingConstructiveElementProperties
(
gmlAb
.
getBuildingConstructiveElements
());
parseBuildingRooms
(
gmlAb
,
cdBuilding
);
elements
.
forEach
(
cdBuilding:
:
addConstructiveElement
);
parseBuildingSubdivisions
(
gmlAb
,
cdBuilding
);
List
<
Installation
>
installations
=
readBuildingInstallationProperties
(
gmlAb
.
getBuildingInstallations
());
parseBoundarySurfaces
(
gmlAb
,
cdBuilding
);
installations
.
forEach
(
cdBuilding:
:
addInstallation
);
parseBuildingFurniture
(
gmlAb
,
cdBuilding
);
List
<
BuildingRoom
>
rooms
=
readBuildingRoomProperties
(
gmlAb
.
getBuildingRooms
());
}
rooms
.
forEach
(
cdBuilding:
:
addRoom
);
List
<
BuildingRoomFurniture
>
furniture
=
readBuildingFurnitureProperties
(
gmlAb
.
getBuildingFurniture
());
private
void
parseBuildingFurniture
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
furniture
.
forEach
(
cdBuilding:
:
addFurniture
);
for
(
BuildingFurnitureProperty
bfProp
:
gmlAb
.
getBuildingFurniture
())
{
readBuildingSubdivisions
(
gmlAb
,
cdBuilding
);
}
private
List
<
BuildingRoomFurniture
>
readBuildingFurnitureProperties
(
List
<
BuildingFurnitureProperty
>
properties
)
{
List
<
BuildingRoomFurniture
>
furnitureList
=
new
ArrayList
<>();
for
(
BuildingFurnitureProperty
bfProp
:
properties
)
{
var
gmlBf
=
bfProp
.
getObject
();
var
gmlBf
=
bfProp
.
getObject
();
if
(
gmlBf
==
null
)
{
if
(
gmlBf
==
null
)
{
continue
;
continue
;
}
}
BuildingRoomFurniture
bf
=
map
BuildingFurniture
(
gmlBf
);
BuildingRoomFurniture
bf
=
parse
BuildingFurniture
(
gmlBf
);
cdBuilding
.
addBuildingRoomFurniture
(
bf
);
furnitureList
.
add
(
bf
);
}
}
return
furnitureList
;
}
}
private
void
parseBoundarySurfaces
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
private
void
mapBoundedSpace
(
AbstractSpace
gmlSpace
,
BoundedSpace
space
)
{
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gml
Ab
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gml
Space
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
surface
.
accept
(
surfaceMapper
);
}
}
updatePartOfSurface
(
cdBuilding
,
surfaceMapper
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
space
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
updateEdgesAndVertices
(
bs
);
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
for
(
Opening
o
:
bs
.
getOpenings
())
{
updateEdgesAndVertices
(
o
);
updateEdgesAndVertices
(
o
);
}
}
}
}
}
}
private
void
parseBuildingSubdivisions
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
private
void
readBuildingSubdivisions
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
>
storeyMap
=
new
HashMap
<>();
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
>
unitMap
=
new
HashMap
<>();
for
(
AbstractBuildingSubdivisionProperty
abs
:
gmlAb
.
getBuildingSubdivisions
())
{
for
(
AbstractBuildingSubdivisionProperty
abs
:
gmlAb
.
getBuildingSubdivisions
())
{
var
gmlABS
=
abs
.
getObject
();
var
gmlABS
=
abs
.
getObject
();
if
(
gmlABS
==
null
)
{
if
(
gmlABS
==
null
)
{
continue
;
continue
;
}
}
if
(
gmlABS
instanceof
Storey
gmlStorey
)
{
if
(
gmlABS
instanceof
Storey
gmlStorey
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
map
BuildingStorey
(
gmlStorey
);
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
parse
BuildingStorey
(
gmlStorey
,
storeyMap
,
unitMap
);
cdBuilding
.
addStorey
(
storey
);
cdBuilding
.
addStorey
(
storey
);
}
else
if
(
gmlABS
instanceof
BuildingUnit
gmlBU
)
{
}
else
if
(
gmlABS
instanceof
BuildingUnit
gmlBU
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
map
BuildingUnit
(
gmlBU
);
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
parse
BuildingUnit
(
gmlBU
,
unitMap
,
storeyMap
);
cdBuilding
.
addBuildingUnit
(
bu
);
cdBuilding
.
addBuildingUnit
(
bu
);
}
}
}
}
resolveBuildingSubdivisionsProperties
(
cdBuilding
);
}
private
void
resolveBuildingSubdivisionsProperties
(
AbstractBuilding
cdBuilding
){
List
<
AbstractBuildingSubdivision
>
absList
=
new
ArrayList
<>(
cdBuilding
.
getBuildingUnits
());
absList
.
addAll
(
cdBuilding
.
getStoreys
());
Map
<
GmlId
,
BuildingRoom
>
roomMap
=
cdBuilding
.
getRooms
().
stream
()
.
collect
(
Collectors
.
toMap
(
GmlElement:
:
getGmlId
,
room
->
room
));
Map
<
GmlId
,
BuildingConstructiveElement
>
bceMap
=
cdBuilding
.
getConstructiveElements
().
stream
()
.
collect
(
Collectors
.
toMap
(
GmlElement:
:
getGmlId
,
bce
->
bce
));
for
(
AbstractBuildingSubdivision
abs:
absList
){
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuildingSubdivision
gmlObject
=
abs
.
getGmlObject
();
List
<
Installation
>
installations
=
readBuildingInstallationProperties
(
gmlObject
.
getBuildingInstallations
());
installations
.
forEach
(
abs:
:
addInstallation
);
List
<
BuildingRoomFurniture
>
furniture
=
readBuildingFurnitureProperties
(
gmlObject
.
getBuildingFurniture
());
furniture
.
forEach
(
abs:
:
addFurniture
);
for
(
BuildingConstructiveElementProperty
bceProp
:
gmlObject
.
getBuildingConstructiveElements
())
{
var
gmlBce
=
bceProp
.
getObject
();
if
(
gmlBce
==
null
)
{
continue
;
}
BuildingConstructiveElement
cdBce
;
if
(
gmlBce
.
getId
()
!=
null
&&
bceMap
.
containsKey
(
new
GmlId
(
gmlBce
.
getId
())))
{
cdBce
=
bceMap
.
get
(
new
GmlId
(
gmlBce
.
getId
()));
}
else
{
cdBce
=
parseBuildingConstructiveElement
(
gmlBce
);
}
abs
.
addConstructiveElement
(
cdBce
);
}
for
(
BuildingRoomProperty
brProp:
gmlObject
.
getBuildingRooms
())
{
var
gmlBR
=
brProp
.
getObject
();
if
(
gmlBR
==
null
)
{
continue
;
}
BuildingRoom
cdBr
;
if
(
gmlBR
.
getId
()
!=
null
&&
roomMap
.
containsKey
(
new
GmlId
(
gmlBR
.
getId
())))
{
cdBr
=
roomMap
.
get
(
new
GmlId
(
gmlBR
.
getId
()));
}
else
{
cdBr
=
parseBuildingRoom
(
gmlBR
);
}
abs
.
addRoom
(
cdBr
);
}
}
}
}
private
void
parseBuildingConstructiveElements
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
private
List
<
BuildingConstructiveElement
>
readBuildingConstructiveElementProperties
(
List
<
BuildingConstructiveElementProperty
>
properties
)
{
for
(
BuildingConstructiveElementProperty
bceProp
:
gmlAb
.
getBuildingConstructiveElements
())
{
List
<
BuildingConstructiveElement
>
elements
=
new
ArrayList
<>();
for
(
BuildingConstructiveElementProperty
bceProp
:
properties
)
{
var
gmlBCE
=
bceProp
.
getObject
();
var
gmlBCE
=
bceProp
.
getObject
();
if
(
gmlBCE
==
null
)
{
if
(
gmlBCE
==
null
)
{
continue
;
continue
;
}
}
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
bce
=
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
cdBce
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
(
gmlBCE
);
parseBuildingConstructiveElement
(
gmlBCE
);
mapBuildingConstructiveElement
(
bce
,
gmlBCE
);
elements
.
add
(
cdBce
);
cdBuilding
.
addConstructiveElement
(
bce
);
}
}
return
elements
;
}
}
private
void
parseBuildingRooms
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
parseBuildingConstructiveElement
(
for
(
BuildingRoomProperty
brProp
:
gmlAb
.
getBuildingRooms
())
{
org
.
citygml4j
.
core
.
model
.
building
.
BuildingConstructiveElement
gmlBuildingCE
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
cdBuildingCE
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
(
gmlBuildingCE
);
mapAbstractConstructiveElement
(
gmlBuildingCE
,
cdBuildingCE
);
return
cdBuildingCE
;
}
private
List
<
BuildingRoom
>
readBuildingRoomProperties
(
List
<
BuildingRoomProperty
>
properties
)
{
List
<
BuildingRoom
>
rooms
=
new
ArrayList
<>();
for
(
BuildingRoomProperty
brProp
:
properties
)
{
var
gmlBr
=
brProp
.
getObject
();
var
gmlBr
=
brProp
.
getObject
();
if
(
gmlBr
==
null
)
{
if
(
gmlBr
==
null
)
{
continue
;
continue
;
}
}
BuildingRoom
br
=
map
BuildingRoom
(
gmlBr
);
BuildingRoom
br
=
parse
BuildingRoom
(
gmlBr
);
cdBuilding
.
addBuildingRoom
(
br
);
rooms
.
add
(
br
);
}
}
return
rooms
;
}
}
private
void
parseBuildingInstallations
(
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
,
AbstractBuilding
cdBuilding
)
{
private
List
<
Installation
>
readBuildingInstallationProperties
(
List
<
BuildingInstallationProperty
>
properties
)
{
for
(
BuildingInstallationProperty
biProp
:
gmlAb
.
getBuildingInstallations
())
{
List
<
Installation
>
installations
=
new
ArrayList
<>();
for
(
BuildingInstallationProperty
biProp
:
properties
)
{
var
gmlBi
=
biProp
.
getObject
();
var
gmlBi
=
biProp
.
getObject
();
if
(
gmlBi
==
null
)
{
if
(
gmlBi
==
null
)
{
// ignore empty properties
// ignore empty properties
continue
;
continue
;
}
}
Installation
bi
=
mapBuildingInstallation
(
gmlBi
);
Installation
bi
=
parseBuildingInstallation
(
gmlBi
);
cdBuilding
.
addBuildingInstallation
(
bi
);
installations
.
add
(
bi
);
}
for
(
Installation
bi
:
cdBuilding
.
getBuildingInstallations
())
{
updateEdgesAndVertices
(
bi
);
for
(
BoundarySurface
bs
:
bi
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
updateEdgesAndVertices
(
o
);
}
}
}
}
return
installations
;
}
}
private
BuildingRoom
mapBuildingRoom
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingRoom
gmlBr
)
{
BuildingRoom
br
=
new
BuildingRoom
();
private
BuildingRoom
parseBuildingRoom
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingRoom
buildingRoom
)
{
br
.
setGmlObject
(
gmlBr
);
BuildingRoom
cdRoom
=
new
BuildingRoom
();
mapAbstractUnoccupiedSpace
(
gmlBr
,
br
,
Orientation
.
INWARD
);
cdRoom
.
setGmlObject
(
buildingRoom
);
mapAbstractUnoccupiedSpace
(
buildingRoom
,
cdRoom
,
Orientation
.
INWARD
);
mapBoundedSpace
(
buildingRoom
,
cdRoom
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
var
dProp
=
buildingRoom
.
getDeprecatedProperties
();
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBr
.
getBoundaries
())
{
parseAndAddMultiSurface
(
dProp
.
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdRoom
);
if
(!
surfaceProp
.
isSetObject
())
{
parseAndAddSolid
(
dProp
.
getLod4Solid
(),
Lod
.
LOD4
,
cdRoom
,
Orientation
.
INWARD
);
continue
;
}
List
<
BuildingRoomFurniture
>
furniture
=
readBuildingFurnitureProperties
(
buildingRoom
.
getBuildingFurniture
());
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
furniture
.
forEach
(
cdRoom:
:
addFurniture
);
surface
.
accept
(
surfaceMapper
);
List
<
Installation
>
installations
=
readBuildingInstallationProperties
(
buildingRoom
.
getBuildingInstallations
());
}
installations
.
forEach
(
cdRoom:
:
addInstallation
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
br
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
for
(
BuildingInstallationProperty
biProp
:
gmlBr
.
getBuildingInstallations
())
{
var
gmlBi
=
biProp
.
getObject
();
if
(
gmlBi
==
null
)
{
// ignore empty properties
continue
;
}
Installation
bi
=
mapBuildingInstallation
(
gmlBi
);
br
.
addRoomInstallation
(
bi
);
}
for
(
BuildingFurnitureProperty
bfProp
:
gmlBr
.
getBuildingFurniture
())
{
var
gmlHref
=
bfProp
.
getHref
();
if
(
gmlHref
==
null
)
{
continue
;
}
br
.
addFurnitureRef
(
bfProp
);
}
return
br
;
return
cdRoom
;
}
}
private
BuildingRoomFurniture
mapBuildingFurniture
(
BuildingFurniture
gmlAF
)
{
private
BuildingRoomFurniture
parseBuildingFurniture
(
BuildingFurniture
buildingFurn
)
{
BuildingRoomFurniture
bf
=
new
BuildingRoomFurniture
();
BuildingRoomFurniture
cdFurn
=
new
BuildingRoomFurniture
();
bf
.
setGmlObject
(
gmlAF
);
cdFurn
.
setGmlObject
(
buildingFurn
);
mapAbstractOccupiedSpace
(
gmlAF
,
bf
,
Orientation
.
OUTWARD
);
mapAbstractFurniture
(
buildingFurn
,
cdFurn
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlAF
.
getBoundaries
())
{
var
dProp
=
buildingFurn
.
getDeprecatedProperties
();
if
(!
surfaceProp
.
isSetObject
())
{
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdFurn
,
Orientation
.
OUTWARD
);
continue
;
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
surface
.
accept
(
surfaceMapper
);
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bf
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
return
bf
;
return
cdFurn
;
}
}
private
void
mapBuildingConstructiveElement
(
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingConstructiveElement
bce
,
BuildingConstructiveElement
ele
)
{
mapAbstractOccupiedSpace
(
ele
,
bce
,
Orientation
.
OUTWARD
);
private
void
mapAbstractFurniture
(
org
.
citygml4j
.
core
.
model
.
construction
.
AbstractFurniture
gmlAf
,
AbstractFurniture
cdAf
)
{
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
mapAbstractOccupiedSpace
(
gmlAf
,
cdAf
,
Orientation
.
OUTWARD
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
ele
.
getBoundaries
())
{
mapBoundedSpace
(
gmlAf
,
cdAf
);
if
(!
surfaceProp
.
isSetObject
())
{
}
private
void
mapAbstractConstructiveElement
(
AbstractConstructiveElement
gmlAce
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
AbstractConstructiveElement
cdAce
){
mapAbstractOccupiedSpace
(
gmlAce
,
cdAce
,
Orientation
.
OUTWARD
);
mapBoundedSpace
(
gmlAce
,
cdAce
);
List
<
AbstractConstructiveFillingElement
>
fillings
=
readAbstractFillingElements
(
gmlAce
.
getFillings
());
fillings
.
forEach
(
cdAce:
:
addFilling
);
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
parseBuildingStorey
(
Storey
gmlStorey
,
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
>
storeyMap
,
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
>
unitMap
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
cdStorey
=
shallowParseBuildingStorey
(
gmlStorey
);
storeyMap
.
put
(
cdStorey
.
getGmlId
(),
cdStorey
);
for
(
BuildingUnitProperty
buProp
:
gmlStorey
.
getBuildingUnits
())
{
var
gmlBu
=
buProp
.
getObject
();
if
(
gmlBu
==
null
)
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
;
surface
.
accept
(
surfaceMapper
);
if
(
gmlBu
.
getId
()
==
null
)
{
}
bu
=
shallowParseBuildingUnit
(
gmlBu
);
for
(
AbstractFillingElementProperty
fillProp
:
ele
.
getFillings
())
{
}
else
{
if
(!
fillProp
.
isSetObject
())
{
bu
=
parseBuildingUnit
(
gmlBu
,
unitMap
,
storeyMap
);
continue
;
}
}
AbstractFillingElement
filling
=
fillProp
.
getObject
();
cdStorey
.
addBuildingUnit
(
bu
);
bce
.
addFilling
(
mapAbstractFillingElement
(
filling
));
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bce
.
addBoundarySurface
(
bs
);
}
}
return
cdStorey
;
}
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
mapBuildingStorey
(
Storey
gmlStorey
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
();
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
shallowParseBuildingStorey
(
Storey
gmlStorey
)
{
storey
.
setGmlObject
(
gmlStorey
);
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
cdStorey
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
();
mapAbstractSpace
(
gmlStorey
,
storey
,
Orientation
.
INWARD
);
cdStorey
.
setGmlObject
(
gmlStorey
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
mapAbstractSpace
(
gmlStorey
,
cdStorey
,
Orientation
.
INWARD
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlStorey
.
getBoundaries
())
{
mapBoundedSpace
(
gmlStorey
,
cdStorey
);
if
(!
surfaceProp
.
isSetObject
())
{
return
cdStorey
;
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
parseBuildingUnit
(
BuildingUnit
gmlBUnit
,
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
>
unitMap
,
Map
<
GmlId
,
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
>
storeyMap
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
cdBUnit
=
shallowParseBuildingUnit
(
gmlBUnit
);
unitMap
.
put
(
cdBUnit
.
getGmlId
(),
cdBUnit
);
for
(
StoreyProperty
sProp
:
gmlBUnit
.
getStoreys
())
{
var
gmlStorey
=
sProp
.
getObject
();
if
(
gmlStorey
==
null
)
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
;
surface
.
accept
(
surfaceMapper
);
if
(
gmlStorey
.
getId
()
==
null
)
{
}
storey
=
shallowParseBuildingStorey
(
gmlStorey
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
}
else
{
storey
.
addBoundarySurface
(
bs
);
storey
=
parseBuildingStorey
(
gmlStorey
,
storeyMap
,
unitMap
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
cdBUnit
.
addStorey
(
storey
);
}
}
return
storey
;
return
cdBUnit
;
}
}
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
mapBuildingUnit
(
BuildingUnit
gmlBU
)
{
private
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
shallowParseBuildingUnit
(
BuildingUnit
gmlBUnit
)
{
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
();
bu
.
setGmlObject
(
gmlBU
);
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
cdBUnit
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
();
mapAbstractSpace
(
gmlBU
,
bu
,
Orientation
.
OUTWARD
);
cdBUnit
.
setGmlObject
(
gmlBUnit
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
mapAbstractSpace
(
gmlBUnit
,
cdBUnit
,
Orientation
.
OUTWARD
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBU
.
getBoundaries
())
{
mapBoundedSpace
(
gmlBUnit
,
cdBUnit
);
if
(!
surfaceProp
.
isSetObject
())
{
for
(
BuildingFurnitureProperty
bfProp
:
gmlBUnit
.
getBuildingFurniture
())
{
var
gmlBf
=
bfProp
.
getObject
();
if
(
gmlBf
==
null
)
{
continue
;
continue
;
}
}
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
(
);
BuildingRoomFurniture
bf
=
parseBuildingFurniture
(
gmlBf
);
surface
.
accept
(
surfaceMapper
);
cdBUnit
.
addFurniture
(
bf
);
}
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
for
(
BuildingInstallationProperty
biProp
:
gmlBUnit
.
getBuildingInstallations
()){
bu
.
addBoundarySurface
(
bs
);
var
gmlBi
=
biProp
.
getObject
();
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
if
(
gmlBi
==
null
)
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
continue
;
p
.
setPartOfSurface
(
bs
);
}
}
}
Installation
bi
=
parseBuildingInstallation
(
gmlBi
);
cdBUnit
.
addInstallation
(
bi
);
}
}
return
bu
;
return
cdBUnit
;
}
}
private
void
updatePartOfSurface
(
AbstractBuilding
cdBuilding
,
SurfaceMapper
surfaceMapper
)
{
private
Installation
parseBuildingInstallation
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingInstallation
buildingInst
)
{
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
Installation
cdInst
=
new
Installation
();
cdBuilding
.
addBoundarySurface
(
bs
);
cdInst
.
setGmlObject
(
buildingInst
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
mapAbstractInstallation
(
buildingInst
,
cdInst
);
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
}
}
}
}
private
Installation
mapBuildingInstallation
(
org
.
citygml4j
.
core
.
model
.
building
.
BuildingInstallation
gmlBi
)
{
var
dProp
=
buildingInst
.
getDeprecatedProperties
();
Installation
bi
=
new
Installation
();
parseAndAddAbstractGeometry
(
dProp
.
getLod2Geometry
(),
Lod
.
LOD2
,
cdInst
,
Orientation
.
OUTWARD
);
bi
.
setGmlObject
(
gmlBi
);
parseAndAddAbstractGeometry
(
dProp
.
getLod3Geometry
(),
Lod
.
LOD3
,
cdInst
,
Orientation
.
OUTWARD
);
mapAbstractOccupiedSpace
(
gmlBi
,
bi
,
Orientation
.
OUTWARD
);
parseAndAddAbstractGeometry
(
dProp
.
getLod4Geometry
(),
Lod
.
LOD4
,
cdInst
,
Orientation
.
OUTWARD
);
GeometryProperty
<?>
lod2Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
();
parseAndAddAbstractGeometry
(
lod2Prop
,
Lod
.
LOD2
,
bi
,
Orientation
.
OUTWARD
);
GeometryProperty
<?>
lod3Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod3Geometry
();
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
,
Orientation
.
OUTWARD
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
,
Orientation
.
OUTWARD
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
return
cdInst
;
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
}
if
(!
surfaceProp
.
isSetObject
())
{
continue
;
private
void
mapAbstractInstallation
(
AbstractInstallation
abstractInst
,
Installation
cdInst
)
{
}
mapAbstractOccupiedSpace
(
abstractInst
,
cdInst
,
Orientation
.
OUTWARD
);
AbstractSpaceBoundary
surface
=
surfaceProp
.
getObject
();
mapBoundedSpace
(
abstractInst
,
cdInst
);
surface
.
accept
(
surfaceMapper
);
for
(
BoundarySurface
bs
:
cdInst
.
getBoundarySurfaces
())
{
}
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
bi
.
addBoundarySurface
(
bs
);
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Geometry
geom
:
bs
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfSurface
(
bs
);
p
.
setPartOfInstallation
(
cdInst
);
p
.
setPartOfInstallation
(
bi
);
}
}
}
}
}
}
for
(
Geometry
geom
:
bi
.
getGeometries
())
{
for
(
Geometry
geom
:
cdInst
.
getGeometries
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
for
(
Polygon
p
:
geom
.
getPolygons
())
{
p
.
setPartOfInstallation
(
bi
);
p
.
setPartOfInstallation
(
cdInst
);
}
}
}
}
return
bi
;
}
}
private
void
parseAndAddAbstractGeometry
(
GeometryProperty
<?>
geomProp
,
Lod
lod
,
CityObject
co
,
Orientation
orientation
)
{
private
void
parseAndAddAbstractGeometry
(
GeometryProperty
<?>
geomProp
,
Lod
lod
,
CityObject
co
,
Orientation
orientation
)
{
...
...
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