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
d1ff5020
Commit
d1ff5020
authored
May 24, 2025
by
Beuster
Browse files
Merge remote-tracking branch 'origin/dev' into dev_cpp_code_conversion
parents
06ad5a8e
b50c5f13
Pipeline
#11130
passed with stage
in 1 minute and 28 seconds
Changes
179
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ReliefObject.java
View file @
d1ff5020
...
...
@@ -18,12 +18,9 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.relief.ReliefFeature
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
...
...
@@ -45,7 +42,7 @@ public class ReliefObject extends CityObject {
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -56,83 +53,7 @@ public class ReliefObject extends CityObject {
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
handler
.
addInstance
(
components
);
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
ReliefObject
originalRelief
=
(
ReliefObject
)
original
;
for
(
TinObject
tin
:
originalRelief
.
components
)
{
components
.
add
(
handler
.
getCopyInstance
(
tin
));
}
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
ReliefObject
(
feature
);
}
@Override
public
void
prepareForChecking
()
{
for
(
TinObject
component
:
components
)
{
component
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
for
(
TinObject
component
:
components
)
{
component
.
clearMetaInformation
();
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
for
(
TinObject
component
:
components
)
{
component
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TinObject
tin
:
components
)
{
tin
.
collectContainedErrors
(
errors
);
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
containsError
=
super
.
containsAnyError
();
if
(
containsError
)
{
return
true
;
}
for
(
TinObject
tin
:
components
)
{
if
(
tin
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
TinObject
tin
:
components
)
{
if
(
tin
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
rebuildGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
// no geometries
}
...
...
@@ -156,6 +77,15 @@ public class ReliefObject extends CityObject {
return
FeatureType
.
LAND
;
}
@Override
public
Color
getRenderColor
()
{
return
Color
.
TAN
;
}
public
void
addComponent
(
TinObject
component
)
{
components
.
add
(
component
);
}
public
List
<
TinObject
>
getComponents
()
{
return
components
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Storey.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
java.io.Serial
;
...
...
@@ -19,113 +15,20 @@ public class Storey extends AbstractBuildingSubdivision {
private
final
List
<
BuildingUnit
>
buildingUnits
=
new
ArrayList
<>();
@Override
public
Copyable
createCopyInstance
()
{
return
new
Storey
();
}
@Override
public
void
unsetGmlGeometries
()
{
super
.
unsetGmlGeometries
();
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
unsetGmlGeometries
();
}
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
accept
(
c
);
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
collectContainedErrors
(
errors
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
clearAllContainedCheckResults
();
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
if
(
buildingUnit
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
if
(
buildingUnit
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
collectInstances
(
handler
);
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
Storey
originalSt
=
(
Storey
)
original
;
for
(
BuildingUnit
buildingUnit
:
originalSt
.
buildingUnits
)
{
buildingUnits
.
add
(
handler
.
getCopyInstance
(
buildingUnit
));
}
this
.
abs
=
originalSt
.
abs
;
}
public
List
<
BuildingUnit
>
getBuildingUnits
()
{
return
buildingUnits
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TinObject.java
View file @
d1ff5020
...
...
@@ -18,12 +18,14 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.Check
ableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
javafx.scene.paint.Color
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.relief.TINRelief
;
import
org.citygml4j.core.model.relief.TinProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractRingProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Triangle
;
...
...
@@ -48,20 +50,16 @@ public class TinObject extends CityObject {
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
}
}
@Override
public
TinObject
createCopyInstance
()
{
return
new
TinObject
(
gmlRelief
);
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
getGeometries
().
isEmpty
())
{
return
;
}
...
...
@@ -79,6 +77,8 @@ public class TinObject extends CityObject {
t
.
setExterior
(
new
AbstractRingProperty
(
CityGmlUtils
.
createGmlRing
(
factory
,
config
,
ring
)));
triangles
.
add
(
t
);
}
this
.
gmlRelief
.
setTin
(
new
TinProperty
(
surface
));
gmlRelief
.
setLod
(
geom
.
getLod
().
ordinal
());
}
@Override
...
...
@@ -101,4 +101,9 @@ public class TinObject extends CityObject {
return
FeatureType
.
LAND
;
}
@Override
public
Color
getRenderColor
()
{
return
Color
.
TAN
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TopLevelTransportFeature.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
org.citygml4j.core.model.deprecated.transportation.TransportationComplex
;
import
org.citygml4j.core.model.transportation.Railway
;
import
org.citygml4j.core.model.transportation.Road
;
import
org.citygml4j.core.model.transportation.Square
;
import
org.citygml4j.core.model.transportation.Track
;
import
org.citygml4j.core.model.transportation.Waterway
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -65,10 +59,12 @@ public class TopLevelTransportFeature extends TransportationSpace {
public
void
addSection
(
TransportSection
section
)
{
sections
.
add
(
section
);
section
.
setParent
(
this
);
}
public
void
addIntersection
(
TransportSection
section
)
{
intersections
.
add
(
section
);
section
.
setParent
(
this
);
}
public
List
<
TransportSection
>
getSections
()
{
...
...
@@ -80,79 +76,7 @@ public class TopLevelTransportFeature extends TransportationSpace {
}
@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
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
TransportSection
section
:
sections
)
{
if
(
section
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
TransportSection
section
:
intersections
)
{
if
(
section
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
TransportSection
section
:
sections
)
{
section
.
clearAllContainedCheckResults
();
}
for
(
TransportSection
section
:
intersections
)
{
section
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TransportSection
section
:
sections
)
{
section
.
collectContainedErrors
(
errors
);
}
for
(
TransportSection
section
:
intersections
)
{
section
.
collectContainedErrors
(
errors
);
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
TransportSection
section
:
sections
)
{
if
(
section
.
containsAnyError
())
{
return
true
;
}
}
for
(
TransportSection
section
:
intersections
)
{
if
(
section
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
CheckableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -165,78 +89,9 @@ public class TopLevelTransportFeature extends TransportationSpace {
}
}
@Override
public
void
unsetGmlGeometries
()
{
super
.
unsetGmlGeometries
();
for
(
TransportSection
section
:
sections
)
{
section
.
unsetGmlGeometries
();
}
for
(
TransportSection
section
:
intersections
)
{
section
.
unsetGmlGeometries
();
}
}
@Override
public
CityObject
getTopLevelCityObject
()
{
return
this
;
}
@Override
public
String
toString
()
{
return
"TopLevelTransportFeature [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
TransportSection
section
:
sections
)
{
section
.
prepareForChecking
();
}
for
(
TransportSection
section
:
intersections
)
{
section
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
TransportSection
section
:
sections
)
{
section
.
clearMetaInformation
();
}
for
(
TransportSection
section
:
intersections
)
{
section
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
TransportSection
section
:
sections
)
{
section
.
collectInstances
(
handler
);
}
for
(
TransportSection
section
:
intersections
)
{
section
.
collectInstances
(
handler
);
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TransportationObject
originalTo
=
(
TransportationObject
)
original
;
for
(
TransportSection
section
:
sections
)
{
section
.
fillValues
(
originalTo
,
handler
);
}
for
(
TransportSection
section
:
intersections
)
{
section
.
fillValues
(
originalTo
,
handler
);
}
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TopLevelTransportFeature
(
type
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficAreaObject.java
View file @
d1ff5020
...
...
@@ -11,6 +11,9 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
public
class
TrafficAreaObject
extends
TransportationObject
{
private
TrafficSpaceObject
parent
;
public
enum
TrafficAreaType
{
TRAFFIC_AREA
,
AUXILIARY_TRAFFIC_AREA
}
...
...
@@ -24,7 +27,7 @@ public class TrafficAreaObject extends TransportationObject {
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
...
...
@@ -40,6 +43,7 @@ public class TrafficAreaObject extends TransportationObject {
AuxiliaryTrafficArea
ata
=
(
AuxiliaryTrafficArea
)
super
.
getGmlObject
();
setMultiSurfaceAccordingToLod
(
ata
,
ms
,
geom
.
getLod
());
break
;
}
}
else
{
throw
new
IllegalStateException
(
"Geometry in TransportationObject cannot be of type "
+
geom
.
getType
()
...
...
@@ -99,6 +103,8 @@ public class TrafficAreaObject extends TransportationObject {
switch
(
type
)
{
case
TRAFFIC_AREA:
TrafficArea
ta
=
(
TrafficArea
)
super
.
getGmlObject
();
ta
.
setLod0MultiSurface
(
null
);
ta
.
setLod1MultiSurface
(
null
);
ta
.
setLod2MultiSurface
(
null
);
ta
.
setLod3MultiSurface
(
null
);
ta
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
...
...
@@ -116,7 +122,15 @@ public class TrafficAreaObject extends TransportationObject {
@Override
public
CityObject
getTopLevelCityObject
()
{
return
this
;
return
parent
.
getTopLevelCityObject
();
}
public
void
setParent
(
TrafficSpaceObject
parent
)
{
this
.
parent
=
parent
;
}
public
TrafficSpaceObject
getParent
()
{
return
parent
;
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficSpaceObject.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.core.AbstractSpace
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -19,6 +17,8 @@ public class TrafficSpaceObject extends TransportationObject {
private
final
List
<
TrafficAreaObject
>
trafficAreas
=
new
ArrayList
<>();
private
TransportationSpace
parent
;
public
enum
TrafficSpaceType
{
TRAFFIC_SPACE
,
AUXILIARY_TRAFFIC_SPACE
}
...
...
@@ -37,20 +37,26 @@ public class TrafficSpaceObject extends TransportationObject {
public
void
addTrafficArea
(
TrafficAreaObject
trafficAreaObject
)
{
trafficAreas
.
add
(
trafficAreaObject
);
trafficAreaObject
.
setParent
(
this
);
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
}
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
AbstractSpace
ats
=
(
AbstractSpace
)
super
.
getGmlObject
();
setMultiSurfaceAccordingToLod
(
ats
,
ms
,
geom
.
getLod
());
}
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
reCreateGeometries
(
factory
,
config
);
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
||
geom
.
getType
()
==
GeometryType
.
COMPOSITE_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
setMultiSurfaceAccordingToLod
(
ats
,
ms
,
geom
.
getLod
());
}
else
if
(
geom
.
getType
()
==
GeometryType
.
SOLID
)
{
Solid
solid
=
CityGmlUtils
.
createSolid
(
geom
,
factory
,
config
);
setSolidAccordingtoLod
(
ats
,
solid
,
geom
.
getLod
());
}
else
{
throw
new
IllegalArgumentException
(
"Unsupported geometry type: "
+
geom
.
getType
());
}
}
}
...
...
@@ -66,56 +72,30 @@ public class TrafficSpaceObject extends TransportationObject {
ats
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"cannot set geometry with LOD for AuxiliaryTrafficSpace: "
+
lod
);
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set MultiSurface with LOD %s for "
+
"[GML]AbstractSpace in TrafficSpaceObject "
,
lod
));
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
if
(
tao
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
collectContainedErrors
(
errors
);
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
if
(
tao
.
containsAnyError
())
{
return
true
;
}
private
void
setSolidAccordingtoLod
(
AbstractSpace
ats
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1:
ats
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
ats
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
ats
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set MultiSurface with LOD %s for "
+
"[GML]AbstractSpace in TrafficSpaceObject "
,
lod
));
}
return
false
;
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -131,60 +111,28 @@ public class TrafficSpaceObject extends TransportationObject {
ats
.
setLod0MultiSurface
(
null
);
ats
.
setLod2MultiSurface
(
null
);
ats
.
setLod3MultiSurface
(
null
);
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
unsetGmlGeometries
(
);
}
ats
.
setLod1Solid
(
null
);
ats
.
setLod2Solid
(
null
);
ats
.
setLod3Solid
(
null
);
}
@Override
public
CityObject
getTopLevelCityObject
()
{
return
this
;
return
parent
.
getTopLevelCityObject
()
;
}
@Override
public
String
toString
()
{
return
"TransportationSpaceObject [id="
+
getGmlId
()
+
"]"
;
public
void
setParent
(
TransportationSpace
parent
)
{
this
.
parent
=
parent
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
prepareForChecking
();
}
public
TransportationSpace
getParent
()
{
return
parent
;
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
tao
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
TrafficAreaObject
tao
:
trafficAreas
)
{
handler
.
addInstance
(
tao
);
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TrafficSpaceObject
originalTao
=
(
TrafficSpaceObject
)
original
;
for
(
TrafficAreaObject
tao
:
originalTao
.
trafficAreas
)
{
trafficAreas
.
add
(
handler
.
getCopyInstance
(
tao
));
}
super
.
setGmlObject
(
originalTao
.
getGmlObject
());
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TrafficSpaceObject
(
null
);
public
String
toString
()
{
return
"TransportationSpaceObject [id="
+
getGmlId
()
+
"]"
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportSection.java
View file @
d1ff5020
...
...
@@ -2,6 +2,8 @@ package de.hft.stuttgart.citydoctor2.datastructure;
public
class
TransportSection
extends
TransportationSpace
{
private
TopLevelTransportFeature
parent
;
public
enum
SectionType
{
SECTION
,
INTERSECTION
}
...
...
@@ -13,5 +15,17 @@ public class TransportSection extends TransportationSpace {
}
}
public
void
setParent
(
TopLevelTransportFeature
parent
)
{
this
.
parent
=
parent
;
}
public
TopLevelTransportFeature
getParent
()
{
return
parent
;
}
@Override
public
CityObject
getTopLevelCityObject
()
{
return
parent
.
getTopLevelCityObject
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java
View file @
d1ff5020
...
...
@@ -18,21 +18,9 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
import
org.citygml4j.core.model.core.AbstractSpace
;
import
org.citygml4j.core.model.transportation.AbstractTransportationSpace
;
import
org.citygml4j.core.model.transportation.AuxiliaryTrafficArea
;
import
org.citygml4j.core.model.transportation.TrafficArea
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
java.io.Serial
;
import
java.util.ArrayList
;
...
...
@@ -77,6 +65,17 @@ public abstract class TransportationObject extends CityObject {
return
ato
;
}
@Override
public
Color
getRenderColor
()
{
return
switch
(
type
)
{
case
TRACK
->
Color
.
BROWN
;
case
WATERWAY
->
Color
.
NAVY
;
case
SQUARE
->
Color
.
DARKSLATEGRAY
;
case
AUXILLIARY_TRAFFIC_AREA
,
AUXILLIARY_TRAFFIC_SPACE
->
Color
.
LIGHTSLATEGREY
;
default
->
Color
.
DIMGRAY
;
};
}
public
void
setGmlObject
(
AbstractCityObject
tc
)
{
ato
=
tc
;
...
...
@@ -92,17 +91,9 @@ public abstract class TransportationObject extends CityObject {
return
"TransportationObject [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TransportationObject
originalTo
=
(
TransportationObject
)
original
;
ato
=
originalTo
.
ato
;
}
@Override
public
Copyable
createCopyInstance
()
{
return
null
;
public
String
getDisplayText
()
{
return
String
.
format
(
"[%s] %s"
,
this
.
type
.
name
(),
this
.
getGmlId
().
toString
())
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationSpace.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
org.citygml4j.core.model.core.AbstractSpace
;
import
org.citygml4j.core.model.transportation.AbstractTransportationSpace
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -35,37 +33,42 @@ public abstract class TransportationSpace extends TransportationObject {
public
void
addTrafficSpace
(
TrafficSpaceObject
t
)
{
trafficSpaces
.
add
(
t
);
t
.
setParent
(
this
);
}
public
void
addAuxTrafficSpace
(
TrafficSpaceObject
t
)
{
auxTrafficSpaces
.
add
(
t
);
t
.
setParent
(
this
);
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
}
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
if
(
super
.
getGmlObject
()
instanceof
AbstractTransportationSpace
ats
)
{
if
(
super
.
getGmlObject
()
instanceof
AbstractTransportationSpace
ats
)
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
||
geom
.
getType
()
==
GeometryType
.
COMPOSITE_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
setMultiSurfaceAccordingToLod
(
ats
,
ms
,
geom
.
getLod
());
}
else
if
(
geom
.
getType
()
==
GeometryType
.
SOLID
)
{
Solid
solid
=
CityGmlUtils
.
createSolid
(
geom
,
factory
,
config
);
setSolidAccordingToLod
(
ats
,
solid
,
geom
.
getLod
());
}
else
{
AbstractSpace
as
=
(
AbstractSpace
)
super
.
getGmlObject
();
throw
new
IllegalArgumentException
(
"Unsupported geometry type: "
+
geom
.
getType
());
}
}
else
if
(
super
.
getGmlObject
()
instanceof
AbstractSpace
as
)
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
||
geom
.
getType
()
==
GeometryType
.
COMPOSITE_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
setMultiSurfaceAccordingToLod
(
as
,
ms
,
geom
.
getLod
());
}
else
if
(
geom
.
getType
()
==
GeometryType
.
SOLID
)
{
Solid
solid
=
CityGmlUtils
.
createSolid
(
geom
,
factory
,
config
);
setSolidAccordingToLod
(
as
,
solid
,
geom
.
getLod
());
}
else
{
throw
new
IllegalArgumentException
(
"Unsupported geometry type: "
+
geom
.
getType
());
}
}
else
{
throw
new
IllegalStateException
(
"Geometry in TransportationObject cannot be of type "
+
geom
.
getType
()
+
". Only MultiSurface allowed"
);
}
}
for
(
TrafficSpaceObject
spaces
:
trafficSpaces
)
{
spaces
.
reCreateGeometries
(
factory
,
config
);
}
for
(
TrafficSpaceObject
spaces
:
auxTrafficSpaces
)
{
spaces
.
reCreateGeometries
(
factory
,
config
);
}
}
private
void
setMultiSurfaceAccordingToLod
(
AbstractTransportationSpace
ats
,
MultiSurface
ms
,
Lod
lod
)
{
...
...
@@ -75,8 +78,8 @@ public abstract class TransportationSpace extends TransportationObject {
case
LOD2
->
ats
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
case
LOD3
->
ats
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
case
LOD4
->
ats
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
default
->
throw
new
IllegalStateException
(
"cannot set geometry with LOD for AuxiliaryTraffic
Space
:
"
+
lod
);
default
->
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set MultiSurface with LOD %s for "
+
"[GML]AbstractTransportationSpace in Transportation
Space "
,
lod
)
)
;
}
}
...
...
@@ -92,73 +95,33 @@ public abstract class TransportationSpace extends TransportationObject {
as
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"cannot set geometry with LOD for AuxiliaryTrafficSpace: "
+
lod
);
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set MultiSurface with LOD %s for [GML]AbstractSpace in TransportationSpace "
,
lod
));
}
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
if
(
to
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
if
(
to
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
clearAllContainedCheckResults
();
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
collectContainedErrors
(
errors
);
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
collectContainedErrors
(
errors
);
private
void
setSolidAccordingToLod
(
AbstractTransportationSpace
ats
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1
->
ats
.
setLod1Solid
(
new
SolidProperty
(
solid
));
case
LOD2
->
ats
.
setLod2Solid
(
new
SolidProperty
(
solid
));
case
LOD3
->
ats
.
setLod3Solid
(
new
SolidProperty
(
solid
));
default
->
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set Solid with LOD %s for "
+
"[GML]AbstractTransportationSpace in TransportationSpace "
,
lod
));
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
if
(
to
.
containsAnyError
())
{
return
true
;
}
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
if
(
to
.
containsAnyError
())
{
return
true
;
}
private
void
setSolidAccordingToLod
(
AbstractSpace
ats
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1
->
ats
.
setLod1Solid
(
new
SolidProperty
(
solid
));
case
LOD2
->
ats
.
setLod2Solid
(
new
SolidProperty
(
solid
));
case
LOD3
->
ats
.
setLod3Solid
(
new
SolidProperty
(
solid
));
default
->
throw
new
IllegalStateException
(
String
.
format
(
"Cannot set Solid with LOD %s for [GML]AbstractSpace"
+
" in TransportationSpace "
,
lod
));
}
return
false
;
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -178,12 +141,9 @@ public abstract class TransportationSpace extends TransportationObject {
ats
.
setLod0MultiSurface
(
null
);
ats
.
setLod2MultiSurface
(
null
);
ats
.
setLod3MultiSurface
(
null
);
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
unsetGmlGeometries
();
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
unsetGmlGeometries
();
}
ats
.
setLod1Solid
(
null
);
ats
.
setLod2Solid
(
null
);
ats
.
setLod3Solid
(
null
);
}
@Override
...
...
@@ -197,50 +157,4 @@ public abstract class TransportationSpace extends TransportationObject {
return
"TransportationSpace [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
prepareForChecking
();
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
clearMetaInformation
();
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
collectInstances
(
handler
);
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
collectInstances
(
handler
);
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TransportationObject
originalTo
=
(
TransportationObject
)
original
;
for
(
TrafficSpaceObject
to
:
trafficSpaces
)
{
to
.
fillValues
(
originalTo
,
handler
);
}
for
(
TrafficSpaceObject
to
:
auxTrafficSpaces
)
{
to
.
fillValues
(
originalTo
,
handler
);
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Tunnel.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.model.tunnel.TunnelInstallation
;
import
org.citygml4j.core.model.tunnel.TunnelInstallationProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
java.io.Serial
;
import
java.util.ArrayList
;
...
...
@@ -26,13 +20,6 @@ public class Tunnel extends AbstractTunnel {
return
tunnelParts
;
}
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
public
CityObject
getTopLevelCityObject
()
{
...
...
@@ -40,7 +27,7 @@ public class Tunnel extends AbstractTunnel {
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -50,50 +37,6 @@ public class Tunnel extends AbstractTunnel {
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearAllContainedCheckResults
();
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
collectContainedErrors
(
errors
);
}
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
TunnelPart
tp
:
tunnelParts
)
{
if
(
tp
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
public
void
addTunnelPart
(
TunnelPart
tunnelPart
)
{
tunnelParts
.
add
(
tunnelPart
);
}
...
...
@@ -120,43 +63,6 @@ public class Tunnel extends AbstractTunnel {
setCityGmlBuilding
(
gmlT
);
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
clearMetaInformation
();
}
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
TunnelPart
tp
:
tunnelParts
)
{
tp
.
prepareForChecking
();
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
Tunnel
originalTunnel
=
(
Tunnel
)
original
;
for
(
TunnelPart
originalTp
:
originalTunnel
.
tunnelParts
)
{
tunnelParts
.
add
(
handler
.
getCopyInstance
(
originalTp
));
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
for
(
TunnelPart
tp
:
tunnelParts
)
{
handler
.
addInstance
(
tp
);
}
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
Tunnel
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelConstructiveElement.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
...
...
@@ -46,12 +43,12 @@ public class TunnelConstructiveElement extends CityObject {
}
@Override
public
Co
pyable
createCopyInstance
()
{
return
new
TunnelConstructiveElement
(
gmlTunnelElement
);
public
Co
lor
getRenderColor
()
{
return
parent
.
getRenderColor
(
);
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
// only handles CityGML2 for now
// unknown which CityGML is handled here
// need context information to decide
...
...
@@ -72,13 +69,25 @@ public class TunnelConstructiveElement extends CityObject {
throw
new
IllegalStateException
(
"Tunnel constructive element cannot have a composite surface geometry"
);
}
}
removeEmptyBoundarySurfaces
();
}
private
void
removeEmptyBoundarySurfaces
()
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
reCreateBoundarySurface
(
factory
,
config
,
bs
);
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
gmlTunnelElement
.
getBoundaries
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from feature"
,
bs
.
getGmlId
());
gmlTunnelElement
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -88,50 +97,6 @@ public class TunnelConstructiveElement extends CityObject {
}
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
super
.
collectContainedErrors
(
errors
);
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
collectContainedErrors
(
errors
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearAllContainedCheckResults
();
}
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
boolean
hasError
=
super
.
containsError
(
checkIdentifier
);
if
(
hasError
)
{
return
true
;
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsError
(
checkIdentifier
))
{
return
true
;
}
}
return
false
;
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
gmlTunnelElement
.
getBoundaries
())
{
...
...
@@ -191,9 +156,7 @@ public class TunnelConstructiveElement extends CityObject {
gmlTunnelElement
.
setLod1Solid
(
null
);
gmlTunnelElement
.
setLod2Solid
(
null
);
gmlTunnelElement
.
setLod3Solid
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
unsetGmlGeometries
();
}
}
@Override
...
...
@@ -215,34 +178,4 @@ public class TunnelConstructiveElement extends CityObject {
return
boundarySurfaceList
;
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
boundarySurfaceList
);
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TunnelConstructiveElement
originalTce
=
(
TunnelConstructiveElement
)
original
;
for
(
BoundarySurface
originalTs
:
originalTce
.
boundarySurfaceList
)
{
boundarySurfaceList
.
add
(
handler
.
getCopyInstance
(
originalTs
));
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelFurniture.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
java.io.Serial
;
...
...
@@ -13,9 +12,4 @@ public class TunnelFurniture extends AbstractFurniture {
super
.
setGmlObject
(
gmlObject
);
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
BuildingRoomFurniture
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelHollow.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.tunnel.TunnelFurnitureProperty
;
import
java.io.Serial
;
...
...
@@ -36,26 +35,13 @@ public class TunnelHollow extends AbstractRoom {
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TunnelHollow
oHollow
=
(
TunnelHollow
)
original
;
parent
=
handler
.
getCopyInstance
(
oHollow
.
getParent
());
public
Color
getRenderColor
()
{
return
parent
.
getRenderColor
();
}
@Override
public
CityObject
getTopLevelCityObject
()
{
return
getParent
().
getTopLevelCityObject
();
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
parent
);
return
parent
.
getTopLevelCityObject
();
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TunnelHollow
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelPart.java
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
java.io.Serial
;
public
class
TunnelPart
extends
AbstractTunnel
{
...
...
@@ -37,24 +34,6 @@ public class TunnelPart extends AbstractTunnel {
return
"TunnelPart [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
TunnelPart
originalPart
=
(
TunnelPart
)
original
;
parent
=
handler
.
getCopyInstance
(
originalPart
.
parent
);
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
parent
);
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
TunnelPart
();
}
private
TunnelPart
()
{
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vegetation.java
View file @
d1ff5020
...
...
@@ -18,24 +18,21 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.Check
ableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
import
org.citygml4j.core.model.vegetation.AbstractVegetationObject
;
import
org.citygml4j.core.model.vegetation.PlantCover
;
import
org.citygml4j.core.model.vegetation.SolitaryVegetationObject
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSolid
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSolidProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.io.Serial
;
import
java.util.Collections
;
/**
* Representation of CityGML vegetation objects
...
...
@@ -64,7 +61,7 @@ public class Vegetation extends CityObject {
}
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
...
...
@@ -94,16 +91,13 @@ public class Vegetation extends CityObject {
private
void
setSolidAccordingToLod
(
PlantCover
pc
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1:
pc
.
getDeprecatedProperties
().
setLod1
Multi
Solid
(
new
MultiSolidProperty
(
new
MultiSolid
(
Collections
.
singletonList
(
new
SolidProperty
(
solid
))
)))
;
pc
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
pc
.
getDeprecatedProperties
().
setLod2
Multi
Solid
(
new
MultiSolidProperty
(
new
MultiSolid
(
Collections
.
singletonList
(
new
SolidProperty
(
solid
))
)))
;
pc
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
pc
.
getDeprecatedProperties
().
setLod3MultiSolid
(
new
MultiSolidProperty
(
new
MultiSolid
(
Collections
.
singletonList
(
new
SolidProperty
(
solid
)))));
break
;
case
LOD4:
pc
.
getDeprecatedProperties
().
setLod4MultiSolid
(
new
MultiSolidProperty
(
new
MultiSolid
(
Collections
.
singletonList
(
new
SolidProperty
(
solid
)))));
pc
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot set Solid with lod to PlantCover:"
+
lod
);
...
...
@@ -113,13 +107,13 @@ public class Vegetation extends CityObject {
private
void
setSolidAccordingToLod
(
SolitaryVegetationObject
svo
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1:
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
new
SolidProperty
(
solid
));
svo
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
svo
.
getDeprecatedProperties
().
setLod2Geometry
(
new
SolidProperty
(
solid
));
svo
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
svo
.
getDeprecatedProperties
().
setLod3Geometry
(
new
SolidProperty
(
solid
));
svo
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD4:
svo
.
getDeprecatedProperties
().
setLod4Geometry
(
new
SolidProperty
(
solid
));
...
...
@@ -131,6 +125,9 @@ public class Vegetation extends CityObject {
private
void
setMultiSurfaceAccordingToLod
(
PlantCover
pc
,
MultiSurface
ms
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD0:
pc
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
pc
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
...
...
@@ -151,14 +148,17 @@ public class Vegetation extends CityObject {
private
void
setMultiSurfaceAccordingToLod
(
SolitaryVegetationObject
svo
,
MultiSurface
ms
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD0:
svo
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
svo
.
getDeprecatedProperties
().
setLod2Geometry
(
new
MultiSurfaceProperty
(
ms
));
svo
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD3:
svo
.
getDeprecatedProperties
().
setLod3Geometry
(
new
MultiSurfaceProperty
(
ms
));
svo
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD4:
svo
.
getDeprecatedProperties
().
setLod4Geometry
(
new
MultiSurfaceProperty
(
ms
));
...
...
@@ -169,7 +169,7 @@ public class Vegetation extends CityObject {
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -181,8 +181,19 @@ public class Vegetation extends CityObject {
return
citygmlVegetation
;
}
@Override
public
Color
getRenderColor
()
{
return
Color
.
LIGHTGREEN
;
}
@Override
public
void
unsetGmlGeometries
()
{
citygmlVegetation
.
setLod0MultiSurface
(
null
);
citygmlVegetation
.
setLod2MultiSurface
(
null
);
citygmlVegetation
.
setLod3MultiSurface
(
null
);
citygmlVegetation
.
setLod1Solid
(
null
);
citygmlVegetation
.
setLod2Solid
(
null
);
citygmlVegetation
.
setLod3Solid
(
null
);
if
(
type
==
VegetationType
.
SOLITARY_VEGETATION_OBJECT
)
{
SolitaryVegetationObject
svo
=
(
SolitaryVegetationObject
)
citygmlVegetation
;
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
...
...
@@ -192,9 +203,11 @@ public class Vegetation extends CityObject {
}
else
{
PlantCover
pc
=
(
PlantCover
)
citygmlVegetation
;
pc
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
pc
.
setLod2MultiSurface
(
null
);
pc
.
setLod3MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod2MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod3MultiSolid
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSolid
(
null
);
}
}
...
...
@@ -216,8 +229,4 @@ public class Vegetation extends CityObject {
return
"Vegetation [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
Vegetation
(
type
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vertex.java
View file @
d1ff5020
...
...
@@ -19,8 +19,6 @@
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.SerializablePair
;
import
java.io.Serial
;
...
...
@@ -34,7 +32,7 @@ import java.util.Set;
*
* @author Matthias Betz
*/
public
class
Vertex
extends
Vector3d
implements
Copyable
{
public
class
Vertex
extends
Vector3d
{
@Serial
private
static
final
long
serialVersionUID
=
-
5525361920397934892L
;
...
...
@@ -138,34 +136,4 @@ public class Vertex extends Vector3d implements Copyable {
adjacentRings
=
new
ArrayList
<>(
2
);
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
for
(
SerializablePair
<
Geometry
,
HashSet
<
LinearRing
>>
pair
:
adjacentRings
)
{
handler
.
addInstance
(
pair
.
getValue0
());
for
(
LinearRing
lr
:
pair
.
getValue1
())
{
handler
.
addInstance
(
lr
);
}
}
}
@Override
public
Copyable
createCopyInstance
()
{
return
new
Vertex
(
this
);
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
Vertex
originalVertex
=
(
Vertex
)
original
;
// vertex point data already filled
for
(
SerializablePair
<
Geometry
,
HashSet
<
LinearRing
>>
pair
:
originalVertex
.
adjacentRings
)
{
Geometry
geomCopy
=
handler
.
getCopyInstance
(
pair
.
getValue0
());
HashSet
<
LinearRing
>
set
=
new
HashSet
<>();
for
(
LinearRing
originalRing
:
pair
.
getValue1
())
{
set
.
add
(
handler
.
getCopyInstance
(
originalRing
));
}
SerializablePair
<
Geometry
,
HashSet
<
LinearRing
>>
copyPair
=
new
SerializablePair
<>(
geomCopy
,
set
);
adjacentRings
.
add
(
copyPair
);
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/WaterObject.java
View file @
d1ff5020
...
...
@@ -18,16 +18,20 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.Check
ableVisitor
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.CityGmlUtils
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
javafx.scene.paint.Color
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.model.waterbody.WaterBody
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
java.io.Serial
;
import
java.util.ArrayList
;
...
...
@@ -43,26 +47,78 @@ public class WaterObject extends CityObject {
@Serial
private
static
final
long
serialVersionUID
=
-
3821060595086337424L
;
@Serial
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
WaterObject
.
class
);
private
WaterBody
gmlWater
;
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
@Override
public
void
re
Create
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
re
build
Geometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
||
geom
.
getType
()
==
GeometryType
.
COMPOSITE_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
if
(
geom
.
getLod
()
==
Lod
.
LOD0
)
{
gmlWater
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
}
else
if
(
geom
.
getLod
()
==
Lod
.
LOD1
)
{
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
}
else
{
throw
new
IllegalStateException
(
"Cannot add MultiSurface geometry with lod to WaterBody:"
+
geom
.
getLod
());
}
setMultiSurfaceAccordingToLod
(
gmlWater
,
ms
,
geom
.
getLod
());
}
else
if
(
geom
.
getType
()
==
GeometryType
.
SOLID
)
{
Solid
solid
=
CityGmlUtils
.
createSolid
(
geom
,
factory
,
config
);
setSolidAccordingToLod
(
gmlWater
,
solid
,
geom
.
getLod
());
}
else
{
throw
new
IllegalStateException
(
"Cannot add Solid geometry to WaterBody"
);
}
}
removeEmptyBoundarySurfaces
();
}
private
void
setMultiSurfaceAccordingToLod
(
WaterBody
wb
,
MultiSurface
ms
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD0:
wb
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
wb
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
wb
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD3:
wb
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot set MultiSurface with lod to WaterBody:"
+
lod
);
}
}
private
void
setSolidAccordingToLod
(
WaterBody
wb
,
Solid
solid
,
Lod
lod
)
{
switch
(
lod
)
{
case
LOD1:
wb
.
setLod1Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD2:
wb
.
setLod2Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD3:
wb
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD4:
wb
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot set MultiSurface with lod to SolitaryVegetationObject:"
+
lod
);
}
}
private
void
removeEmptyBoundarySurfaces
()
{
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
AbstractSpaceBoundaryProperty
bsp
:
gmlWater
.
getBoundaries
())
{
if
(
bsp
.
getObject
()
!=
null
&&
bsp
.
getObject
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from feature"
,
bs
.
getGmlId
());
gmlWater
.
getBoundaries
().
remove
(
bsp
);
break
;
}
}
}
}
}
/**
...
...
@@ -85,7 +141,7 @@ public class WaterObject extends CityObject {
}
@Override
public
void
accept
(
Check
c
)
{
public
void
accept
(
Check
ableVisitor
c
)
{
super
.
accept
(
c
);
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
...
...
@@ -100,10 +156,21 @@ public class WaterObject extends CityObject {
return
gmlWater
;
}
@Override
public
Color
getRenderColor
()
{
return
Color
.
LIGHTSKYBLUE
;
}
@Override
public
void
unsetGmlGeometries
()
{
gmlWater
.
setLod0MultiSurface
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
gmlWater
.
setLod2MultiSurface
(
null
);
gmlWater
.
setLod3MultiSurface
(
null
);
gmlWater
.
setLod1Solid
(
null
);
gmlWater
.
setLod2Solid
(
null
);
gmlWater
.
setLod3Solid
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
}
@Override
...
...
@@ -120,56 +187,4 @@ public class WaterObject extends CityObject {
return
"WaterObject [id="
+
getGmlId
()
+
"]"
;
}
@Override
public
WaterObject
createCopyInstance
()
{
return
new
WaterObject
();
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
WaterObject
wo
=
(
WaterObject
)
original
;
WaterObject
originalWaterObject
=
(
WaterObject
)
original
;
for
(
BoundarySurface
originalBs
:
originalWaterObject
.
boundarySurfaceList
)
{
boundarySurfaceList
.
add
(
handler
.
getCopyInstance
(
originalBs
));
}
gmlWater
=
wo
.
gmlWater
;
}
@Override
public
boolean
containsAnyError
()
{
boolean
hasError
=
super
.
containsAnyError
();
if
(
hasError
)
{
return
true
;
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
if
(
bs
.
containsAnyError
())
{
return
true
;
}
}
return
false
;
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
super
.
collectInstances
(
handler
);
handler
.
addInstance
(
boundarySurfaceList
);
}
@Override
public
void
clearMetaInformation
()
{
super
.
clearMetaInformation
();
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
clearMetaInformation
();
}
}
@Override
public
void
prepareForChecking
()
{
super
.
prepareForChecking
();
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
prepareForChecking
();
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
d1ff5020
...
...
@@ -46,6 +46,12 @@ import org.citygml4j.core.model.construction.AbstractConstruction;
import
org.citygml4j.core.model.core.*
;
import
org.citygml4j.core.model.deprecated.transportation.TransportationComplex
;
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.transportation.*
;
import
org.citygml4j.core.model.tunnel.Tunnel
;
import
org.citygml4j.core.model.tunnel.*
;
...
...
@@ -118,9 +124,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
CityFurniture
cf
=
new
CityFurniture
();
cf
.
setGmlObject
(
gmlCityFurniture
);
mapAbstractOccupiedSpace
(
gmlCityFurniture
,
cf
);
resolveAndClearReferences
();
cf
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
cf
);
finishCityObjectConstruction
(
cf
);
model
.
addCityFurniture
(
cf
);
}
...
...
@@ -141,9 +145,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
mapAbstractOccupiedSpace
(
gos
,
gco
);
resolveAndClearReferences
();
gco
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
gco
);
finishCityObjectConstruction
(
gco
);
model
.
addGenericCityObject
(
gco
);
}
...
...
@@ -158,6 +160,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
BuildingPart
part
=
new
BuildingPart
(
cdBuilding
);
readAbstractBuilding
(
bpProp
.
getObject
(),
part
);
}
finishCityObjectConstruction
(
cdBuilding
);
model
.
addBuilding
(
cdBuilding
);
}
...
...
@@ -181,9 +184,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
wo
.
addBoundarySurface
(
bs
);
}
resolveAndClearReferences
();
wo
.
unsetGmlGeometries
();
updateEdgesAndVertices
(
wo
);
finishCityObjectConstruction
(
wo
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
updateEdgesAndVertices
(
bs
);
}
...
...
@@ -200,6 +201,67 @@ public class Citygml3FeatureMapper extends ObjectWalker {
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
)
{
//Method stub for implementation if requested
}
@Override
public
void
visit
(
BreaklineRelief
rel
)
{
//Method stub for implementation if requested
}
@Override
public
void
visit
(
RasterRelief
rel
)
{
//Method stub for implementation if requested
}
};
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
public
void
visit
(
PlantCover
plantCover
)
{
Vegetation
veg
=
new
Vegetation
(
VegetationType
.
PLANT_COVER
);
...
...
@@ -281,8 +343,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
mapAbstractBridge
(
gmlBridgePart
,
bPart
);
bo
.
addBridgePart
(
bPart
);
}
resolveAndClearReferences
();
updateEdgesAndVertices
(
bo
);
finishCityObjectConstruction
(
bo
);
for
(
BridgeObject
part
:
bo
.
getParts
())
{
updateEdgesAndVertices
(
part
);
}
...
...
@@ -337,8 +398,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
for
(
BoundarySurface
bs
:
bo
.
getBoundarySurfaces
())
{
updateEdgesAndVertices
(
bs
);
}
bo
.
unsetGmlGeometries
();
}
private
Installation
mapBridgeInstallation
(
BridgeInstallation
gmlBi
)
{
...
...
@@ -351,7 +410,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
bi
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
...
...
@@ -392,8 +450,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
tu
.
addTunnelPart
(
tPart
);
}
readAbstractTunnel
(
tunnel
,
tu
);
resolveAndClearReferences
();
updateEdgesAndVertices
(
tu
);
finishCityObjectConstruction
(
tu
);
for
(
TunnelPart
part
:
tu
.
getTunnelParts
())
{
updateEdgesAndVertices
(
part
);
}
...
...
@@ -424,11 +481,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
cdTunnel
.
unsetGmlGeometries
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
cdTunnel
);
}
private
void
parseTunnelBoundarySurfaces
(
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlTunnel
)
{
...
...
@@ -503,7 +555,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
ti
);
GeometryProperty
<?>
lod4Prop
=
gmlTi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
ti
);
ti
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTi
.
getBoundaries
())
{
...
...
@@ -575,7 +627,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
TunnelFurniture
tf
=
new
TunnelFurniture
();
tf
.
setGmlObject
(
gmlTf
);
mapAbstractOccupiedSpace
(
gmlTf
,
tf
);
tf
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTf
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
...
@@ -599,7 +651,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
org
.
citygml4j
.
core
.
model
.
tunnel
.
TunnelConstructiveElement
gmlTe
)
{
TunnelConstructiveElement
te
=
new
TunnelConstructiveElement
(
gmlTe
);
mapAbstractOccupiedSpace
(
gmlTe
,
te
);
te
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlTe
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
...
@@ -739,7 +790,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
private
void
finishCityObjectConstruction
(
CityObject
co
)
{
co
.
unsetGmlGeometries
();
parseId
(
co
.
getGmlObject
(),
co
);
co
.
clearGmlGeometries
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
co
);
}
...
...
@@ -757,7 +809,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
if
(
atsp
.
isSetObject
())
{
TrafficSpaceObject
atso
=
new
TrafficSpaceObject
(
TrafficSpaceObject
.
TrafficSpaceType
.
AUXILIARY_TRAFFIC_SPACE
);
mapAuxiliaryTrafficSpace
(
atsp
.
getObject
(),
atso
);
trsp
.
addTrafficSpace
(
atso
);
trsp
.
add
Aux
TrafficSpace
(
atso
);
}
}
}
...
...
@@ -974,7 +1026,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
AbstractBuilding
cdBuilding
)
{
mapAbstractOccupiedSpace
(
gmlAb
,
cdBuilding
);
cdBuilding
.
setGmlObject
(
gmlAb
);
// parse deprecated geometries
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
(),
Lod
.
LOD1
,
cdBuilding
);
parseAndAddMultiSurface
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
(),
Lod
.
LOD4
,
cdBuilding
);
...
...
@@ -1009,9 +1060,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
updatePartOfSurface
(
cdBuilding
,
surfaceMapper
);
cdBuilding
.
unsetGmlGeometries
();
resolveAndClearReferences
();
updateEdgesAndVertices
(
cdBuilding
);
for
(
BoundarySurface
bs
:
surfaceMapper
.
getSurfaces
())
{
updateEdgesAndVertices
(
bs
);
for
(
Opening
o
:
bs
.
getOpenings
())
{
...
...
@@ -1114,7 +1162,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
BuildingRoomFurniture
bf
=
new
BuildingRoomFurniture
();
bf
.
setGmlObject
(
gmlAF
);
mapAbstractOccupiedSpace
(
gmlAF
,
bf
);
bf
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlAF
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
...
@@ -1139,7 +1186,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
storey
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
Storey
();
storey
.
setGmlObject
(
gmlStorey
);
mapAbstractSpace
(
gmlStorey
,
storey
);
storey
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlStorey
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
...
@@ -1163,7 +1209,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
bu
=
new
de
.
hft
.
stuttgart
.
citydoctor2
.
datastructure
.
BuildingUnit
();
bu
.
setGmlObject
(
gmlBU
);
mapAbstractSpace
(
gmlBU
,
bu
);
bu
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBU
.
getBoundaries
())
{
if
(!
surfaceProp
.
isSetObject
())
{
...
...
@@ -1204,7 +1249,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseAndAddAbstractGeometry
(
lod3Prop
,
Lod
.
LOD3
,
bi
);
GeometryProperty
<?>
lod4Prop
=
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
();
parseAndAddAbstractGeometry
(
lod4Prop
,
Lod
.
LOD4
,
bi
);
bi
.
unsetGmlGeometries
();
SurfaceMapper
surfaceMapper
=
new
SurfaceMapper
(
polygonMap
,
references
,
compositeMap
,
vertexMap
,
config
);
for
(
AbstractSpaceBoundaryProperty
surfaceProp
:
gmlBi
.
getBoundaries
())
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3GeometryMapper.java
View file @
d1ff5020
...
...
@@ -35,6 +35,7 @@ import org.xmlobjects.gml.visitor.GeometryWalker;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -76,6 +77,11 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public
void
visit
(
PolygonPatch
patch
)
{
parsePolygonPatch
(
patch
,
patchCollection
);
}
@Override
public
void
visit
(
Triangle
tri
)
{
parsePolygon
(
null
,
tri
.
getExterior
(),
Collections
.
emptyList
());
}
};
surface
.
getPatches
().
getObjects
().
forEach
(
abstractSurfacePatch
->
abstractSurfacePatch
.
accept
(
patchCollector
));
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/CheckErrorFound.java
0 → 100644
View file @
d1ff5020
package
de.hft.stuttgart.citydoctor2.utils
;
/**
* This Throwable signals that a requested CheckError was found.
*/
public
class
CheckErrorFound
extends
Throwable
{
public
CheckErrorFound
()
{
super
(
"CheckError was found"
,
null
,
true
,
false
);
}
}
Prev
1
2
3
4
5
6
7
…
9
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