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
72b53470
Commit
72b53470
authored
Apr 24, 2025
by
Riegel
Browse files
Test: Update Test cases for Visitor implementation
parent
93ddbe87
Pipeline
#11067
passed with stage
in 1 minute and 25 seconds
Changes
35
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
View file @
72b53470
...
...
@@ -79,14 +79,12 @@ public abstract class AbstractBuilding extends CityObject {
ab
.
setLod1Solid
(
null
);
ab
.
setLod2Solid
(
null
);
ab
.
setLod3Solid
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
ab
.
setLod0MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
setLod2MultiSurface
(
null
);
ab
.
setLod3MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
ab
.
setLod0MultiCurve
(
null
);
ab
.
setLod2MultiCurve
(
null
);
ab
.
setLod3MultiCurve
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingSubdivision.java
View file @
72b53470
...
...
@@ -67,6 +67,7 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
abs
.
setLod1Solid
(
null
);
abs
.
setLod2Solid
(
null
);
abs
.
setLod3Solid
(
null
);
abs
.
setLod0MultiSurface
(
null
);
abs
.
setLod2MultiSurface
(
null
);
abs
.
setLod3MultiSurface
(
null
);
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractRoom.java
View file @
72b53470
...
...
@@ -23,7 +23,7 @@ public abstract class AbstractRoom extends CityObject {
private
static
final
long
serialVersionUID
=
-
1730625513988944329L
;
private
final
List
<
Installation
>
roomInstallations
=
new
ArrayList
<>(
2
);
// Rooms have a Href list of furniture, the
actual
object
is
saved in the
Building
// Rooms have a Href list of furniture, the
furniture-
object
s are
saved in the
TopLevelFeature
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
...
...
@@ -103,9 +103,6 @@ public abstract class AbstractRoom extends CityObject {
cgmlRoom
.
setLod1Solid
(
null
);
cgmlRoom
.
setLod2Solid
(
null
);
cgmlRoom
.
setLod3Solid
(
null
);
cgmlRoom
.
setLod0MultiCurve
(
null
);
cgmlRoom
.
setLod2MultiCurve
(
null
);
cgmlRoom
.
setLod3MultiCurve
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractTunnel.java
View file @
72b53470
...
...
@@ -58,10 +58,6 @@ public abstract class AbstractTunnel extends CityObject {
@Override
public
void
unsetGmlGeometries
()
{
at
.
setLod0MultiCurve
(
null
);
at
.
setLod2MultiCurve
(
null
);
at
.
setLod3MultiCurve
(
null
);
at
.
getDeprecatedProperties
().
setLod4MultiCurve
(
null
);
at
.
setLod1Solid
(
null
);
at
.
setLod2Solid
(
null
);
at
.
setLod3Solid
(
null
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java
View file @
72b53470
...
...
@@ -137,6 +137,9 @@ public class BridgeObject extends CityObject {
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
switch
(
geom
.
getLod
())
{
case
LOD0:
ab
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
...
...
@@ -251,11 +254,13 @@ public class BridgeObject extends CityObject {
ab
.
setLod1Solid
(
null
);
ab
.
setLod2Solid
(
null
);
ab
.
setLod3Solid
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
ab
.
setLod0MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
setLod2MultiSurface
(
null
);
ab
.
setLod3MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingUnit.java
View file @
72b53470
...
...
@@ -15,15 +15,6 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
private
final
List
<
Storey
>
storeys
=
new
ArrayList
<>();
@Override
public
void
rebuildGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
Storey
storey
:
storeys
)
{
storey
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
public
void
accept
(
Check
c
)
{
super
.
accept
(
c
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityFurniture.java
View file @
72b53470
...
...
@@ -51,6 +51,9 @@ public class CityFurniture extends CityObject {
cgmlCityFurniture
.
setLod1Solid
(
null
);
cgmlCityFurniture
.
setLod2Solid
(
null
);
cgmlCityFurniture
.
setLod3Solid
(
null
);
cgmlCityFurniture
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
cgmlCityFurniture
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
cgmlCityFurniture
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
cgmlCityFurniture
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LandObject.java
View file @
72b53470
...
...
@@ -103,7 +103,6 @@ public class LandObject extends CityObject {
@Override
public
void
unsetGmlGeometries
()
{
lu
.
setLod0MultiCurve
(
null
);
lu
.
setLod0MultiSurface
(
null
);
lu
.
setLod1MultiSurface
(
null
);
lu
.
setLod2MultiSurface
(
null
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Storey.java
View file @
72b53470
...
...
@@ -19,9 +19,6 @@ public class Storey extends AbstractBuildingSubdivision {
@Override
public
void
rebuildGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
BuildingUnit
buildingUnit
:
buildingUnits
)
{
buildingUnit
.
reCreateGeometries
(
factory
,
config
);
}
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TinObject.java
View file @
72b53470
...
...
@@ -25,6 +25,7 @@ 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
;
...
...
@@ -76,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
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficAreaObject.java
View file @
72b53470
...
...
@@ -43,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
()
...
...
@@ -102,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
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TrafficSpaceObject.java
View file @
72b53470
...
...
@@ -7,6 +7,8 @@ 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
;
...
...
@@ -44,9 +46,17 @@ public class TrafficSpaceObject extends TransportationObject {
if
(
geom
instanceof
ImplicitGeometryHolder
)
{
continue
;
}
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
AbstractSpace
ats
=
(
AbstractSpace
)
super
.
getGmlObject
();
setMultiSurfaceAccordingToLod
(
ats
,
ms
,
geom
.
getLod
());
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
());
}
}
}
...
...
@@ -62,7 +72,25 @@ 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
));
}
}
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
));
}
}
...
...
@@ -83,6 +111,9 @@ public class TrafficSpaceObject extends TransportationObject {
ats
.
setLod0MultiSurface
(
null
);
ats
.
setLod2MultiSurface
(
null
);
ats
.
setLod3MultiSurface
(
null
);
ats
.
setLod1Solid
(
null
);
ats
.
setLod2Solid
(
null
);
ats
.
setLod3Solid
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationSpace.java
View file @
72b53470
...
...
@@ -8,6 +8,8 @@ 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
;
...
...
@@ -45,17 +47,26 @@ public abstract class TransportationSpace extends TransportationObject {
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"
);
}
}
}
...
...
@@ -67,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
)
)
;
}
}
...
...
@@ -84,7 +95,28 @@ public abstract class TransportationSpace extends TransportationObject {
as
.
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 TransportationSpace "
,
lod
));
}
}
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
));
}
}
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
));
}
}
...
...
@@ -109,6 +141,9 @@ public abstract class TransportationSpace extends TransportationObject {
ats
.
setLod0MultiSurface
(
null
);
ats
.
setLod2MultiSurface
(
null
);
ats
.
setLod3MultiSurface
(
null
);
ats
.
setLod1Solid
(
null
);
ats
.
setLod2Solid
(
null
);
ats
.
setLod3Solid
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelConstructiveElement.java
View file @
72b53470
...
...
@@ -156,6 +156,7 @@ public class TunnelConstructiveElement extends CityObject {
gmlTunnelElement
.
setLod1Solid
(
null
);
gmlTunnelElement
.
setLod2Solid
(
null
);
gmlTunnelElement
.
setLod3Solid
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vegetation.java
View file @
72b53470
...
...
@@ -94,16 +94,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 +110,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 +128,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 +151,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
));
...
...
@@ -196,18 +199,12 @@ public class Vegetation extends CityObject {
citygmlVegetation
.
setLod3Solid
(
null
);
if
(
type
==
VegetationType
.
SOLITARY_VEGETATION_OBJECT
)
{
SolitaryVegetationObject
svo
=
(
SolitaryVegetationObject
)
citygmlVegetation
;
svo
.
setLod0MultiCurve
(
null
);
svo
.
setLod2MultiCurve
(
null
);
svo
.
setLod3MultiCurve
(
null
);
svo
.
getDeprecatedProperties
().
setLod1Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
svo
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
}
else
{
PlantCover
pc
=
(
PlantCover
)
citygmlVegetation
;
pc
.
setLod0MultiCurve
(
null
);
pc
.
setLod2MultiCurve
(
null
);
pc
.
setLod3MultiCurve
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
pc
.
getDeprecatedProperties
().
setLod1MultiSolid
(
null
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/WaterObject.java
View file @
72b53470
...
...
@@ -30,6 +30,8 @@ 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
;
...
...
@@ -54,16 +56,12 @@ public class WaterObject extends CityObject {
@Override
public
void
rebuildGeometries
(
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"
);
}
...
...
@@ -71,6 +69,44 @@ public class WaterObject extends CityObject {
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
())
{
...
...
@@ -135,10 +171,6 @@ public class WaterObject extends CityObject {
gmlWater
.
setLod2Solid
(
null
);
gmlWater
.
setLod3Solid
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
gmlWater
.
setLod0MultiCurve
(
null
);
gmlWater
.
getDeprecatedProperties
().
setLod1MultiCurve
(
null
);
gmlWater
.
setLod2MultiCurve
(
null
);
gmlWater
.
setLod3MultiCurve
(
null
);
}
@Override
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingTest.java
View file @
72b53470
...
...
@@ -41,13 +41,7 @@ import org.citygml4j.core.util.geometry.GeometryFactory;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractRing
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractSolid
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractSurface
;
import
org.xmlobjects.gml.model.geometry.primitives.Shell
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -178,46 +172,48 @@ public class AbstractBuildingTest {
@Test
public
void
testReCreateGeometriesSolid
()
{
Geometry
geom
=
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
);
AbstractBuilding
ab
=
createAbstractBuilding
();
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
model
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
addGeometry
(
geom
);
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
AbstractSolid
aSolid
=
gmlAb
.
getLod2Solid
().
getObject
();
assertTrue
(
aSolid
instanceof
Solid
);
Solid
solid
=
(
Solid
)
aSolid
;
Shell
geometry
=
solid
.
getExterior
().
getObject
();
List
<
SurfaceProperty
>
surfaceMember
=
geometry
.
getSurfaceMembers
();
assertEquals
(
1
,
surfaceMember
.
size
());
AbstractSurface
polySurface
=
surfaceMember
.
get
(
0
).
getObject
();
assertTrue
(
polySurface
instanceof
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
);
var
gmlPoly
=
(
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
)
polySurface
;
AbstractRing
ring
=
gmlPoly
.
getExterior
().
getObject
();
var
gmlRing
=
(
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
LinearRing
)
ring
;
List
<
Double
>
posList
=
gmlRing
.
toCoordinateList3D
();
double
[]
expectedValues
=
GeometryTestUtils
.
getExpectedValues
();
for
(
int
i
=
0
;
i
<
posList
.
size
();
i
++)
{
assertEquals
(
expectedValues
[
i
],
posList
.
get
(
i
),
0.00000001
);
}
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAb
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAb
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAb
.
getLod3Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAb
.
getDeprecatedProperties
().
getLod4Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
Geometry
geom
=
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
);
AbstractBuilding
ab
=
createAbstractBuilding
();
org
.
citygml4j
.
core
.
model
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
model
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
addGeometry
(
geom
);
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAb
.
getLod0MultiSurface
());
assertNotNull
(
gmlAb
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlAb
.
getLod2MultiSurface
());
assertNotNull
(
gmlAb
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAb
.
getLod3MultiSurface
());
assertNotNull
(
gmlAb
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractRoomTest.java
View file @
72b53470
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundary
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -10,12 +12,13 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
AbstractRoomTest
{
//TODO: Add RecreateGeometries test
AbstractRoom
ab
;
@Before
...
...
@@ -33,9 +36,11 @@ public class AbstractRoomTest {
Installation
mockInstallation
=
Mockito
.
mock
(
Installation
.
class
);
BoundarySurface
mockBoundarySurface
=
Mockito
.
mock
(
BoundarySurface
.
class
);
Geometry
geometry
=
Mockito
.
mock
(
Geometry
.
class
);
ab
.
addRoomInstallation
(
mockInstallation
);
ab
.
addBoundarySurface
(
mockBoundarySurface
);
ab
.
addGeometry
(
geometry
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
...
...
@@ -43,6 +48,7 @@ public class AbstractRoomTest {
Mockito
.
verify
(
mockInstallation
).
accept
(
c
);
Mockito
.
verify
(
mockBoundarySurface
).
accept
(
c
);
Mockito
.
verify
(
geometry
).
accept
(
c
);
}
@Test
...
...
@@ -65,12 +71,8 @@ public class AbstractRoomTest {
gmlAUS
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlAUS
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlAUS
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlAUS
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
ab
.
cgmlRoom
=
gmlAUS
;
ab
.
clearGmlGeometries
();
assertNull
(
gmlAUS
.
getLod1Solid
());
...
...
@@ -79,11 +81,63 @@ public class AbstractRoomTest {
assertNull
(
gmlAUS
.
getLod0MultiSurface
());
assertNull
(
gmlAUS
.
getLod2MultiSurface
());
assertNull
(
gmlAUS
.
getLod3MultiSurface
());
assertNull
(
gmlAUS
.
getLod0MultiCurve
());
assertNull
(
gmlAUS
.
getLod2MultiCurve
());
assertNull
(
gmlAUS
.
getLod3MultiCurve
());
}
@Test
public
void
testReCreateGeometriesSolid
()
{
org
.
citygml4j
.
core
.
model
.
core
.
AbstractUnoccupiedSpace
gmlAUS
=
new
org
.
citygml4j
.
core
.
model
.
core
.
AbstractUnoccupiedSpace
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
return
;
}
@Override
public
boolean
isValidBoundary
(
Class
<?
extends
AbstractSpaceBoundary
>
type
)
{
return
false
;
}
};
ab
.
cgmlRoom
=
gmlAUS
;
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAUS
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAUS
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAUS
.
getLod3Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
org
.
citygml4j
.
core
.
model
.
core
.
AbstractUnoccupiedSpace
gmlAUS
=
new
org
.
citygml4j
.
core
.
model
.
core
.
AbstractUnoccupiedSpace
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
return
;
}
@Override
public
boolean
isValidBoundary
(
Class
<?
extends
AbstractSpaceBoundary
>
type
)
{
return
false
;
}
};
ab
.
cgmlRoom
=
gmlAUS
;
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
ab
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAUS
.
getLod0MultiSurface
());
assertNotNull
(
gmlAUS
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAUS
.
getLod2MultiSurface
());
assertNotNull
(
gmlAUS
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAUS
.
getLod3MultiSurface
());
assertNotNull
(
gmlAUS
.
getLod3MultiSurface
().
getObject
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractTunnelTest.java
View file @
72b53470
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.visitor.ObjectVisitor
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiCurveProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SolidProperty
;
...
...
@@ -14,8 +15,6 @@ import static org.mockito.Mockito.verify;
public
class
AbstractTunnelTest
{
// TODO: Implement recreateGeometriesTest
AbstractTunnel
at
;
@Before
...
...
@@ -67,13 +66,8 @@ public class AbstractTunnelTest {
}
};
at
.
setGmlObject
(
gmlAt
);
gmlAt
.
setLod0MultiCurve
(
new
MultiCurveProperty
());
gmlAt
.
setLod2MultiCurve
(
new
MultiCurveProperty
());
gmlAt
.
setLod3MultiCurve
(
new
MultiCurveProperty
());
gmlAt
.
getDeprecatedProperties
().
setLod4MultiCurve
(
new
MultiCurveProperty
());
gmlAt
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
());
gmlAt
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlAt
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
...
...
@@ -86,10 +80,6 @@ public class AbstractTunnelTest {
at
.
clearGmlGeometries
();
assertNull
(
gmlAt
.
getLod0MultiCurve
());
assertNull
(
gmlAt
.
getLod2MultiCurve
());
assertNull
(
gmlAt
.
getLod3MultiCurve
());
assertNull
(
gmlAt
.
getDeprecatedProperties
().
getLod4MultiCurve
());
assertNull
(
gmlAt
.
getLod0MultiSurface
());
assertNull
(
gmlAt
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlAt
.
getLod2MultiSurface
());
...
...
@@ -102,8 +92,57 @@ public class AbstractTunnelTest {
}
@Test
public
void
testReCreateGeometry
()
{
public
void
testReCreateGeometriesSolid
()
{
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlAt
=
new
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
at
.
setGmlObject
(
gmlAt
);
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD3
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
at
.
reCreateGeometries
(
factory
,
config
);
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAt
.
getLod1Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAt
.
getLod2Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAt
.
getLod3Solid
().
getObject
());
GeometryTestUtils
.
assertSolidMatchesExpectedValues
(
gmlAt
.
getDeprecatedProperties
().
getLod4Solid
().
getObject
());
}
@Test
public
void
testReCreateGeometriesMultiSurface
()
{
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
gmlAt
=
new
org
.
citygml4j
.
core
.
model
.
tunnel
.
AbstractTunnel
()
{
@Override
public
void
accept
(
ObjectVisitor
visitor
)
{
}
};
at
.
setGmlObject
(
gmlAt
);
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
at
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
at
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAt
.
getLod0MultiSurface
());
assertNotNull
(
gmlAt
.
getLod0MultiSurface
().
getObject
());
assertNotNull
(
gmlAt
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
gmlAt
.
getDeprecatedProperties
().
getLod1MultiSurface
().
getObject
());
assertNotNull
(
gmlAt
.
getLod2MultiSurface
());
assertNotNull
(
gmlAt
.
getLod2MultiSurface
().
getObject
());
assertNotNull
(
gmlAt
.
getLod3MultiSurface
());
assertNotNull
(
gmlAt
.
getLod3MultiSurface
().
getObject
());
assertNotNull
(
gmlAt
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
gmlAt
.
getDeprecatedProperties
().
getLod4MultiSurface
().
getObject
());
}
}
\ No newline at end of file
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurfaceTest.java
View file @
72b53470
...
...
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -51,6 +52,19 @@ public class BoundarySurfaceTest {
//Todo: Check this class for rework potential with the new Visitors
@Test
public
void
testVisitorPropagation
()
{
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
null
);
Opening
oMock
=
Mockito
.
mock
(
Opening
.
class
);
bs
.
addOpening
(
oMock
);
AbstractCheck
c
=
new
AbstractCheck
()
{
};
bs
.
accept
(
c
);
verify
(
oMock
).
accept
(
c
);
}
@Test
public
void
testAccept
()
{
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
null
);
...
...
@@ -65,7 +79,7 @@ public class BoundarySurfaceTest {
}
};
bs
.
accept
(
c
);
Mockito
.
verify
(
oMock
).
accept
(
c
);
verify
(
oMock
).
accept
(
c
);
assertEquals
(
1
,
bsCounter
.
intValue
());
}
...
...
@@ -83,7 +97,7 @@ public class BoundarySurfaceTest {
}
};
bs
.
accept
(
c
);
Mockito
.
verify
(
oMock
).
accept
(
c
);
verify
(
oMock
).
accept
(
c
);
assertEquals
(
0
,
bsCounter
.
intValue
());
}
...
...
@@ -94,7 +108,7 @@ public class BoundarySurfaceTest {
Geometry
spyGeom
=
Mockito
.
spy
(
geom
);
bs
.
addGeometry
(
spyGeom
);
bs
.
prepareForChecking
();
Mockito
.
verify
(
spyGeom
).
updateEdgesAndVertices
();
verify
(
spyGeom
).
updateEdgesAndVertices
();
}
@Test
...
...
@@ -128,7 +142,7 @@ public class BoundarySurfaceTest {
assertFalse
(
bs
.
getAllCheckResults
().
isEmpty
());
bs
.
addOpening
(
oMock
);
bs
.
clearAllContainedCheckResults
();
Mockito
.
verify
(
oMock
).
accept
(
any
(
ClearCheckResultsVisitor
.
class
));
verify
(
oMock
).
accept
(
any
(
ClearCheckResultsVisitor
.
class
));
assertTrue
(
bs
.
getAllCheckResults
().
isEmpty
());
}
...
...
@@ -304,7 +318,7 @@ public class BoundarySurfaceTest {
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bs
.
reCreateGeometries
(
factory
,
config
);
Mockito
.
verify
(
oMock
).
accept
(
any
(
GmlGeometryRebuilder
.
class
));
verify
(
oMock
).
accept
(
any
(
GmlGeometryRebuilder
.
class
));
}
@Test
...
...
@@ -327,7 +341,7 @@ public class BoundarySurfaceTest {
Opening
oMock
=
Mockito
.
mock
(
Opening
.
class
);
bs
.
addOpening
(
oMock
);
bs
.
accept
(
new
UnsetGeometriesVisitor
());
Mockito
.
verify
(
oMock
).
accept
(
any
(
UnsetGeometriesVisitor
.
class
));
verify
(
oMock
).
accept
(
any
(
UnsetGeometriesVisitor
.
class
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
...
...
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