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
23ca3296
Commit
23ca3296
authored
Apr 23, 2025
by
Riegel
Browse files
Refactor: Implement ReCreateGeometries as Visitor
parent
efa04ffb
Changes
37
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
View file @
23ca3296
...
@@ -90,7 +90,7 @@ public abstract class AbstractBuilding extends CityObject {
...
@@ -90,7 +90,7 @@ public abstract class AbstractBuilding extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -103,38 +103,21 @@ public abstract class AbstractBuilding extends CityObject {
...
@@ -103,38 +103,21 @@ public abstract class AbstractBuilding extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
removeEmptyBoundarySurfaces
();
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
reCreateGeometries
(
factory
,
config
);
}
for
(
Storey
storey
:
buildingStoreys
)
{
storey
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingUnit
bu
:
buildingUnits
)
{
bu
.
reCreateGeometries
(
factory
,
config
);
}
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
private
void
removeEmptyBoundarySurfaces
()
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
ab
.
getBoundaries
())
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
ab
.
getBoundaries
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
ab
.
getBoundaries
().
remove
(
bsp
);
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
break
;
ab
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
return
;
}
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingSubdivision.java
View file @
23ca3296
...
@@ -75,7 +75,7 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
...
@@ -75,7 +75,7 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -88,32 +88,21 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
...
@@ -88,32 +88,21 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
removeEmptyBoundarySurfaces
();
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
for
(
Installation
bi
:
buildingInstallations
)
{
bi
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoom
br
:
buildingRooms
)
{
br
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BuildingRoomFurniture
bfr
:
buildingRoomFurnitureList
)
{
bfr
.
reCreateGeometries
(
factory
,
config
);
}
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
private
void
removeEmptyBoundarySurfaces
()
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
abs
.
getBoundaries
())
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
abs
.
getBoundaries
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
abs
.
getBoundaries
().
remove
(
bsp
);
logger
.
warn
(
"Found empty boundary surface: {}, removing from building-subdivision"
,
bs
.
getGmlId
());
break
;
abs
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
return
;
}
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractFurniture.java
View file @
23ca3296
...
@@ -70,7 +70,7 @@ public abstract class AbstractFurniture extends CityObject {
...
@@ -70,7 +70,7 @@ public abstract class AbstractFurniture extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractRoom.java
View file @
23ca3296
...
@@ -60,7 +60,7 @@ public abstract class AbstractRoom extends CityObject {
...
@@ -60,7 +60,7 @@ public abstract class AbstractRoom extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -73,12 +73,6 @@ public abstract class AbstractRoom extends CityObject {
...
@@ -73,12 +73,6 @@ public abstract class AbstractRoom extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
for
(
BoundarySurface
boundarySurface
:
boundarySurfaceList
)
{
boundarySurface
.
reCreateGeometries
(
factory
,
config
);
}
for
(
Installation
roomInstallation
:
roomInstallations
)
{
roomInstallation
.
reCreateGeometries
(
factory
,
config
);
}
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractTunnel.java
View file @
23ca3296
...
@@ -72,7 +72,7 @@ public abstract class AbstractTunnel extends CityObject {
...
@@ -72,7 +72,7 @@ public abstract class AbstractTunnel extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -85,38 +85,21 @@ public abstract class AbstractTunnel extends CityObject {
...
@@ -85,38 +85,21 @@ public abstract class AbstractTunnel extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
removeEmptyBoundarySurfaces
();
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
for
(
Installation
bi
:
tunnelInstallations
)
{
bi
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelHollow
th
:
tunnelHollows
)
{
th
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelFurniture
tfr
:
tunnelFurnitureList
)
{
tfr
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelConstructiveElement
te
:
tunnelConstructiveElements
)
{
te
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
reCreateGeometries
(
factory
,
config
);
}
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
private
void
removeEmptyBoundarySurfaces
()
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
at
.
getBoundaries
())
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
at
.
getBoundaries
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
at
.
getBoundaries
().
remove
(
bsp
);
logger
.
warn
(
"Found empty boundary surface: {}, removing from tunnel"
,
bs
.
getGmlId
());
break
;
at
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
return
;
}
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java
View file @
23ca3296
...
@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
...
@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.model.core.AbstractThematicSurface
;
import
org.citygml4j.core.model.core.AbstractThematicSurface
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
...
@@ -101,7 +102,7 @@ public class BoundarySurface extends CityObject {
...
@@ -101,7 +102,7 @@ public class BoundarySurface extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
gmlObject
.
getId
()
==
null
)
{
if
(
gmlObject
.
getId
()
==
null
)
{
gmlObject
.
setId
(
getGmlId
().
getGmlString
());
gmlObject
.
setId
(
getGmlId
().
getGmlString
());
}
}
...
@@ -118,9 +119,6 @@ public class BoundarySurface extends CityObject {
...
@@ -118,9 +119,6 @@ public class BoundarySurface extends CityObject {
throw
new
IllegalStateException
(
"BoundarySurfaces can only have MultiSurface geometries"
);
throw
new
IllegalStateException
(
"BoundarySurfaces can only have MultiSurface geometries"
);
}
}
}
}
for
(
Opening
o
:
openings
)
{
o
.
reCreateGeometries
(
factory
,
config
);
}
}
}
private
void
setGeometryAccordingToLod
(
Lod
lod
,
MultiSurfaceProperty
ms
)
{
private
void
setGeometryAccordingToLod
(
Lod
lod
,
MultiSurfaceProperty
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeConstructiveElement.java
View file @
23ca3296
...
@@ -77,7 +77,7 @@ public class BridgeConstructiveElement extends CityObject {
...
@@ -77,7 +77,7 @@ public class BridgeConstructiveElement extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
// only handles CityGML2 for now
// only handles CityGML2 for now
// unknown which CityGML is handled here
// unknown which CityGML is handled here
// need context information to decide
// need context information to decide
...
@@ -100,9 +100,6 @@ public class BridgeConstructiveElement extends CityObject {
...
@@ -100,9 +100,6 @@ public class BridgeConstructiveElement extends CityObject {
break
;
break
;
}
}
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
}
}
@Override
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java
View file @
23ca3296
...
@@ -26,6 +26,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
...
@@ -26,6 +26,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.bridge.AbstractBridge
;
import
org.citygml4j.core.model.bridge.AbstractBridge
;
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
;
...
@@ -49,6 +51,9 @@ public class BridgeObject extends CityObject {
...
@@ -49,6 +51,9 @@ public class BridgeObject extends CityObject {
@Serial
@Serial
private
static
final
long
serialVersionUID
=
6301112640328373842L
;
private
static
final
long
serialVersionUID
=
6301112640328373842L
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
BridgeObject
.
class
);
private
final
List
<
BridgeObject
>
parts
=
new
ArrayList
<>(
2
);
private
final
List
<
BridgeObject
>
parts
=
new
ArrayList
<>(
2
);
private
final
List
<
BridgeConstructiveElement
>
elements
=
new
ArrayList
<>(
2
);
private
final
List
<
BridgeConstructiveElement
>
elements
=
new
ArrayList
<>(
2
);
private
final
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>(
2
);
private
final
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>(
2
);
...
@@ -104,7 +109,7 @@ public class BridgeObject extends CityObject {
...
@@ -104,7 +109,7 @@ public class BridgeObject extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -117,25 +122,21 @@ public class BridgeObject extends CityObject {
...
@@ -117,25 +122,21 @@ public class BridgeObject extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
removeEmptyBoundarySurfaces
();
}
private
void
removeEmptyBoundarySurfaces
()
{
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
bs
.
reCreateGeometries
(
factory
,
config
);
if
(
bs
.
getGeometries
().
isEmpty
())
{
}
for
(
AbstractSpaceBoundaryProperty
bsp
:
ab
.
getBoundaries
())
{
for
(
Installation
bi
:
bridgeInstallations
)
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
bi
.
reCreateGeometries
(
factory
,
config
);
logger
.
warn
(
"Found empty boundary surface: {}, removing from bridge"
,
bs
.
getGmlId
());
}
ab
.
getBoundaries
().
remove
(
bsp
);
for
(
BridgeObject
part
:
parts
)
{
break
;
part
.
reCreateGeometries
(
factory
,
config
);
}
}
}
for
(
BridgeConstructiveElement
ele
:
elements
)
{
}
ele
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BridgeRoom
br
:
bridgeRooms
)
{
br
.
reCreateGeometries
(
factory
,
config
);
}
for
(
BridgeRoomFurniture
bri
:
bridgeFurniture
)
{
bri
.
reCreateGeometries
(
factory
,
config
);
}
}
}
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java
View file @
23ca3296
...
@@ -43,13 +43,6 @@ public class Building extends AbstractBuilding {
...
@@ -43,13 +43,6 @@ public class Building extends AbstractBuilding {
return
buildingParts
;
return
buildingParts
;
}
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
BuildingPart
bp
:
buildingParts
)
{
bp
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
@Override
public
CityObject
getTopLevelCityObject
()
{
public
CityObject
getTopLevelCityObject
()
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingUnit.java
View file @
23ca3296
...
@@ -26,7 +26,7 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
...
@@ -26,7 +26,7 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
super
.
reCreateGeometries
(
factory
,
config
);
for
(
Storey
storey
:
storeys
)
{
for
(
Storey
storey
:
storeys
)
{
storey
.
reCreateGeometries
(
factory
,
config
);
storey
.
reCreateGeometries
(
factory
,
config
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityFurniture.java
View file @
23ca3296
...
@@ -62,7 +62,7 @@ public class CityFurniture extends CityObject {
...
@@ -62,7 +62,7 @@ public class CityFurniture extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java
View file @
23ca3296
...
@@ -23,6 +23,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError;
...
@@ -23,6 +23,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.GmlGeometryRebuilder
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
...
@@ -48,6 +49,7 @@ public abstract class CityObject extends GmlElement {
...
@@ -48,6 +49,7 @@ public abstract class CityObject extends GmlElement {
private
final
List
<
Geometry
>
geometryList
=
new
ArrayList
<>();
private
final
List
<
Geometry
>
geometryList
=
new
ArrayList
<>();
private
final
List
<
GenericAttribute
>
genericAttributeList
=
new
ArrayList
<>();
private
final
List
<
GenericAttribute
>
genericAttributeList
=
new
ArrayList
<>();
/**
/**
* Recreates the CityGML4j geometry in this object. The CityGML4j geometry is
* Recreates the CityGML4j geometry in this object. The CityGML4j geometry is
* deleted from the data structure as was mapped to the city doctor data
* deleted from the data structure as was mapped to the city doctor data
...
@@ -59,7 +61,11 @@ public abstract class CityObject extends GmlElement {
...
@@ -59,7 +61,11 @@ public abstract class CityObject extends GmlElement {
* transformed to a different coordinate system. It would need to
* transformed to a different coordinate system. It would need to
* be transformed to the original coordinate system
* be transformed to the original coordinate system
*/
*/
public
abstract
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
);
public
final
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
this
.
accept
(
new
GmlGeometryRebuilder
(
factory
,
config
));
}
public
abstract
void
rebuildGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
);
/**
/**
* Getter for the CityGML4j data object
* Getter for the CityGML4j data object
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/GenericCityObject.java
View file @
23ca3296
...
@@ -47,7 +47,7 @@ public class GenericCityObject extends CityObject {
...
@@ -47,7 +47,7 @@ public class GenericCityObject extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
continue
;
...
@@ -60,23 +60,21 @@ public class GenericCityObject extends CityObject {
...
@@ -60,23 +60,21 @@ public class GenericCityObject extends CityObject {
setSolidAccordingToLod
(
geom
,
solid
);
setSolidAccordingToLod
(
geom
,
solid
);
}
}
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
removeEmptyBoundarySurfaces
();
reCreateBoundarySurface
(
factory
,
config
,
bs
);
}
}
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
private
void
removeEmptyBoundarySurfaces
()
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
cgmlGos
.
getBoundaries
())
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
cgmlGos
.
getBoundaries
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from generic object"
,
bs
.
getGmlId
());
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
cgmlGos
.
getBoundaries
().
remove
(
bsp
);
logger
.
warn
(
"Found empty boundary surface: {}, removing from feature"
,
bs
.
getGmlId
());
break
;
cgmlGos
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
return
;
}
}
bs
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Installation.java
View file @
23ca3296
...
@@ -25,6 +25,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
...
@@ -25,6 +25,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
javafx.scene.paint.Color
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.bridge.BridgeInstallation
;
import
org.citygml4j.core.model.bridge.BridgeInstallation
;
import
org.citygml4j.core.model.construction.AbstractInstallation
;
import
org.citygml4j.core.model.construction.AbstractInstallation
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
...
@@ -45,13 +47,15 @@ public class Installation extends CityObject {
...
@@ -45,13 +47,15 @@ public class Installation extends CityObject {
@Serial
@Serial
private
static
final
long
serialVersionUID
=
1576237433322680191L
;
private
static
final
long
serialVersionUID
=
1576237433322680191L
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Installation
.
class
);
private
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>(
4
);
private
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>(
4
);
private
AbstractInstallation
gmlBi
;
private
AbstractInstallation
gmlBi
;
private
CityObject
parent
;
private
CityObject
parent
;
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
@@ -67,8 +71,20 @@ public class Installation extends CityObject {
...
@@ -67,8 +71,20 @@ public class Installation extends CityObject {
throw
new
IllegalStateException
(
"BuildingInstallation not have Solid geometries"
);
throw
new
IllegalStateException
(
"BuildingInstallation not have Solid geometries"
);
}
}
}
}
removeEmptyBoundarySurfaces
();
}
private
void
removeEmptyBoundarySurfaces
()
{
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
bs
.
reCreateGeometries
(
factory
,
config
);
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
gmlBi
.
getBoundaries
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from feature"
,
bs
.
getGmlId
());
gmlBi
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LandObject.java
View file @
23ca3296
...
@@ -48,7 +48,7 @@ public class LandObject extends CityObject {
...
@@ -48,7 +48,7 @@ public class LandObject extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
@@ -104,6 +104,7 @@ public class LandObject extends CityObject {
...
@@ -104,6 +104,7 @@ public class LandObject extends CityObject {
@Override
@Override
public
void
unsetGmlGeometries
()
{
public
void
unsetGmlGeometries
()
{
lu
.
setLod0MultiCurve
(
null
);
lu
.
setLod0MultiSurface
(
null
);
lu
.
setLod0MultiSurface
(
null
);
lu
.
setLod1MultiSurface
(
null
);
lu
.
setLod1MultiSurface
(
null
);
lu
.
setLod2MultiSurface
(
null
);
lu
.
setLod2MultiSurface
(
null
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Opening.java
View file @
23ca3296
...
@@ -61,7 +61,7 @@ public class Opening extends CityObject {
...
@@ -61,7 +61,7 @@ public class Opening extends CityObject {
this
.
ao
=
ao
;
this
.
ao
=
ao
;
}
}
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
ao
.
getId
()
!=
null
)
{
if
(
ao
.
getId
()
!=
null
)
{
ao
.
setId
(
getGmlId
().
getGmlString
());
ao
.
setId
(
getGmlId
().
getGmlString
());
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ReliefObject.java
View file @
23ca3296
...
@@ -82,7 +82,7 @@ public class ReliefObject extends CityObject {
...
@@ -82,7 +82,7 @@ public class ReliefObject extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
// no geometries
// no geometries
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Storey.java
View file @
23ca3296
...
@@ -25,7 +25,7 @@ public class Storey extends AbstractBuildingSubdivision {
...
@@ -25,7 +25,7 @@ public class Storey extends AbstractBuildingSubdivision {
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
super
.
reCreateGeometries
(
factory
,
config
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
reCreateGeometries
(
factory
,
config
);
buildingUnit
.
reCreateGeometries
(
factory
,
config
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TinObject.java
View file @
23ca3296
...
@@ -62,7 +62,7 @@ public class TinObject extends CityObject {
...
@@ -62,7 +62,7 @@ public class TinObject extends CityObject {
}
}
@Override
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
getGeometries
().
isEmpty
())
{
if
(
getGeometries
().
isEmpty
())
{
return
;
return
;
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TopLevelTransportFeature.java
View file @
23ca3296
...
@@ -80,17 +80,6 @@ public class TopLevelTransportFeature extends TransportationSpace {
...
@@ -80,17 +80,6 @@ public class TopLevelTransportFeature extends TransportationSpace {
return
intersections
;
return
intersections
;
}
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
TransportSection
section
:
sections
)
{
section
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TransportSection
section
:
intersections
)
{
section
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
@Override
public
void
clearAllContainedCheckResults
()
{
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
super
.
clearAllContainedCheckResults
();
...
...
Prev
1
2
Next
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