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
06712902
Commit
06712902
authored
Apr 09, 2025
by
Riegel
Browse files
Feat: Add TINRelief parsing
parent
a49ef71b
Changes
3
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ReliefObject.java
View file @
06712902
...
@@ -156,6 +156,10 @@ public class ReliefObject extends CityObject {
...
@@ -156,6 +156,10 @@ public class ReliefObject extends CityObject {
return
FeatureType
.
LAND
;
return
FeatureType
.
LAND
;
}
}
public
void
addComponent
(
TinObject
component
)
{
components
.
add
(
component
);
}
public
List
<
TinObject
>
getComponents
()
{
public
List
<
TinObject
>
getComponents
()
{
return
components
;
return
components
;
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
06712902
...
@@ -46,6 +46,13 @@ import org.citygml4j.core.model.construction.AbstractConstruction;
...
@@ -46,6 +46,13 @@ import org.citygml4j.core.model.construction.AbstractConstruction;
import
org.citygml4j.core.model.core.*
;
import
org.citygml4j.core.model.core.*
;
import
org.citygml4j.core.model.deprecated.transportation.TransportationComplex
;
import
org.citygml4j.core.model.deprecated.transportation.TransportationComplex
;
import
org.citygml4j.core.model.landuse.LandUse
;
import
org.citygml4j.core.model.landuse.LandUse
;
import
org.citygml4j.core.model.relief.AbstractReliefComponentProperty
;
import
org.citygml4j.core.model.relief.BreaklineRelief
;
import
org.citygml4j.core.model.relief.MassPointRelief
;
import
org.citygml4j.core.model.relief.RasterRelief
;
import
org.citygml4j.core.model.relief.ReliefFeature
;
import
org.citygml4j.core.model.relief.TINRelief
;
import
org.citygml4j.core.model.relief.TinProperty
;
import
org.citygml4j.core.model.transportation.*
;
import
org.citygml4j.core.model.transportation.*
;
import
org.citygml4j.core.model.tunnel.Tunnel
;
import
org.citygml4j.core.model.tunnel.Tunnel
;
import
org.citygml4j.core.model.tunnel.*
;
import
org.citygml4j.core.model.tunnel.*
;
...
@@ -118,9 +125,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -118,9 +125,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
CityFurniture
cf
=
new
CityFurniture
();
CityFurniture
cf
=
new
CityFurniture
();
cf
.
setGmlObject
(
gmlCityFurniture
);
cf
.
setGmlObject
(
gmlCityFurniture
);
mapAbstractOccupiedSpace
(
gmlCityFurniture
,
cf
);
mapAbstractOccupiedSpace
(
gmlCityFurniture
,
cf
);
resolveAndClearReferences
();
finishCityObjectConstruction
(
cf
);
cf
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
cf
);
model
.
addCityFurniture
(
cf
);
model
.
addCityFurniture
(
cf
);
}
}
...
@@ -141,9 +146,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -141,9 +146,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
}
mapAbstractOccupiedSpace
(
gos
,
gco
);
mapAbstractOccupiedSpace
(
gos
,
gco
);
resolveAndClearReferences
();
finishCityObjectConstruction
(
gco
);
gco
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
gco
);
model
.
addGenericCityObject
(
gco
);
model
.
addGenericCityObject
(
gco
);
}
}
...
@@ -158,6 +161,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -158,6 +161,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
BuildingPart
part
=
new
BuildingPart
(
cdBuilding
);
BuildingPart
part
=
new
BuildingPart
(
cdBuilding
);
readAbstractBuilding
(
bpProp
.
getObject
(),
part
);
readAbstractBuilding
(
bpProp
.
getObject
(),
part
);
}
}
finishCityObjectConstruction
(
cdBuilding
);
model
.
addBuilding
(
cdBuilding
);
model
.
addBuilding
(
cdBuilding
);
}
}
...
@@ -181,9 +185,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -181,9 +185,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
wo
.
addBoundarySurface
(
bs
);
wo
.
addBoundarySurface
(
bs
);
}
}
resolveAndClearReferences
();
finishCityObjectConstruction
(
wo
);
wo
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
wo
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
updateEdgesAndVertices
(
bs
);
updateEdgesAndVertices
(
bs
);
}
}
...
@@ -200,6 +202,67 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -200,6 +202,67 @@ public class Citygml3FeatureMapper extends ObjectWalker {
model
.
addLand
(
lo
);
model
.
addLand
(
lo
);
}
}
public
void
visit
(
ReliefFeature
relief
)
{
ReliefObject
ro
=
new
ReliefObject
(
relief
);
mapAbstractSpaceBoundary
(
relief
,
ro
);
mapReliefFeature
(
relief
,
ro
);
finishCityObjectConstruction
(
ro
);
model
.
addRelief
(
ro
);
}
public
void
mapReliefFeature
(
ReliefFeature
relief
,
ReliefObject
reliefObject
)
{
if
(
relief
.
isSetReliefComponents
())
{
for
(
AbstractReliefComponentProperty
arcProp
:
relief
.
getReliefComponents
())
{
if
(
arcProp
.
isSetObject
())
{
ObjectWalker
ow
=
new
ObjectWalker
()
{
@Override
public
void
visit
(
TINRelief
rel
)
{
mapTINRelief
(
rel
,
reliefObject
);
}
@Override
public
void
visit
(
MassPointRelief
rel
)
{
//TODO: Check if implementation is required
}
@Override
public
void
visit
(
BreaklineRelief
rel
)
{
//TODO: Check if implementation is required
}
@Override
public
void
visit
(
RasterRelief
rel
)
{
//TODO: Check if implementation is required
}
};
arcProp
.
getObject
().
accept
(
ow
);
}
}
}
}
public
void
mapTINRelief
(
TINRelief
relief
,
ReliefObject
reliefObject
)
{
TinObject
to
=
new
TinObject
(
relief
);
Lod
reliefLod
=
switch
(
relief
.
getLod
())
{
case
1
->
Lod
.
LOD1
;
case
2
->
Lod
.
LOD2
;
case
3
->
Lod
.
LOD3
;
case
4
->
null
;
default
->
throw
new
IllegalStateException
(
"TINRelief has unexpected LOD value: "
+
relief
.
getLod
());
};
if
(
reliefLod
==
null
)
{
logger
.
warn
(
"IllegalState: TINRelief {} has LOD value 4!"
,
relief
.
getId
());
return
;
}
reliefObject
.
addComponent
(
to
);
Citygml3GeometryMapper
tinMapper
=
new
Citygml3GeometryMapper
(
config
,
vertexMap
);
relief
.
getTin
().
getObject
().
accept
(
tinMapper
);
Geometry
geom
=
new
Geometry
(
GeometryType
.
MULTI_SURFACE
,
reliefLod
);
tinMapper
.
getPolygons
().
forEach
(
geom:
:
addPolygon
);
to
.
addGeometry
(
geom
);
}
@Override
@Override
public
void
visit
(
PlantCover
plantCover
)
{
public
void
visit
(
PlantCover
plantCover
)
{
Vegetation
veg
=
new
Vegetation
(
VegetationType
.
PLANT_COVER
);
Vegetation
veg
=
new
Vegetation
(
VegetationType
.
PLANT_COVER
);
...
@@ -281,8 +344,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -281,8 +344,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
mapAbstractBridge
(
gmlBridgePart
,
bPart
);
mapAbstractBridge
(
gmlBridgePart
,
bPart
);
bo
.
addBridgePart
(
bPart
);
bo
.
addBridgePart
(
bPart
);
}
}
resolveAndClearReferences
();
finishCityObjectConstruction
(
bo
);
updateEdgesAndVertices
(
bo
);
for
(
BridgeObject
part
:
bo
.
getParts
())
{
for
(
BridgeObject
part
:
bo
.
getParts
())
{
updateEdgesAndVertices
(
part
);
updateEdgesAndVertices
(
part
);
}
}
...
@@ -337,8 +399,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -337,8 +399,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
for
(
BoundarySurface
bs
:
bo
.
getBoundarySurfaces
())
{
for
(
BoundarySurface
bs
:
bo
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
updateEdgesAndVertices
(
bs
);
}
}
bo
.
unsetGmlGeometries
();
}
}
private
Installation
mapBridgeInstallation
(
BridgeInstallation
gmlBi
)
{
private
Installation
mapBridgeInstallation
(
BridgeInstallation
gmlBi
)
{
...
@@ -392,8 +452,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -392,8 +452,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
tu
.
addTunnelPart
(
tPart
);
tu
.
addTunnelPart
(
tPart
);
}
}
readAbstractTunnel
(
tunnel
,
tu
);
readAbstractTunnel
(
tunnel
,
tu
);
resolveAndClearReferences
();
finishCityObjectConstruction
(
tu
);
updateEdgesAndVertices
(
tu
);
for
(
TunnelPart
part
:
tu
.
getTunnelParts
())
{
for
(
TunnelPart
part
:
tu
.
getTunnelParts
())
{
updateEdgesAndVertices
(
part
);
updateEdgesAndVertices
(
part
);
}
}
...
@@ -739,6 +798,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -739,6 +798,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
parseId
(
co
.
getGmlObject
(),
co
);
co
.
unsetGmlGeometries
();
co
.
unsetGmlGeometries
();
resolveAndClearReferences
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
co
);
updateEdgesAndVertices
(
co
);
...
@@ -974,7 +1034,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -974,7 +1034,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
AbstractBuilding
cdBuilding
)
{
AbstractBuilding
cdBuilding
)
{
mapAbstractOccupiedSpace
(
gmlAb
,
cdBuilding
);
mapAbstractOccupiedSpace
(
gmlAb
,
cdBuilding
);
cdBuilding
.
setGmlObject
(
gmlAb
);
cdBuilding
.
setGmlObject
(
gmlAb
);
// parse deprecated geometries
// parse deprecated geometries
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBuilding
);
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBuilding
);
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBuilding
);
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBuilding
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3GeometryMapper.java
View file @
06712902
...
@@ -35,6 +35,7 @@ import org.xmlobjects.gml.visitor.GeometryWalker;
...
@@ -35,6 +35,7 @@ import org.xmlobjects.gml.visitor.GeometryWalker;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -76,6 +77,11 @@ public class Citygml3GeometryMapper extends GeometryWalker {
...
@@ -76,6 +77,11 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public
void
visit
(
PolygonPatch
patch
)
{
public
void
visit
(
PolygonPatch
patch
)
{
parsePolygonPatch
(
patch
,
patchCollection
);
parsePolygonPatch
(
patch
,
patchCollection
);
}
}
@Override
public
void
visit
(
Triangle
tri
)
{
parsePolygon
(
null
,
tri
.
getExterior
(),
Collections
.
emptyList
());
}
};
};
surface
.
getPatches
().
getObjects
().
forEach
(
abstractSurfacePatch
->
abstractSurfacePatch
.
accept
(
patchCollector
));
surface
.
getPatches
().
getObjects
().
forEach
(
abstractSurfacePatch
->
abstractSurfacePatch
.
accept
(
patchCollector
));
}
}
...
...
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