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
ca719316
Commit
ca719316
authored
Apr 11, 2025
by
Riegel
Browse files
Refactor: Use new method for clearing of GML-geometry
parent
ae344b1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingUnit.java
View file @
ca719316
...
@@ -25,13 +25,6 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
...
@@ -25,13 +25,6 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
}
}
@Override
public
void
unsetGmlGeometries
()
{
super
.
unsetGmlGeometries
();
for
(
Storey
storey
:
storeys
)
{
storey
.
unsetGmlGeometries
();
}
}
@Override
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java
View file @
ca719316
...
@@ -24,6 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
...
@@ -24,6 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId;
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.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
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
...
@@ -73,6 +74,10 @@ public abstract class CityObject extends GmlElement {
...
@@ -73,6 +74,10 @@ public abstract class CityObject extends GmlElement {
*/
*/
public
abstract
void
unsetGmlGeometries
();
public
abstract
void
unsetGmlGeometries
();
public
final
void
clearGmlGeometries
()
{
this
.
accept
(
new
UnsetGeometriesVisitor
());
}
public
void
addGeometry
(
Geometry
geom
)
{
public
void
addGeometry
(
Geometry
geom
)
{
Objects
.
requireNonNull
(
geom
);
Objects
.
requireNonNull
(
geom
);
geometryList
.
add
(
geom
);
geometryList
.
add
(
geom
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
ca719316
...
@@ -412,7 +412,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -412,7 +412,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
bi
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
...
@@ -484,11 +483,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -484,11 +483,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
}
}
}
cdTunnel
.
unsetGmlGeometries
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
cdTunnel
);
}
}
private
void
parseTunnelBoundarySurfaces
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
)
{
private
void
parseTunnelBoundarySurfaces
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
)
{
...
@@ -563,7 +557,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -563,7 +557,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
ti
);
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
ti
);
GeometryProperty
<?>
lod4Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod4Geometry
();
GeometryProperty
<?>
lod4Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
ti
);
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
ti
);
ti
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTi
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTi
.
getBoundaries
())
{
...
@@ -635,7 +629,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -635,7 +629,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TunnelFurniture
tf
=
new
TunnelFurniture
();
TunnelFurniture
tf
=
new
TunnelFurniture
();
tf
.
setGmlObject
(
gmlTf
);
tf
.
setGmlObject
(
gmlTf
);
mapAbstractOccupiedSpace
(
gmlTf
,
tf
);
mapAbstractOccupiedSpace
(
gmlTf
,
tf
);
tf
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTf
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTf
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
@@ -659,7 +653,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -659,7 +653,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelConstructiveElement
gmlTe
)
{
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelConstructiveElement
gmlTe
)
{
TunnelConstructiveElement
te
=
new
TunnelConstructiveElement
(
gmlTe
);
TunnelConstructiveElement
te
=
new
TunnelConstructiveElement
(
gmlTe
);
mapAbstractOccupiedSpace
(
gmlTe
,
te
);
mapAbstractOccupiedSpace
(
gmlTe
,
te
);
te
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTe
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTe
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
@@ -800,7 +793,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -800,7 +793,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
parseId
(
co
.
getGmlObject
(),
co
);
parseId
(
co
.
getGmlObject
(),
co
);
co
.
accept
(
new
Unset
Geometries
Visitor
()
);
co
.
clearGml
Geometries
(
);
resolveAndClearReferences
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
co
);
updateEdgesAndVertices
(
co
);
}
}
...
@@ -1069,9 +1062,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1069,9 +1062,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
updatePartOfSurface
(
cdBuilding
,
surfaceMapper
);
updatePartOfSurface
(
cdBuilding
,
surfaceMapper
);
cdBuilding
.
unsetGmlGeometries
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
cdBuilding
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
updateEdgesAndVertices
(
bs
);
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
for
(
Opening
o
:
bs
.
getOpenings
())
{
...
@@ -1174,7 +1164,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1174,7 +1164,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
BuildingRoomFurniture
bf
=
new
BuildingRoomFurniture
();
BuildingRoomFurniture
bf
=
new
BuildingRoomFurniture
();
bf
.
setGmlObject
(
gmlAF
);
bf
.
setGmlObject
(
gmlAF
);
mapAbstractOccupiedSpace
(
gmlAF
,
bf
);
mapAbstractOccupiedSpace
(
gmlAF
,
bf
);
bf
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlAF
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlAF
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
@@ -1199,7 +1188,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1199,7 +1188,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
();
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
();
storey
.
setGmlObject
(
gmlStorey
);
storey
.
setGmlObject
(
gmlStorey
);
mapAbstractSpace
(
gmlStorey
,
storey
);
mapAbstractSpace
(
gmlStorey
,
storey
);
storey
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlStorey
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlStorey
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
@@ -1223,7 +1211,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1223,7 +1211,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
();
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
();
bu
.
setGmlObject
(
gmlBU
);
bu
.
setGmlObject
(
gmlBU
);
mapAbstractSpace
(
gmlBU
,
bu
);
mapAbstractSpace
(
gmlBU
,
bu
);
bu
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBU
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBU
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
@@ -1264,7 +1251,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -1264,7 +1251,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
bi
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java
View file @
ca719316
...
@@ -25,6 +25,8 @@ import java.nio.file.Path;
...
@@ -25,6 +25,8 @@ import java.nio.file.Path;
import
java.util.List
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.ade.ADEException
;
import
org.citygml4j.core.ade.ADEException
;
...
@@ -160,6 +162,7 @@ public class CityDoctorValidation {
...
@@ -160,6 +162,7 @@ public class CityDoctorValidation {
logger
.
error
(
"Input file '{}' does not exist."
,
input
);
logger
.
error
(
"Input file '{}' does not exist."
,
input
);
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
if
(
inputFile
.
getName
().
endsWith
(
".gml"
))
{
if
(
inputFile
.
getName
().
endsWith
(
".gml"
))
{
startFileValidation
(
inputFile
,
xmlOutput
,
pdfOutput
,
config
,
outputFile
);
startFileValidation
(
inputFile
,
xmlOutput
,
pdfOutput
,
config
,
outputFile
);
}
else
if
(
inputFile
.
getName
().
endsWith
(
".zip"
))
{
}
else
if
(
inputFile
.
getName
().
endsWith
(
".zip"
))
{
...
...
CityDoctorParent/Extensions/CityDoctorHealer/src/main/java/de/hft/stuttgart/citydoctor2/healer/Healer.java
View file @
ca719316
...
@@ -263,7 +263,7 @@ public class Healer {
...
@@ -263,7 +263,7 @@ public class Healer {
co
.
reCreateGeometries
(
factory
,
checker
.
getConfig
().
getParserConfiguration
());
co
.
reCreateGeometries
(
factory
,
checker
.
getConfig
().
getParserConfiguration
());
byte
[]
gml
=
writeCityGml
(
co
.
getGmlObject
());
byte
[]
gml
=
writeCityGml
(
co
.
getGmlObject
());
// remove them again to save memory
// remove them again to save memory
co
.
unset
GmlGeometries
();
co
.
clear
GmlGeometries
();
SvrlContentHandler
handler
=
Checker
.
executeSchematronValidationIfAvailable
(
config
,
SvrlContentHandler
handler
=
Checker
.
executeSchematronValidationIfAvailable
(
config
,
new
ByteArrayInputStream
(
gml
));
new
ByteArrayInputStream
(
gml
));
if
(
handler
!=
null
)
{
if
(
handler
!=
null
)
{
...
...
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