Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
3f3c1884
Commit
3f3c1884
authored
Jun 24, 2022
by
Matthias Betz
Browse files
change to citygml4j 3.0.0 rc4
change to quality ade 0.1.4
parent
92f3e523
Pipeline
#6596
failed with stage
in 17 seconds
Changes
106
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/check/error/SolidSelfIntErrorTest.java
View file @
3f3c1884
...
...
@@ -23,10 +23,10 @@ import static org.junit.Assert.assertTrue;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.QualityAdeErrorVisitor
;
import
de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
...
...
@@ -34,8 +34,10 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection
;
import
de.hft.stuttgart.quality.model.SolidSelfIntersection
;
import
de.hft.stuttgart.quality.model.ValidationError
;
import
de.hft.stuttgart.quality.model.properties.AbstractErrorProperty
;
import
de.hft.stuttgart.quality.model.types.AbstractError
;
import
de.hft.stuttgart.quality.model.types.SolidSelfIntersectionError
;
import
de.hft.stuttgart.quality.model.types.ValidationResult
;
public
class
SolidSelfIntErrorTest
{
...
...
@@ -55,9 +57,16 @@ public class SolidSelfIntErrorTest {
intersections
.
add
(
inter
);
SolidSelfIntError
err
=
new
SolidSelfIntError
(
geom
,
intersections
);
Optional
<
ValidationError
>
optional
=
err
.
convertToQualityAdeDatastructure
();
assertTrue
(
optional
.
isPresent
());
SolidSelfIntersection
adeErr
=
(
SolidSelfIntersection
)
optional
.
get
();
ValidationResult
result
=
new
ValidationResult
();
QualityAdeErrorVisitor
visitor
=
new
QualityAdeErrorVisitor
(
result
);
err
.
accept
(
visitor
);
List
<
AbstractErrorProperty
>
errors
=
result
.
getErrors
();
assertEquals
(
1
,
errors
.
size
());
AbstractError
ae
=
errors
.
get
(
0
).
getObject
();
assertTrue
(
ae
instanceof
SolidSelfIntersectionError
);
SolidSelfIntersectionError
adeErr
=
(
SolidSelfIntersectionError
)
ae
;
assertEquals
(
geomId
.
getGmlString
(),
adeErr
.
getGeometryId
());
assertEquals
(
p1Id
.
getGmlString
(),
adeErr
.
getPolygonId1
());
assertEquals
(
p2Id
.
getGmlString
(),
adeErr
.
getPolygonId2
());
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/check/error/TooFewPolygonsErrorTest.java
View file @
3f3c1884
...
...
@@ -21,16 +21,19 @@ package de.hft.stuttgart.citydoctor2.check.error;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.
Optional
;
import
java.util.
List
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.QualityAdeErrorVisitor
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlId
;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
import
de.hft.stuttgart.quality.model.TooFewPolygons
;
import
de.hft.stuttgart.quality.model.ValidationError
;
import
de.hft.stuttgart.quality.model.properties.AbstractErrorProperty
;
import
de.hft.stuttgart.quality.model.types.AbstractError
;
import
de.hft.stuttgart.quality.model.types.SolidTooFewPolygonsError
;
import
de.hft.stuttgart.quality.model.types.ValidationResult
;
public
class
TooFewPolygonsErrorTest
{
...
...
@@ -42,11 +45,16 @@ public class TooFewPolygonsErrorTest {
TooFewPolygonsError
err
=
new
TooFewPolygonsError
(
geom
);
Optional
<
ValidationError
>
optional
=
err
.
convertToQualityAdeDatastructure
();
assertTrue
(
optional
.
isPresent
());
TooFewPolygons
adeErr
=
(
TooFewPolygons
)
optional
.
get
();
ValidationResult
result
=
new
ValidationResult
();
QualityAdeErrorVisitor
visitor
=
new
QualityAdeErrorVisitor
(
result
);
err
.
accept
(
visitor
);
List
<
AbstractErrorProperty
>
errors
=
result
.
getErrors
();
assertEquals
(
1
,
errors
.
size
());
AbstractError
ae
=
errors
.
get
(
0
).
getObject
();
assertTrue
(
ae
instanceof
SolidTooFewPolygonsError
);
SolidTooFewPolygonsError
adeErr
=
(
SolidTooFewPolygonsError
)
ae
;
assertEquals
(
geomId
.
getGmlString
(),
adeErr
.
getGeometryId
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuildingTest.java
View file @
3f3c1884
...
...
@@ -29,21 +29,19 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.building.BoundarySurfaceProperty
;
import
org.citygml4j.model.citygml.building.WallSurface
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.model.gml.geometry.complexes.CompositeSurface
;
import
org.citygml4j.model.gml.geometry.primitives.AbstractRing
;
import
org.citygml4j.model.gml.geometry.primitives.AbstractSolid
;
import
org.citygml4j.model.gml.geometry.primitives.AbstractSurface
;
import
org.citygml4j.model.gml.geometry.primitives.DirectPositionList
;
import
org.citygml4j.model.gml.geometry.primitives.Polygon
;
import
org.citygml4j.model.gml.geometry.primitives.Solid
;
import
org.citygml4j.model.gml.geometry.primitives.SolidProperty
;
import
org.citygml4j.model.gml.geometry.primitives.SurfaceProperty
;
import
org.citygml4j.core.model.construction.WallSurface
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
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
;
...
...
@@ -215,31 +213,28 @@ public class AbstractBuildingTest {
Geometry
geom
=
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
);
AbstractBuilding
ab
=
createAbstractBuilding
();
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
AbstractSolid
aSolid
=
gmlAb
.
getLod2Solid
().
get
Solid
();
AbstractSolid
aSolid
=
gmlAb
.
getLod2Solid
().
get
Object
();
assertTrue
(
aSolid
instanceof
Solid
);
Solid
solid
=
(
Solid
)
aSolid
;
AbstractSurface
geometry
=
solid
.
getExterior
().
getGeometry
();
assertTrue
(
geometry
instanceof
CompositeSurface
);
CompositeSurface
cSurface
=
(
CompositeSurface
)
geometry
;
List
<
SurfaceProperty
>
surfaceMember
=
cSurface
.
getSurfaceMember
();
Shell
geometry
=
solid
.
getExterior
().
getObject
();
List
<
SurfaceProperty
>
surfaceMember
=
geometry
.
getSurfaceMembers
();
assertEquals
(
1
,
surfaceMember
.
size
());
AbstractSurface
polySurface
=
surfaceMember
.
get
(
0
).
get
Surface
();
assertTrue
(
polySurface
instanceof
org
.
city
gml
4j
.
model
.
gml
.
geometry
.
primitives
.
Polygon
);
org
.
city
gml
4j
.
model
.
gml
.
geometry
.
primitives
.
Polygon
gmlPoly
=
(
Polygon
)
polySurface
;
AbstractRing
ring
=
gmlPoly
.
getExterior
().
get
Ring
();
org
.
citygml4j
.
model
.
gml
.
geometry
.
primitives
.
LinearRing
gmlRing
=
(
org
.
city
gml
4j
.
model
.
gml
.
geometry
.
primitives
.
LinearRing
)
ring
;
DirectPositionList
posList
=
gmlRing
.
getPos
List
();
AbstractSurface
polySurface
=
surfaceMember
.
get
(
0
).
get
Object
();
assertTrue
(
polySurface
instanceof
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
);
var
gmlPoly
=
(
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
)
polySurface
;
AbstractRing
ring
=
gmlPoly
.
getExterior
().
get
Object
();
var
gmlRing
=
(
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
LinearRing
)
ring
;
List
<
Double
>
posList
=
gmlRing
.
toCoordinate
List
3D
();
double
[]
expectedValues
=
new
double
[]
{
427583.301
,
6003502.571
,
9.711
,
427583.304
,
6003502.574
,
9.713
,
427583.304
,
6003502.574
,
4.097
,
427583.301
,
6003502.571
,
4.097
,
427583.301
,
6003502.571
,
9.711
};
List
<
Double
>
values
=
posList
.
getValue
();
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++)
{
assertEquals
(
expectedValues
[
i
],
values
.
get
(
i
),
0.00000001
);
for
(
int
i
=
0
;
i
<
posList
.
size
();
i
++)
{
assertEquals
(
expectedValues
[
i
],
posList
.
get
(
i
),
0.00000001
);
}
}
...
...
@@ -248,14 +243,14 @@ public class AbstractBuildingTest {
Geometry
geom
=
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
);
AbstractBuilding
ab
=
createAbstractBuilding
();
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
gmlAb
.
getLod2MultiSurface
());
assertNotNull
(
gmlAb
.
getLod2MultiSurface
().
get
Geometry
());
assertNotNull
(
gmlAb
.
getLod2MultiSurface
().
get
Object
());
}
@Test
...
...
@@ -266,9 +261,9 @@ public class AbstractBuildingTest {
geometries
.
add
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
));
Mockito
.
when
(
bsMock
.
getGeometries
()).
thenReturn
(
geometries
);
ab
.
addBoundarySurface
(
bsMock
);
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ab
.
reCreateGeometries
(
factory
,
config
);
Mockito
.
verify
(
bsMock
).
reCreateGeometries
(
factory
,
config
);
...
...
@@ -281,17 +276,17 @@ public class AbstractBuildingTest {
Mockito
.
when
(
bsMock
.
getGmlObject
()).
thenReturn
(
ws
);
AbstractBuilding
ab
=
createAbstractBuilding
();
ab
.
addBoundarySurface
(
bsMock
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
reCreateGeometries
(
factory
,
config
);
gmlAb
.
addBound
edBySurface
(
new
Boundary
Surface
Property
());
gmlAb
.
addBound
edBySurface
(
new
Boundary
Surface
Property
(
new
WallSurface
()));
gmlAb
.
addBound
edBySurface
(
new
Boundary
Surface
Property
(
ws
));
assertEquals
(
3
,
gmlAb
.
getBound
edBySurface
().
size
());
gmlAb
.
addBound
ary
(
new
AbstractSpace
BoundaryProperty
());
gmlAb
.
addBound
ary
(
new
AbstractSpace
BoundaryProperty
(
new
WallSurface
()));
gmlAb
.
addBound
ary
(
new
AbstractSpace
BoundaryProperty
(
ws
));
assertEquals
(
3
,
gmlAb
.
getBound
aries
().
size
());
ab
.
reCreateGeometries
(
factory
,
config
);
assertEquals
(
2
,
gmlAb
.
getBound
edBySurface
().
size
());
assertEquals
(
2
,
gmlAb
.
getBound
aries
().
size
());
}
@Test
...
...
@@ -299,9 +294,9 @@ public class AbstractBuildingTest {
BuildingInstallation
biMock
=
mock
(
BuildingInstallation
.
class
);
AbstractBuilding
ab
=
createAbstractBuilding
();
ab
.
addBuildingInstallation
(
biMock
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
reCreateGeometries
(
factory
,
config
);
Mockito
.
verify
(
biMock
).
reCreateGeometries
(
factory
,
config
);
...
...
@@ -315,15 +310,15 @@ public class AbstractBuildingTest {
AbstractBuilding
ab
=
createAbstractBuilding
();
ab
.
addBoundarySurface
(
bsMock
);
ab
.
addBuildingInstallation
(
biMock
);
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
gmlAb
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
gmlAb
.
setLod1Solid
(
new
SolidProperty
());
gmlAb
.
setLod2Solid
(
new
SolidProperty
());
gmlAb
.
setLod3Solid
(
new
SolidProperty
());
gmlAb
.
setLod4Solid
(
new
SolidProperty
());
gmlAb
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlAb
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
());
gmlAb
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
());
gmlAb
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
gmlAb
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
gmlAb
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
gmlAb
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
ab
.
setCityGmlBuilding
(
gmlAb
);
ab
.
unsetGmlGeometries
();
Mockito
.
verify
(
biMock
).
unsetGmlGeometries
();
...
...
@@ -331,11 +326,11 @@ public class AbstractBuildingTest {
assertNull
(
gmlAb
.
getLod1Solid
());
assertNull
(
gmlAb
.
getLod2Solid
());
assertNull
(
gmlAb
.
getLod3Solid
());
assertNull
(
gmlAb
.
getLod4Solid
());
assertNull
(
gmlAb
.
getLod1MultiSurface
());
assertNull
(
gmlAb
.
getDeprecatedProperties
().
getLod4Solid
());
assertNull
(
gmlAb
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNull
(
gmlAb
.
getLod2MultiSurface
());
assertNull
(
gmlAb
.
getLod3MultiSurface
());
assertNull
(
gmlAb
.
getLod4MultiSurface
());
assertNull
(
gmlAb
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurfaceTest.java
View file @
3f3c1884
...
...
@@ -28,12 +28,13 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.model.c
itygml.building
.WallSurface
;
import
org.citygml4j.model.
citygml.
core.Abstract
CityObject
;
import
org.citygml4j.
model.gm
l.geometry.
aggregates.MultiSurfacePropert
y
;
import
org.citygml4j.
core.model.construction.AbstractConstructionSurface
;
import
org.citygml4j.
core.
model.c
onstruction
.WallSurface
;
import
org.citygml4j.
core.
model.core.Abstract
ThematicSurface
;
import
org.citygml4j.
core.uti
l.geometry.
GeometryFactor
y
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -172,7 +173,7 @@ public class BoundarySurfaceTest {
public
void
testReCreateGeometriesWithoutId
()
{
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNotNull
(
ws
.
getId
());
}
...
...
@@ -181,12 +182,12 @@ public class BoundarySurfaceTest {
WallSurface
ws
=
new
WallSurface
();
ws
.
setId
(
"test"
);
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
// nothing has changed
assertEquals
(
"test"
,
ws
.
getId
());
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
...
...
@@ -194,76 +195,76 @@ public class BoundarySurfaceTest {
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceBridgeLod2
()
{
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BRIDGE
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceBridgeLod3
()
{
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BRIDGE
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceBridgeLod4
()
{
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BRIDGE
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceTunnelLod2
()
{
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
TUNNEL
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceTunnelLod3
()
{
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
TUNNEL
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testReCreateGeometriesMultiSurfaceTunnelLod4
()
{
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
TUNNEL
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
...
...
@@ -272,10 +273,10 @@ public class BoundarySurfaceTest {
ws
.
setId
(
"test"
);
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
...
...
@@ -284,19 +285,20 @@ public class BoundarySurfaceTest {
ws
.
setId
(
"test"
);
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
(
expected
=
IllegalStateException
.
class
)
public
void
testReCreateGeometriesMultiSurfaceLod
1
()
{
@Test
public
void
testReCreateGeometriesMultiSurfaceLod
0
()
{
WallSurface
ws
=
new
WallSurface
();
ws
.
setId
(
"test"
);
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
bs
.
reCreateGeometries
(
new
GMLGeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
assertNotNull
(
ws
.
getLod0MultiSurface
());
}
@Test
(
expected
=
IllegalStateException
.
class
)
...
...
@@ -305,7 +307,7 @@ public class BoundarySurfaceTest {
ws
.
setId
(
"test"
);
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
));
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
new
ParserConfiguration
(
8
,
false
));
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
new
ParserConfiguration
(
8
,
false
));
}
@Test
...
...
@@ -315,7 +317,7 @@ public class BoundarySurfaceTest {
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
Opening
oMock
=
Mockito
.
mock
(
Opening
.
class
);
bs
.
addOpening
(
oMock
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bs
.
reCreateGeometries
(
factory
,
config
);
Mockito
.
verify
(
oMock
).
reCreateGeometries
(
factory
,
config
);
...
...
@@ -333,10 +335,10 @@ public class BoundarySurfaceTest {
WallSurface
ws
=
new
WallSurface
();
ws
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
ws
);
Opening
oMock
=
Mockito
.
mock
(
Opening
.
class
);
bs
.
addOpening
(
oMock
);
...
...
@@ -344,39 +346,39 @@ public class BoundarySurfaceTest {
Mockito
.
verify
(
oMock
).
unsetGmlGeometries
();
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testUnsetGmlGeometriesBridge
()
{
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
bridge
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
ws
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BRIDGE
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
unsetGmlGeometries
();
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
public
void
testUnsetGmlGeometriesTunnel
()
{
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
ws
=
new
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
WallSurface
();
WallSurface
ws
=
new
WallSurface
();
ws
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
ws
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
());
assertNotNull
(
ws
.
getLod2MultiSurface
());
assertNotNull
(
ws
.
getLod3MultiSurface
());
assertNotNull
(
ws
.
getLod4MultiSurface
());
assertNotNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
TUNNEL
,
BoundarySurfaceType
.
WALL
,
ws
);
bs
.
unsetGmlGeometries
();
assertNull
(
ws
.
getLod2MultiSurface
());
assertNull
(
ws
.
getLod3MultiSurface
());
assertNull
(
ws
.
getLod4MultiSurface
());
assertNull
(
ws
.
getDeprecatedProperties
().
getLod4MultiSurface
());
}
@Test
...
...
@@ -387,7 +389,7 @@ public class BoundarySurfaceTest {
@Test
public
void
testBoundarySurfaceAbstractCityObject
()
{
AbstractC
ityObject
aco
=
Mockito
.
mock
(
AbstractC
ityObject
.
class
);
AbstractC
onstructionSurface
aco
=
Mockito
.
mock
(
AbstractC
onstructionSurface
.
class
);
BoundarySurface
bs
=
new
BoundarySurface
(
aco
);
assertEquals
(
aco
,
bs
.
getGmlObject
());
}
...
...
@@ -408,7 +410,7 @@ public class BoundarySurfaceTest {
@Test
public
void
testSetGmlObject
()
{
Abstract
CityObject
aco
=
Mockito
.
mock
(
Abstract
CityObject
.
class
);
Abstract
ThematicSurface
aco
=
Mockito
.
mock
(
Abstract
ThematicSurface
.
class
);
BoundarySurface
bs
=
new
BoundarySurface
(
null
);
bs
.
setGmlObject
(
aco
);
assertEquals
(
aco
,
bs
.
getGmlObject
());
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObjectTest.java
View file @
3f3c1884
...
...
@@ -29,9 +29,10 @@ import static org.mockito.Mockito.when;
import
java.util.ArrayList
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.bridge.AbstractBridge
;
import
org.citygml4j.model.citygml.bridge.Bridge
;
import
org.citygml4j.core.model.bridge.AbstractBridge
;
import
org.citygml4j.core.model.bridge.Bridge
;
import
org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfAbstractBridge
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
...
...
@@ -148,7 +149,7 @@ public class BridgeObjectTest {
BridgeObject
bo
=
new
BridgeObject
(
BridgeType
.
BRIDGE
,
mock
(
AbstractBridge
.
class
));
BoundarySurface
bsMock
=
mock
(
BoundarySurface
.
class
);
bo
.
addBoundarySurface
(
bsMock
);
GML
GeometryFactory
factoryMock
=
mock
(
GML
GeometryFactory
.
class
);
GeometryFactory
factoryMock
=
mock
(
GeometryFactory
.
class
);
ParserConfiguration
configMock
=
mock
(
ParserConfiguration
.
class
);
bo
.
reCreateGeometries
(
factoryMock
,
configMock
);
verify
(
bsMock
).
reCreateGeometries
(
factoryMock
,
configMock
);
...
...
@@ -161,11 +162,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod1MultiSurface
());
assertNotNull
(
ab
.
getLod1MultiSurface
().
get
Geometry
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod1MultiSurface
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod1MultiSurface
().
get
Object
());
}
...
...
@@ -176,11 +177,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod2MultiSurface
());
assertNotNull
(
ab
.
getLod2MultiSurface
().
get
Geometry
());
assertNotNull
(
ab
.
getLod2MultiSurface
().
get
Object
());
}
@Test
...
...
@@ -190,11 +191,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod3MultiSurface
());
assertNotNull
(
ab
.
getLod3MultiSurface
().
get
Geometry
());
assertNotNull
(
ab
.
getLod3MultiSurface
().
get
Object
());
}
@Test
...
...
@@ -204,11 +205,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod4MultiSurface
());
assertNotNull
(
ab
.
getLod4MultiSurface
().
get
Geometry
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod4MultiSurface
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod4MultiSurface
().
get
Object
());
}
@Test
...
...
@@ -218,11 +219,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod1Solid
());
assertNotNull
(
ab
.
getLod1Solid
().
get
Geometry
());
assertNotNull
(
ab
.
getLod1Solid
().
get
Object
());
}
@Test
...
...
@@ -232,11 +233,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod2Solid
());
assertNotNull
(
ab
.
getLod2Solid
().
get
Geometry
());
assertNotNull
(
ab
.
getLod2Solid
().
get
Object
());
}
@Test
...
...
@@ -246,11 +247,11 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod3Solid
());
assertNotNull
(
ab
.
getLod3Solid
().
get
Geometry
());
assertNotNull
(
ab
.
getLod3Solid
().
get
Object
());
}
@Test
...
...
@@ -260,30 +261,33 @@ public class BridgeObjectTest {
AbstractBridge
ab
=
new
Bridge
();
bo
.
setGmlObject
(
ab
);
bo
.
addGeometry
(
geom
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
bo
.
reCreateGeometries
(
factory
,
config
);
assertNotNull
(
ab
.
getLod4Solid
());
assertNotNull
(
ab
.
getLod4Solid
().
get
Geometry
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod4Solid
());
assertNotNull
(
ab
.
getDeprecatedProperties
().
getLod4Solid
().
get
Object
());
}
@Test
public
void
testUnsetGmlGeometries
()
{
AbstractBridge
abMock
=
mock
(
AbstractBridge
.
class
);
DeprecatedPropertiesOfAbstractBridge
propsMock
=
mock
(
DeprecatedPropertiesOfAbstractBridge
.
class
);
when
(
abMock
.
getDeprecatedProperties
()).
thenReturn
(
propsMock
);
BridgeObject
bo
=
new
BridgeObject
(
BridgeType
.
BRIDGE
,
abMock
);
BoundarySurface
bsMock
=
mock
(
BoundarySurface
.
class
);
bo
.
addBoundarySurface
(
bsMock
);
bo
.
unsetGmlGeometries
();
verify
(
bsMock
).
unsetGmlGeometries
();
verify
(
abMock
).
unsetLod1MultiSurface
();
verify
(
abMock
).
unsetLod2MultiSurface
();
verify
(
abMock
).
unsetLod3MultiSurface
();
verify
(
abMock
).
unsetLod4MultiSurface
();
verify
(
abMock
).
unsetLod1Solid
();
verify
(
abMock
).
unsetLod2Solid
();
verify
(
abMock
).
unsetLod3Solid
();
verify
(
abMock
).
unsetLod4Solid
();
verify
(
propsMock
).
setLod1MultiSurface
(
null
);
verify
(
abMock
).
setLod2MultiSurface
(
null
);
verify
(
abMock
).
setLod3MultiSurface
(
null
);
verify
(
propsMock
).
setLod4MultiSurface
(
null
);
verify
(
abMock
).
setLod1Solid
(
null
);
verify
(
abMock
).
setLod2Solid
(
null
);
verify
(
abMock
).
setLod3Solid
(
null
);
verify
(
propsMock
).
setLod4Solid
(
null
);
}
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingTest.java
View file @
3f3c1884
...
...
@@ -23,9 +23,9 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertNotSame
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
org.citygml4j.model.citygml.building.RoofSurface
;
import
org.citygml4j.model.gml.basicTypes.Code
;
import
org.citygml4j.core.model.construction.RoofSurface
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.basictypes.Code
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing.LinearRingType
;
import
de.hft.stuttgart.citydoctor2.utils.Copy
;
...
...
@@ -110,12 +110,12 @@ public class BuildingTest {
assertNotNull
(
copyAdjacentPoly
);
assertNotSame
(
adjacentPoly
,
copyAdjacentPoly
);
assertEquals
(
b
.
getGmlObject
().
getFunction
().
get
(
0
).
getValue
(),
copy
.
getGmlObject
().
getFunction
().
get
(
0
).
getValue
());
assertEquals
(
b
.
getGmlObject
().
getFunction
s
().
get
(
0
).
getValue
(),
copy
.
getGmlObject
().
getFunction
s
().
get
(
0
).
getValue
());
}
private
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
createCityGmlBuilding
()
{
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
b
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
b
.
add
Function
(
new
Code
(
"2349"
));
private
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
createCityGmlBuilding
()
{
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
b
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
b
.
get
Function
s
().
add
(
new
Code
(
"2349"
));
b
.
setId
(
"test"
);
return
b
;
}
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java
View file @
3f3c1884
...
...
@@ -26,11 +26,10 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.model.citygml.ade.ADEComponent
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.model.citygml.core.CityModel
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
org.citygml4j.core.ade.ADEException
;
import
org.citygml4j.core.model.core.AbstractFeatureProperty
;
import
org.citygml4j.core.model.core.CityModel
;
import
org.citygml4j.xml.writer.CityGMLWriteException
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
...
...
@@ -47,14 +46,18 @@ import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import
de.hft.stuttgart.citydoctor2.check.HealingMethod
;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.quality.model.Validation
;
import
de.hft.stuttgart.quality.model.jaxb.ErrorStatistics
;
import
de.hft.stuttgart.quality.model.jaxb.Parameter
;
import
de.hft.stuttgart.quality.model.jaxb.ValidationPlan
;
import
de.hft.stuttgart.quality.model.properties.GlobalParametersProperty
;
import
de.hft.stuttgart.quality.model.properties.ParameterProperty
;
import
de.hft.stuttgart.quality.model.types.CityObjectProperties
;
import
de.hft.stuttgart.quality.model.types.GlobalParameters
;
import
de.hft.stuttgart.quality.model.types.Parameter
;
import
de.hft.stuttgart.quality.model.types.Validation
;
import
de.hft.stuttgart.quality.model.types.ValidationPlan
;
public
class
CityDoctorModelTest
{
...
...
@@ -122,8 +125,8 @@ public class CityDoctorModelTest {
}
@Test
public
void
testSaveAsWithoutValidation
()
throws
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
,
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
public
void
testSaveAsWithoutValidation
()
throws
CityGMLWriteException
,
ADEException
,
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
CityDoctorWriteException
{
File
f
=
Mockito
.
mock
(
File
.
class
);
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
CityDoctorModel
model
=
new
CityDoctorModel
(
config
,
f
);
...
...
@@ -131,7 +134,7 @@ public class CityDoctorModelTest {
model
.
setCityModel
(
cModel
);
Building
b
=
new
Building
();
b
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
));
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
gmlBuilding
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
gmlBuilding
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
gmlBuilding
.
setId
(
"testId"
);
b
.
setGmlObject
(
gmlBuilding
);
model
.
addBuilding
(
b
);
...
...
@@ -147,14 +150,16 @@ public class CityDoctorModelTest {
}
@Test
public
void
testSaveAsWithValidation
()
throws
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
,
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
public
void
testSaveAsWithValidation
()
throws
CityGMLWriteException
,
ADEException
,
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
CityDoctorWriteException
{
File
f
=
Mockito
.
mock
(
File
.
class
);
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
CityDoctorModel
model
=
new
CityDoctorModel
(
config
,
f
);
CityModel
cModel
=
new
CityModel
();
ValidationPlan
plan
=
new
ValidationPlan
();
plan
.
getGlobalParameters
().
add
(
new
Parameter
());
GlobalParameters
globParams
=
new
GlobalParameters
();
plan
.
setGlobalParameters
(
new
GlobalParametersProperty
(
globParams
));
plan
.
getGlobalParameters
().
getObject
().
getParameters
().
add
(
new
ParameterProperty
(
new
Parameter
()));
model
.
setValidated
(
plan
);
model
.
setCityModel
(
cModel
);
Building
b
=
new
Building
();
...
...
@@ -193,7 +198,7 @@ public class CityDoctorModelTest {
};
b
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
error
));
b
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
));
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
gmlBuilding
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
gmlBuilding
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
gmlBuilding
.
setId
(
"testId"
);
b
.
setGmlObject
(
gmlBuilding
);
model
.
addBuilding
(
b
);
...
...
@@ -206,14 +211,14 @@ public class CityDoctorModelTest {
Building
parsedBuilding
=
parsedModel
.
getBuildings
().
get
(
0
);
assertEquals
(
"testId"
,
parsedBuilding
.
getGmlId
().
getGmlString
());
assertEquals
(
1
,
parsedBuilding
.
getGeometries
().
size
());
assertEquals
(
1
,
parsedBuilding
.
getGmlObject
().
get
GenericApplication
Propert
yOf
CityObject
().
size
()
);
assertEquals
(
1
,
p
arsedModel
.
getCityModel
().
getGenericApplicationPropertyOfCityModel
()
.
size
());
List
<
A
DEComponent
>
adeComps
=
parsedModel
.
getCityModel
().
getGenericApplicationPropertyOfCityModel
();
ADEComponent
adeComponent
=
adeComps
.
get
(
0
);
Validation
val
=
(
Validation
)
adeComponent
;
ErrorStatistics
errorStatistics
=
val
.
getStatistics
().
get
ErrorStatistics
().
get
(
0
);
assertEquals
(
de
.
hft
.
stuttgart
.
quality
.
model
.
jaxb
.
ErrorId
.
GE_P_HOLE_OUTSIDE
,
errorStatistics
.
getName
());
assertEquals
(
1
,
errorStatistics
.
get
Amount
());
List
<
CityObjectProperties
>
props
=
parsedBuilding
.
getGmlObject
().
get
ADE
Propert
ies
(
CityObject
Properties
.
class
);
assertEquals
(
1
,
p
rops
.
size
());
List
<
A
bstractFeatureProperty
>
featureMembers
=
parsedModel
.
getCityModel
().
getFeatureMembers
();
assertEquals
(
1
,
featureMembers
.
size
()
);
Validation
val
=
(
Validation
)
featureMembers
.
get
(
0
).
getObject
()
;
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Error
errorStatistics
=
val
.
getStatistics
().
get
Object
().
getErrors
().
get
(
0
).
getObject
(
);
assertEquals
(
de
.
hft
.
stuttgart
.
quality
.
model
.
enums
.
ErrorId
.
GE_P_HOLE_OUTSIDE
,
errorStatistics
.
getName
());
assertEquals
(
1
,
errorStatistics
.
get
Occurrences
());
}
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/GeometryTest.java
View file @
3f3c1884
...
...
@@ -31,9 +31,9 @@ import static org.mockito.Mockito.when;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.model.c
itygml.building.Ab
str
a
ct
Boundary
Surface
;
import
org.citygml4j.
model.citygml.building.WallSurface
;
import
org.citygml4j.
core.model.construction.AbstractConstructionSurface
;
import
org.citygml4j.
core.
model.c
on
str
u
ct
ion.Wall
Surface
;
import
org.citygml4j.
core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
...
...
@@ -76,9 +76,9 @@ public class GeometryTest {
@Test
public
void
testRemovePolygonConcreteWithLink
()
{
ParserConfiguration
config
=
new
ParserConfiguration
(
4
,
false
);
Abstract
Boundary
Surface
abs
=
new
WallSurface
();
Abstract
Construction
Surface
abs
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
abs
);
org
.
citygml4j
.
model
.
citygml
.
building
.
BuildingInstallation
gmlBi
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
();
var
gmlBi
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
();
BuildingInstallation
bi
=
new
BuildingInstallation
();
bi
.
setGmlObject
(
gmlBi
);
Geometry
geom
=
new
Geometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
);
...
...
@@ -103,17 +103,17 @@ public class GeometryTest {
assertEquals
(
0
,
geom
.
getPolygons
().
size
());
assertEquals
(
0
,
biGeom
.
getPolygons
().
size
());
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
abs
.
getLod2MultiSurface
());
bi
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
assertNull
(
gmlBi
.
getLod2Geometry
());
bi
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
());
}
@Test
public
void
testRemovePolygonOnlyConcrete
()
{
ParserConfiguration
config
=
new
ParserConfiguration
(
4
,
false
);
Abstract
Boundary
Surface
abs
=
new
WallSurface
();
Abstract
Construction
Surface
abs
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
abs
);
Geometry
geom
=
new
Geometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
);
...
...
@@ -129,16 +129,16 @@ public class GeometryTest {
geom
.
removePolygon
(
p
);
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
abs
.
getLod2MultiSurface
());
}
@Test
public
void
testRemovePolygonLinked
()
{
ParserConfiguration
config
=
new
ParserConfiguration
(
4
,
false
);
Abstract
Boundary
Surface
abs
=
new
WallSurface
();
Abstract
Construction
Surface
abs
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
abs
);
org
.
citygml4j
.
model
.
citygml
.
building
.
BuildingInstallation
gmlBi
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
();
var
gmlBi
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
();
BuildingInstallation
bi
=
new
BuildingInstallation
();
bi
.
setGmlObject
(
gmlBi
);
Geometry
geom
=
new
Geometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
);
...
...
@@ -163,19 +163,19 @@ public class GeometryTest {
assertEquals
(
0
,
geom
.
getPolygons
().
size
());
assertEquals
(
0
,
biGeom
.
getPolygons
().
size
());
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
abs
.
getLod2MultiSurface
());
bi
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
assertNull
(
gmlBi
.
getLod2Geometry
());
bi
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
());
}
@Test
public
void
testReplacePolygon
()
{
ParserConfiguration
config
=
new
ParserConfiguration
(
4
,
false
);
Abstract
Boundary
Surface
abs
=
new
WallSurface
();
Abstract
Construction
Surface
abs
=
new
WallSurface
();
BoundarySurface
bs
=
new
BoundarySurface
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
WALL
,
abs
);
org
.
citygml4j
.
model
.
citygml
.
building
.
BuildingInstallation
gmlBi
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
();
var
gmlBi
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
();
BuildingInstallation
bi
=
new
BuildingInstallation
();
bi
.
setGmlObject
(
gmlBi
);
bi
.
addBoundarySurface
(
bs
);
...
...
@@ -185,6 +185,9 @@ public class GeometryTest {
LinearRing
lr
=
new
LinearRing
(
LinearRingType
.
EXTERIOR
);
p
.
setExteriorRing
(
lr
);
lr
.
addVertex
(
new
Vertex
(
0
,
0
,
0
));
lr
.
addVertex
(
new
Vertex
(
1
,
0
,
0
));
lr
.
addVertex
(
new
Vertex
(
2
,
0
,
0
));
lr
.
addVertex
(
new
Vertex
(
0
,
0
,
0
));
p
.
setPartOfSurface
(
bs
);
p
.
setPartOfInstallation
(
bi
);
bs
.
addGeometry
(
geom2
);
...
...
@@ -204,18 +207,18 @@ public class GeometryTest {
assertEquals
(
2
,
geom
.
getPolygons
().
size
());
assertEquals
(
2
,
geom2
.
getPolygons
().
size
());
bi
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
assertNull
(
gmlBi
.
getLod2Geometry
());
assertNull
(
gmlBi
.
getLod3Geometry
());
assertNull
(
gmlBi
.
getLod4Geometry
());
bi
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
());
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod3Geometry
());
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod4Geometry
());
bs
.
reCreateGeometries
(
new
GML
GeometryFactory
(),
config
);
bs
.
reCreateGeometries
(
GeometryFactory
.
newInstance
(),
config
);
assertNotNull
(
abs
.
getLod2MultiSurface
());
assertNotNull
(
abs
.
getLod2MultiSurface
().
get
MultiSurface
());
assertNotNull
(
abs
.
getLod2MultiSurface
().
get
MultiSurface
().
getSurfaceMember
());
assertFalse
(
abs
.
getLod2MultiSurface
().
get
MultiSurface
().
getSurfaceMember
().
isEmpty
());
assertEquals
(
2
,
abs
.
getLod2MultiSurface
().
get
MultiSurface
().
getSurfaceMember
().
size
());
assertNull
(
gmlBi
.
getLod2Geometry
());
assertNotNull
(
abs
.
getLod2MultiSurface
().
get
Object
());
assertNotNull
(
abs
.
getLod2MultiSurface
().
get
Object
().
getSurfaceMember
());
assertFalse
(
abs
.
getLod2MultiSurface
().
get
Object
().
getSurfaceMember
().
isEmpty
());
assertEquals
(
2
,
abs
.
getLod2MultiSurface
().
get
Object
().
getSurfaceMember
().
size
());
assertNull
(
gmlBi
.
getDeprecatedProperties
().
getLod2Geometry
());
}
@Test
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObjectTest.java
View file @
3f3c1884
...
...
@@ -24,20 +24,23 @@ import static org.junit.Assert.assertNull;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
never
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.transportation.AuxiliaryTrafficArea
;
import
org.citygml4j.model.citygml.transportation.AuxiliaryTrafficAreaProperty
;
import
org.citygml4j.model.citygml.transportation.Road
;
import
org.citygml4j.model.citygml.transportation.TrafficArea
;
import
org.citygml4j.model.citygml.transportation.TransportationComplex
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractThematicSurface
;
import
org.citygml4j.core.model.deprecated.transportation.DeprecatedPropertiesOfAbstractTransportationSpace
;
import
org.citygml4j.core.model.deprecated.transportation.TransportationComplex
;
import
org.citygml4j.core.model.transportation.AuxiliaryTrafficArea
;
import
org.citygml4j.core.model.transportation.AuxiliaryTrafficSpace
;
import
org.citygml4j.core.model.transportation.AuxiliaryTrafficSpaceProperty
;
import
org.citygml4j.core.model.transportation.Road
;
import
org.citygml4j.core.model.transportation.TrafficArea
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
...
...
@@ -58,25 +61,24 @@ public class TransportationObjectTest {
public
void
testReCreateGeometriesSolid
()
{
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
ROAD
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
SOLID
,
Lod
.
LOD1
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
}
@Test
public
void
testReCreateGeometriesWithComposedOf
()
{
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
ROAD
);
TransportationComplex
tcMock
=
mock
(
TransportationComplex
.
class
);
TransportationComplex
tcMock
=
new
TransportationComplex
(
);
to
.
setGmlObject
(
tcMock
);
TransportationObject
ataTo
=
new
TransportationObject
(
TransportationType
.
AUXILLIARY_TRAFFIC_
AREA
);
AuxiliaryTraffic
Area
ataMock
=
mock
(
AuxiliaryTraffic
Area
.
class
);
TransportationObject
ataTo
=
new
TransportationObject
(
TransportationType
.
AUXILLIARY_TRAFFIC_
SPACE
);
AuxiliaryTraffic
Space
ataMock
=
mock
(
AuxiliaryTraffic
Space
.
class
);
ataTo
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
ataTo
.
setGmlObject
(
ataMock
);
tcMock
.
add
AuxiliaryTraffic
Area
(
new
AuxiliaryTraffic
Area
Property
(
ataMock
));
tcMock
.
get
AuxiliaryTraffic
Spaces
().
add
(
new
AuxiliaryTraffic
Space
Property
(
ataMock
));
to
.
addChild
(
ataTo
);
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
tcMock
,
never
()).
setLod1MultiSurface
(
any
());
verify
(
ataMock
).
setLod2MultiSurface
(
any
());
}
...
...
@@ -85,11 +87,13 @@ public class TransportationObjectTest {
public
void
testReCreateGeometriesMultiSurfaceLod1
()
{
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
ROAD
);
Road
roadMock
=
mock
(
Road
.
class
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
roadMock
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod1MultiSurface
(
any
());
verify
(
dSpace
).
setLod1MultiSurface
(
any
());
}
@Test
...
...
@@ -98,7 +102,7 @@ public class TransportationObjectTest {
Road
roadMock
=
mock
(
Road
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod2MultiSurface
(
any
());
}
...
...
@@ -109,7 +113,7 @@ public class TransportationObjectTest {
Road
roadMock
=
mock
(
Road
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod3MultiSurface
(
any
());
}
...
...
@@ -118,11 +122,13 @@ public class TransportationObjectTest {
public
void
testReCreateGeometriesMultiSurfaceLod4
()
{
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
ROAD
);
Road
roadMock
=
mock
(
Road
.
class
);
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
roadMock
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod4MultiSurface
(
any
());
verify
(
dSpace
).
setLod4MultiSurface
(
any
());
}
@Test
(
expected
=
IllegalStateException
.
class
)
...
...
@@ -131,7 +137,7 @@ public class TransportationObjectTest {
Road
roadMock
=
mock
(
Road
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
}
...
...
@@ -141,7 +147,7 @@ public class TransportationObjectTest {
TrafficArea
roadMock
=
mock
(
TrafficArea
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD1
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
}
...
...
@@ -151,7 +157,7 @@ public class TransportationObjectTest {
TrafficArea
roadMock
=
mock
(
TrafficArea
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD2
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod2MultiSurface
(
any
());
}
...
...
@@ -162,7 +168,7 @@ public class TransportationObjectTest {
TrafficArea
roadMock
=
mock
(
TrafficArea
.
class
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD3
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod3MultiSurface
(
any
());
}
...
...
@@ -171,11 +177,13 @@ public class TransportationObjectTest {
public
void
testReCreateGeometriesTrafficAreaMultiSurfaceLod4
()
{
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
TRAFFIC_AREA
);
TrafficArea
roadMock
=
mock
(
TrafficArea
.
class
);
DeprecatedPropertiesOfAbstractThematicSurface
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
roadMock
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
to
.
setGmlObject
(
roadMock
);
to
.
addGeometry
(
GeometryTestUtils
.
createDummyGeometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD4
));
GML
GeometryFactory
factory
=
new
GML
GeometryFactory
();
GeometryFactory
factory
=
GeometryFactory
.
newInstance
();
to
.
reCreateGeometries
(
factory
,
mock
(
ParserConfiguration
.
class
));
verify
(
roadMock
).
setLod4MultiSurface
(
any
());
verify
(
dSpace
).
setLod4MultiSurface
(
any
());
}
@Test
...
...
@@ -226,15 +234,17 @@ public class TransportationObjectTest {
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
ROAD
);
Road
r
=
mock
(
Road
.
class
);
to
.
setGmlObject
(
r
);
r
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
DeprecatedPropertiesOfAbstractTransportationSpace
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractTransportationSpace
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
dSpace
.
setLod1MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
to
.
unsetGmlGeometries
();
assertNull
(
r
.
getLod1MultiSurface
());
assertNull
(
dSpace
.
getLod1MultiSurface
());
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
r
.
getLod4MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
@Test
...
...
@@ -242,13 +252,15 @@ public class TransportationObjectTest {
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
TRAFFIC_AREA
);
TrafficArea
r
=
mock
(
TrafficArea
.
class
);
to
.
setGmlObject
(
r
);
DeprecatedPropertiesOfAbstractThematicSurface
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
to
.
unsetGmlGeometries
();
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
r
.
getLod4MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
@Test
...
...
@@ -256,13 +268,15 @@ public class TransportationObjectTest {
TransportationObject
to
=
new
TransportationObject
(
TransportationType
.
AUXILLIARY_TRAFFIC_AREA
);
AuxiliaryTrafficArea
r
=
mock
(
AuxiliaryTrafficArea
.
class
);
to
.
setGmlObject
(
r
);
DeprecatedPropertiesOfAbstractThematicSurface
dSpace
=
mock
(
DeprecatedPropertiesOfAbstractThematicSurface
.
class
);
when
(
r
.
getDeprecatedProperties
()).
thenReturn
(
dSpace
);
r
.
setLod2MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod3MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
r
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
dSpace
.
setLod4MultiSurface
(
mock
(
MultiSurfaceProperty
.
class
));
to
.
unsetGmlGeometries
();
assertNull
(
r
.
getLod2MultiSurface
());
assertNull
(
r
.
getLod3MultiSurface
());
assertNull
(
r
.
getLod4MultiSurface
());
assertNull
(
dSpace
.
getLod4MultiSurface
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/mapper/FeatureMapperTest.java
View file @
3f3c1884
...
...
@@ -26,18 +26,19 @@ import static org.mockito.Mockito.mock;
import
java.io.File
;
import
java.io.IOException
;
import
org.citygml4j.model.citygml.vegetation.PlantCover
;
import
org.citygml4j.model.citygml.waterbody.WaterBody
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurface
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.model.gml.geometry.primitives.Coord
;
import
org.citygml4j.model.gml.geometry.primitives.Exterior
;
import
org.citygml4j.model.gml.geometry.primitives.LinearRing
;
import
org.citygml4j.model.gml.geometry.primitives.Polygon
;
import
org.citygml4j.model.gml.geometry.primitives.SurfaceProperty
;
import
org.citygml4j.core.model.vegetation.PlantCover
;
import
org.citygml4j.core.model.waterbody.WaterBody
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
import
org.xmlobjects.gml.model.geometry.DirectPosition
;
import
org.xmlobjects.gml.model.geometry.GeometricPosition
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractRingProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.LinearRing
;
import
org.xmlobjects.gml.model.geometry.primitives.Polygon
;
import
org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
...
...
@@ -45,6 +46,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.datastructure.WaterObject
;
import
de.hft.stuttgart.citydoctor2.mapper.citygml3.Citygml3FeatureMapper
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
/**
...
...
@@ -56,11 +58,12 @@ public class FeatureMapperTest {
@Rule
public
TemporaryFolder
folder
=
new
TemporaryFolder
();
@Test
public
void
testVisitWaterBody
()
{
WaterBody
body
=
new
WaterBody
();
FeatureMapper
mapper
=
new
FeatureMapper
(
mock
(
ParserConfiguration
.
class
),
new
File
(
""
));
Citygml3FeatureMapper
mapper
=
new
Citygml3FeatureMapper
(
mock
(
ParserConfiguration
.
class
),
new
File
(
""
).
toPath
());
mapper
.
visit
(
body
);
assertEquals
(
1
,
mapper
.
getModel
().
getWater
().
size
());
body
.
setId
(
"test1"
);
...
...
@@ -68,35 +71,36 @@ public class FeatureMapperTest {
assertEquals
(
2
,
mapper
.
getModel
().
getWater
().
size
());
WaterObject
waterObject
=
mapper
.
getModel
().
getWater
().
get
(
1
);
assertEquals
(
"test1"
,
waterObject
.
getGmlId
().
getGmlString
());
body
.
setLod1MultiSurface
(
createDummyMsp
());
body
.
getDeprecatedProperties
().
setLod1MultiSurface
(
createDummyMsp
());
mapper
.
visit
(
body
);
assertEquals
(
3
,
mapper
.
getModel
().
getWater
().
size
());
assertNull
(
body
.
getLod1MultiSurface
());
assertNull
(
body
.
getDeprecatedProperties
().
getLod1MultiSurface
());
Geometry
geometry
=
mapper
.
getModel
().
getWater
().
get
(
2
).
getGeometries
().
get
(
0
);
assertEquals
(
1
,
geometry
.
getPolygons
().
size
());
assertEquals
(
Lod
.
LOD1
,
geometry
.
getLod
());
assertEquals
(
GeometryType
.
MULTI_SURFACE
,
geometry
.
getType
());
}
@Test
public
void
testVisitPlantCover
()
{
PlantCover
cover
=
new
PlantCover
();
FeatureMapper
mapper
=
new
FeatureMapper
(
mock
(
ParserConfiguration
.
class
),
new
File
(
""
));
Citygml3FeatureMapper
mapper
=
new
Citygml3FeatureMapper
(
mock
(
ParserConfiguration
.
class
),
new
File
(
""
).
toPath
());
mapper
.
visit
(
cover
);
}
private
MultiSurfaceProperty
createDummyMsp
()
{
LinearRing
ext
=
new
LinearRing
();
ext
.
addCoor
d
(
createCoord
(
0
,
0
,
0
));
ext
.
addCoor
d
(
createCoord
(
10
,
0
,
0
));
ext
.
addCoor
d
(
createCoord
(
10
,
10
,
0
));
ext
.
addCoor
d
(
createCoord
(
0
,
10
,
0
));
ext
.
addCoor
d
(
createCoord
(
0
,
0
,
0
));
ext
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
0
,
0
));
ext
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
10
,
0
,
0
));
ext
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
10
,
10
,
0
));
ext
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
10
,
0
));
ext
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
0
,
0
));
Polygon
p
=
new
Polygon
();
p
.
setExterior
(
new
Exterior
(
ext
));
p
.
setExterior
(
new
AbstractRingProperty
(
ext
));
MultiSurface
ms
=
new
MultiSurface
();
ms
.
add
SurfaceMember
(
new
SurfaceProperty
(
p
));
ms
.
get
SurfaceMember
(
).
add
(
new
SurfaceProperty
(
p
));
return
new
MultiSurfaceProperty
(
ms
);
}
...
...
@@ -105,20 +109,22 @@ public class FeatureMapperTest {
WaterBody
body
=
new
WaterBody
();
Polygon
p
=
new
Polygon
();
LinearRing
ring
=
new
LinearRing
();
Coord
coord
=
createCoord
(
0
,
0.0000000049
,
0
);
ring
.
addCoor
d
(
coord
);
p
.
setExterior
(
new
Exterior
(
ring
));
GeometricPosition
coord
=
createCoord
(
0
,
0.0000000049
,
0
);
ring
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
coord
);
p
.
setExterior
(
new
AbstractRingProperty
(
ring
));
Polygon
p2
=
new
Polygon
();
LinearRing
ring2
=
new
LinearRing
();
coord
=
createCoord
(
0
,
0.0000000050
,
0
);
ring2
.
addCoord
(
coord
);
p2
.
setExterior
(
new
Exterior
(
ring2
));
MultiSurface
ms
=
new
MultiSurface
(
p
,
p2
);
body
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ring2
.
getControlPoints
().
getGeometricPositions
().
add
(
coord
);
p2
.
setExterior
(
new
AbstractRingProperty
(
ring2
));
MultiSurface
ms
=
new
MultiSurface
();
ms
.
getSurfaceMember
().
add
(
new
SurfaceProperty
(
p
));
ms
.
getSurfaceMember
().
add
(
new
SurfaceProperty
(
p2
));
body
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
FeatureMapper
mapper
=
new
FeatureMapper
(
config
,
folder
.
newFile
());
Citygml3
FeatureMapper
mapper
=
new
Citygml3
FeatureMapper
(
config
,
folder
.
newFile
()
.
toPath
()
);
mapper
.
visit
(
body
);
CityDoctorModel
model
=
mapper
.
getModel
();
...
...
@@ -135,17 +141,18 @@ public class FeatureMapperTest {
WaterBody
body
=
new
WaterBody
();
Polygon
p
=
new
Polygon
();
LinearRing
ring
=
new
LinearRing
();
Coord
coord
=
createCoord
(
0
,
0.0000000049
,
0
);
ring
.
addCoor
d
(
coord
);
GeometricPosition
coord
=
createCoord
(
0
,
0.0000000049
,
0
);
ring
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
coord
);
coord
=
createCoord
(
0
,
0.0000000150
,
0
);
ring
.
addCoord
(
coord
);
p
.
setExterior
(
new
Exterior
(
ring
));
MultiSurface
ms
=
new
MultiSurface
(
p
);
body
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ring
.
getControlPoints
().
getGeometricPositions
().
add
(
coord
);
p
.
setExterior
(
new
AbstractRingProperty
(
ring
));
MultiSurface
ms
=
new
MultiSurface
();
ms
.
getSurfaceMember
().
add
(
new
SurfaceProperty
(
p
));
body
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
FeatureMapper
mapper
=
new
FeatureMapper
(
config
,
folder
.
newFile
());
Citygml3
FeatureMapper
mapper
=
new
Citygml3
FeatureMapper
(
config
,
folder
.
newFile
()
.
toPath
()
);
mapper
.
visit
(
body
);
CityDoctorModel
model
=
mapper
.
getModel
();
...
...
@@ -168,29 +175,31 @@ public class FeatureMapperTest {
WaterBody
body
=
new
WaterBody
();
Polygon
p1
=
new
Polygon
();
LinearRing
ring1
=
new
LinearRing
();
p1
.
setExterior
(
new
Exterior
(
ring1
));
ring1
.
addCoor
d
(
createCoord
(
0
,
0
,
0
));
ring1
.
addCoor
d
(
createCoord
(
1
,
0
,
0
));
ring1
.
addCoor
d
(
createCoord
(
1
,
1
,
0
));
ring1
.
addCoor
d
(
createCoord
(
1
,
2
,
0
));
ring1
.
addCoor
d
(
createCoord
(
0
,
2
,
0
));
ring1
.
addCoor
d
(
createCoord
(
0
,
0
,
0
));
p1
.
setExterior
(
new
AbstractRingProperty
(
ring1
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
0
,
0
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
0
,
0
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
1
,
0
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
2
,
0
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
2
,
0
));
ring1
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
0
,
0
,
0
));
Polygon
p2
=
new
Polygon
();
LinearRing
ring2
=
new
LinearRing
();
p2
.
setExterior
(
new
Exterior
(
ring2
));
ring2
.
addCoor
d
(
createCoord
(
1
,
0
,
0
));
ring2
.
addCoor
d
(
createCoord
(
2
,
0
,
0
));
ring2
.
addCoor
d
(
createCoord
(
2
,
2
,
0
));
ring2
.
addCoor
d
(
createCoord
(
1
,
2
,
0
));
ring2
.
addCoor
d
(
createCoord
(
1
,
1.0000000050
,
0
));
ring2
.
addCoor
d
(
createCoord
(
1
,
0
,
0
));
p2
.
setExterior
(
new
AbstractRingProperty
(
ring2
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
0
,
0
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
2
,
0
,
0
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
2
,
2
,
0
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
2
,
0
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
1.0000000050
,
0
));
ring2
.
getControlPoints
().
getGeometricPositions
().
ad
d
(
createCoord
(
1
,
0
,
0
));
MultiSurface
ms
=
new
MultiSurface
(
p1
,
p2
);
body
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
MultiSurface
ms
=
new
MultiSurface
();
ms
.
getSurfaceMember
().
add
(
new
SurfaceProperty
(
p1
));
ms
.
getSurfaceMember
().
add
(
new
SurfaceProperty
(
p2
));
body
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
FeatureMapper
mapper
=
new
FeatureMapper
(
config
,
folder
.
newFile
());
Citygml3
FeatureMapper
mapper
=
new
Citygml3
FeatureMapper
(
config
,
folder
.
newFile
()
.
toPath
()
);
mapper
.
visit
(
body
);
CityDoctorModel
model
=
mapper
.
getModel
();
...
...
@@ -201,12 +210,8 @@ public class FeatureMapperTest {
assertEquals
(
8
,
geometry
.
getEdges
().
size
());
}
private
Coord
createCoord
(
double
x
,
double
y
,
double
z
)
{
Coord
coord
=
new
Coord
();
coord
.
setX
(
x
);
coord
.
setY
(
y
);
coord
.
setZ
(
z
);
return
coord
;
private
GeometricPosition
createCoord
(
double
x
,
double
y
,
double
z
)
{
return
new
GeometricPosition
(
new
DirectPosition
(
x
,
y
,
z
));
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/mapper/GeometryMapperTest.java
View file @
3f3c1884
...
...
@@ -20,24 +20,19 @@ package de.hft.stuttgart.citydoctor2.mapper;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.citygml4j.model.gml.geometry.primitives.Coord
;
import
org.citygml4j.model.gml.geometry.primitives.Exterior
;
import
org.citygml4j.model.gml.geometry.primitives.LinearRing
;
import
org.citygml4j.model.gml.geometry.primitives.Polygon
;
import
org.junit.Test
;
import
org.xmlobjects.gml.model.geometry.DirectPosition
;
import
org.xmlobjects.gml.model.geometry.GeometricPosition
;
import
org.xmlobjects.gml.model.geometry.primitives.AbstractRingProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.LinearRing
;
import
org.xmlobjects.gml.model.geometry.primitives.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
import
de.hft.stuttgart.citydoctor2.datastructure.Lod
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.mapper.citygml3.Citygml3GeometryMapper
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.Pair
;
/**
*
...
...
@@ -50,25 +45,16 @@ public class GeometryMapperTest {
public
void
testRounding
()
{
Polygon
p
=
new
Polygon
();
LinearRing
ring
=
new
LinearRing
();
Coord
coord
=
new
Coord
();
coord
.
setX
(
0
d
);
coord
.
setY
(
0.0000000049d
);
coord
.
setZ
(
0
d
);
ring
.
addCoord
(
coord
);
GeometricPosition
coord
=
new
GeometricPosition
(
new
DirectPosition
(
0
d
,
0.0000000049d
,
0
d
));
ring
.
getControlPoints
().
getGeometricPositions
().
add
(
coord
);
coord
=
new
Coord
();
coord
.
setX
(
0
d
);
coord
.
setY
(
0.0000000050d
);
coord
.
setZ
(
0
d
);
ring
.
addCoord
(
coord
);
p
.
setExterior
(
new
Exterior
(
ring
));
coord
=
new
GeometricPosition
(
new
DirectPosition
(
0
d
,
0.0000000050d
,
0
d
));
ring
.
getControlPoints
().
getGeometricPositions
().
add
(
coord
);
p
.
setExterior
(
new
AbstractRingProperty
(
ring
));
Geometry
geom
=
new
Geometry
(
GeometryType
.
MULTI_SURFACE
,
Lod
.
LOD0
);
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
Map
<
String
,
ConcretePolygon
>
polygons
=
new
HashMap
<>();
List
<
Pair
<
String
,
Geometry
>>
linkedPolygons
=
new
ArrayList
<>();
Map
<
Vertex
,
Vertex
>
vertices
=
new
HashMap
<>();
GeometryMapper
mapper
=
new
GeometryMapper
(
geom
,
config
,
polygons
,
linkedPolygons
,
vertices
);
Citygml3
GeometryMapper
mapper
=
new
Citygml3
GeometryMapper
(
config
,
vertices
);
mapper
.
visit
(
p
);
assertEquals
(
2
,
vertices
.
size
());
}
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/parser/CityGml3ParserTest.java
0 → 100644
View file @
3f3c1884
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.parser
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
java.util.List
;
import
org.citygml4j.core.ade.ADE
;
import
org.citygml4j.core.ade.ADERegistry
;
import
org.citygml4j.xml.CityGMLContext
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.quality.QualityADEContext
;
public
class
CityGml3ParserTest
{
@Test
public
void
testGetContext
()
{
CityGMLContext
context
=
CityGmlParser
.
getContext
();
List
<
ADE
>
ades
=
ADERegistry
.
getInstance
().
getADEs
();
ADE
ade
=
ades
.
get
(
0
);
assertEquals
(
QualityADEContext
.
class
,
ade
.
getClass
());
assertNotNull
(
context
);
}
@Test
public
void
testParseFileWithoutValidation
()
throws
CityGmlParseException
,
InvalidGmlFileException
{
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
CityDoctorModel
model
=
CityGmlParser
.
parseCityGmlFile
(
"src/test/resources/SimpleSolid_SrefBS.gml"
,
config
);
assertNotNull
(
model
);
List
<
Building
>
buildings
=
model
.
getBuildings
();
assertEquals
(
1
,
buildings
.
size
());
Building
building
=
buildings
.
get
(
0
);
assertEquals
(
"_Simple_BD.1"
,
building
.
getGmlId
().
getGmlString
());
List
<
BoundarySurface
>
surfaces
=
building
.
getBoundarySurfaces
();
assertEquals
(
6
,
surfaces
.
size
());
}
}
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/utils/QualityADEUtilsTest.java
View file @
3f3c1884
...
...
@@ -23,8 +23,8 @@ import static org.junit.Assert.assertFalse;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.List
;
import
java.util.UUID
;
import
org.citygml4j.model.citygml.ade.ADEComponent
;
import
org.junit.Test
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
...
...
@@ -32,26 +32,30 @@ import de.hft.stuttgart.citydoctor2.check.CheckResult;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.quality.model.ValidationResult
;
import
de.hft.stuttgart.quality.model.jaxb.ResultType
;
import
de.hft.stuttgart.quality.model.enums.ResultType
;
import
de.hft.stuttgart.quality.model.types.CityObjectProperties
;
import
de.hft.stuttgart.quality.model.types.Validation
;
import
de.hft.stuttgart.quality.model.types.ValidationResult
;
public
class
QualityADEUtilsTest
{
@Test
public
void
testWriteQualityADE
()
{
Building
b
=
new
Building
();
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
gmlB
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
Building
();
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
gmlB
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
Building
();
b
.
setGmlObject
(
gmlB
);
List
<
ADEComponent
>
coADE
=
gmlB
.
getGenericApplication
Propert
yOf
CityObject
(
);
List
<
CityObjectProperties
>
coADE
=
gmlB
.
getADE
Propert
ies
(
CityObject
Properties
.
class
);
assertTrue
(
coADE
.
isEmpty
());
Validation
val
=
new
Validation
();
val
.
setId
(
UUID
.
randomUUID
().
toString
());
b
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_GE_P_HOLE_OUTSIDE
,
ResultStatus
.
ERROR
,
new
UnknownCheckError
(
b
,
new
NullPointerException
(),
CheckId
.
C_GE_P_HOLE_OUTSIDE
)));
QualityADEUtils
.
writeQualityAde
(
b
);
coADE
=
gmlB
.
get
GenericApplication
Propert
yOf
CityObject
(
);
QualityADEUtils
.
writeQualityAde
(
b
,
val
);
coADE
=
gmlB
.
get
ADE
Propert
ies
(
CityObject
Properties
.
class
);
assertFalse
(
coADE
.
isEmpty
());
assertEquals
(
1
,
coADE
.
size
());
ADEComponent
adeComponent
=
coADE
.
get
(
0
);
ValidationResult
valResult
=
(
ValidationResult
)
adeComponent
;
assertEquals
(
ResultType
.
NOT_CHECKED
,
valResult
.
getResult
());
CityObjectProperties
adeComponent
=
coADE
.
get
(
0
);
ValidationResult
valResult
=
adeComponent
.
get
ValidationResult
().
getObject
()
;
assertEquals
(
ResultType
.
NOT_CHECKED
,
valResult
.
getResult
Type
());
}
}
CityDoctorParent/CityDoctorModel/src/test/resources/SimpleSolid_SrefBS.gml
0 → 100644
View file @
3f3c1884
<?xml version="1.0" encoding="utf-8"?>
<core:CityModel
xmlns:core=
"http://www.opengis.net/citygml/2.0"
xmlns:gen=
"http://www.opengis.net/citygml/generics/2.0"
xmlns:bldg=
"http://www.opengis.net/citygml/building/2.0"
xmlns:app=
"http://www.opengis.net/citygml/appearance/2.0"
xmlns:dem=
"http://www.opengis.net/citygml/relief/2.0"
xmlns:gml=
"http://www.opengis.net/gml"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd"
>
<!--
Einfaches Gebäude mit Grundriss 3m x 5m und Satteldach, Traufhöhe 3m, Firsthöhe 4,5m
Modelliert mit Begrenzungsflächen (eine Dachfläche, 4 Wandflächen, 1 Grundfläche),
die Gebäudegeometrie als Solid, der auf die Polygone der Begrenzungsflächen referenziert
CityGML 2.0
Gebäudevolumen: 56,25 m3
10.5.2017
Author: V. Coors, HFT Stuttgart
Lizenz:
-->
<core:cityObjectMember>
<bldg:Building
gml:id=
"_Simple_BD.1"
>
<bldg:lod2Solid>
<gml:Solid>
<gml:exterior>
<gml:CompositeSurface>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.1"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.2"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.3"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.4"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.5"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.6"
/>
<gml:surfaceMember
xlink:href=
"#_Simple_BD.1_PG.7"
/>
</gml:CompositeSurface>
</gml:exterior>
</gml:Solid>
</bldg:lod2Solid>
<bldg:boundedBy>
<bldg:WallSurface
gml:id=
"_Simple_BD.1_WallSurface_1"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.2"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.2_LR.1"
>
<gml:posList
srsDimension=
"3"
>
13.0 15.0 0.0
13.0 15.0 3.0
13.0 10.0 3.0
13.0 10.0 0.0
13.0 15.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface
gml:id=
"_Simple_BD.1_WallSurface_2"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.3"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.3_LR.1"
>
<gml:posList
srsDimension=
"3"
>
10.0 15.0 0.0
10.0 15.0 3.0
11.5 15.0 4.5
13.0 15.0 3.0
13.0 15.0 0.0
10.0 15.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface
gml:id=
"_Simple_BD.1_WallSurface_3"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.4"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.4_LR.1"
>
<gml:posList
srsDimension=
"3"
>
10.0 10.0 3.0
10.0 15.0 3.0
10.0 15.0 0.0
10.0 10.0 0.0
10.0 10.0 3.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:WallSurface
gml:id=
"_Simple_BD.1_WallSurface_4"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.5"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.5_LR.1"
>
<gml:posList
srsDimension=
"3"
>
13.0 10.0 0.0
13.0 10.0 3.0
11.5 10.0 4.5
10.0 10.0 3.0
10.0 10.0 0.0
13.0 10.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:WallSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:RoofSurface
gml:id=
"_Simple_BD.1_RoofSurface_1"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.6"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.6_LR.1"
>
<gml:posList
srsDimension=
"3"
>
10.0 10.0 3.0
11.5 10.0 4.5
11.5 15.0 4.5
10.0 15.0 3.0
10.0 10.0 3.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.7"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.7_LR.1"
>
<gml:posList
srsDimension=
"3"
>
11.5 10.0 4.5
13.0 10.0 3.0
13.0 15.0 3.0
11.5 15.0 4.5
11.5 10.0 4.5
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:RoofSurface>
</bldg:boundedBy>
<bldg:boundedBy>
<bldg:GroundSurface
gml:id=
"_Simple_BD.1_GroundSurface_1"
>
<bldg:lod2MultiSurface>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon
gml:id=
"_Simple_BD.1_PG.1"
>
<gml:exterior>
<gml:LinearRing
gml:id=
"_Simple_BD.1_PG.1_LR.1"
>
<gml:posList
srsDimension=
"3"
>
10.0 10.0 0.0
10.0 15.0 0.0
13.0 15.0 0.0
13.0 10.0 0.0
10.0 10.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</bldg:lod2MultiSurface>
</bldg:GroundSurface>
</bldg:boundedBy>
</bldg:Building>
</core:cityObjectMember>
</core:CityModel>
\ No newline at end of file
CityDoctorParent/CityDoctorValidation/pom.xml
View file @
3f3c1884
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
<version>
3.1
0.3
</version>
<version>
3.1
1.0
</version>
</parent>
<artifactId>
CityDoctorValidation
</artifactId>
<name>
CityDoctorValidation
</name>
...
...
@@ -27,10 +27,6 @@
<groupId>
net.sf.saxon
</groupId>
<artifactId>
Saxon-HE
</artifactId>
</dependency>
<dependency>
<groupId>
org.citygml4j
</groupId>
<artifactId>
citygml4j
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java
View file @
3f3c1884
...
...
@@ -25,13 +25,12 @@ import java.util.List;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
org.citygml4j.core.ade.ADEException
;
import
de.hft.stuttgart.citydoctor2.check.Checker
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.parameter.ArgumentParser
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
...
...
@@ -63,11 +62,9 @@ public class CityDoctorValidation {
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws CityGMLWriteException
* @throws CityGMLBuilderException
* @throws ADEException
* @throws CityDoctorWriteException
*/
public
static
void
main
(
String
[]
args
)
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
City
GMLBuilderException
,
CityGMLWriteException
,
ADE
Exception
{
public
static
void
main
(
String
[]
args
)
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
City
DoctorWrite
Exception
{
ArgumentParser
argParser
=
new
ArgumentParser
(
args
);
String
inputFile
=
getInputFile
(
argParser
);
String
xmlOutput
=
getXmlOutput
(
argParser
);
...
...
@@ -109,10 +106,9 @@ public class CityDoctorValidation {
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws ADEException
*/
public
static
void
validate
(
File
inputFile
,
File
xmlOutput
,
File
pdfOutput
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
ADEException
{
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
validate
(
inputFile
,
xmlOutput
,
pdfOutput
,
null
);
}
...
...
@@ -129,10 +125,9 @@ public class CityDoctorValidation {
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws ADEException
*/
public
static
void
validate
(
File
inputFile
,
File
xmlOutput
,
File
pdfOutput
,
File
validationConfigFile
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
ADEException
{
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
ValidationConfiguration
config
;
if
(
validationConfigFile
==
null
)
{
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
...
...
@@ -150,7 +145,7 @@ public class CityDoctorValidation {
}
try
{
startValidationProcess
(
inputFile
,
xmlOutputPath
,
pdfOutputPath
,
config
,
null
);
}
catch
(
City
GMLBuilderException
|
CityGML
WriteException
e
)
{
}
catch
(
City
Doctor
WriteException
e
)
{
// this does not happen as no output file is specified
logger
.
catching
(
e
);
}
...
...
@@ -164,17 +159,14 @@ public class CityDoctorValidation {
* @param pdfOutput the output path for the pdf report (optional)
* @param config the configuration path for the validation plan
* @param outputFile storing the validated gml file with quality ade
* @throws IOException
* @throws CityGmlParseException
* @throws InvalidGmlFileException
* @throws CityGMLWriteException if something goes wrong while writing the gml
* @throws CityDoctorWriteException if something goes wrong while writing the gml
* file
* @throws CityGMLBuilderException
* @throws ADEException
*/
public
static
void
startValidationProcess
(
File
inputFile
,
String
xmlOutput
,
String
pdfOutput
,
ValidationConfiguration
config
,
String
outputFile
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
City
GMLBuilderException
,
CityGMLWriteException
,
ADE
Exception
{
InvalidGmlFileException
,
City
DoctorWrite
Exception
{
if
(
config
.
isUseStreaming
())
{
Checker
.
streamCheck
(
inputFile
,
xmlOutput
,
pdfOutput
,
config
,
outputFile
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
View file @
3f3c1884
...
...
@@ -74,12 +74,16 @@ import de.hft.stuttgart.citydoctor2.reporting.XmlValidationReporter;
import
de.hft.stuttgart.citydoctor2.reporting.pdf.PdfReporter
;
import
de.hft.stuttgart.citydoctor2.reporting.pdf.PdfStreamReporter
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
de.hft.stuttgart.quality.model.jaxb.Checking
;
import
de.hft.stuttgart.quality.model.jaxb.Parameter
;
import
de.hft.stuttgart.quality.model.jaxb.Requirement
;
import
de.hft.stuttgart.quality.model.jaxb.RequirementId
;
import
de.hft.stuttgart.quality.model.jaxb.TopLevelFeatureType
;
import
de.hft.stuttgart.quality.model.jaxb.ValidationPlan
;
import
de.hft.stuttgart.quality.model.enums.RequirementId
;
import
de.hft.stuttgart.quality.model.enums.TopLevelFeatureType
;
import
de.hft.stuttgart.quality.model.properties.CheckingProperty
;
import
de.hft.stuttgart.quality.model.properties.FilterProperty
;
import
de.hft.stuttgart.quality.model.properties.GlobalParametersProperty
;
import
de.hft.stuttgart.quality.model.properties.ParameterProperty
;
import
de.hft.stuttgart.quality.model.properties.RequirementProperty
;
import
de.hft.stuttgart.quality.model.types.Checking
;
import
de.hft.stuttgart.quality.model.types.Parameter
;
import
de.hft.stuttgart.quality.model.types.ValidationPlan
;
import
net.sf.saxon.s9api.DOMDestination
;
import
net.sf.saxon.s9api.Destination
;
import
net.sf.saxon.s9api.Processor
;
...
...
@@ -242,7 +246,8 @@ public class Checker {
ValidationPlan
createValidationPlan
()
{
ValidationPlan
plan
=
new
ValidationPlan
();
List
<
Checking
>
filter
=
createFilter
();
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
filter
=
createFilter
();
plan
.
setFilter
(
new
FilterProperty
(
filter
));
Map
<
String
,
de
.
hft
.
stuttgart
.
citydoctor2
.
check
.
Requirement
>
reqs
=
Checks
.
getAvailableRequirements
();
for
(
Entry
<
String
,
RequirementConfiguration
>
e
:
config
.
getRequirements
().
entrySet
())
{
...
...
@@ -250,10 +255,10 @@ public class Checker {
if
(
reqId
==
null
)
{
continue
;
}
Requirement
req
=
new
Requirement
();
req
.
set
Nam
e
(
reqId
);
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
req
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
();
req
.
set
RequirementTyp
e
(
reqId
);
req
.
setEnabled
(
e
.
getValue
().
isEnabled
());
plan
.
getRequirements
().
add
(
req
);
plan
.
getRequirements
().
add
(
new
RequirementProperty
(
req
)
)
;
Map
<
String
,
String
>
parameters
=
e
.
getValue
().
getParameters
();
if
(
parameters
!=
null
)
{
for
(
Entry
<
String
,
String
>
param
:
parameters
.
entrySet
())
{
...
...
@@ -264,21 +269,20 @@ public class Checker {
}
p
.
setName
(
param
.
getKey
());
p
.
setValue
(
param
.
getValue
());
req
.
getParameters
().
add
(
p
);
req
.
getParameters
().
add
(
new
ParameterProperty
(
p
)
);
}
}
}
Requirement
missing
=
new
Requirement
();
missing
.
set
Nam
e
(
RequirementId
.
R_SE_ATTRIBUTES_EXISTING
);
Requirement
correct
=
new
Requirement
();
correct
.
set
Nam
e
(
RequirementId
.
R_SE_ATTRIBUTES_CORRECT
);
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
missing
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
();
missing
.
set
RequirementTyp
e
(
RequirementId
.
R_SE_ATTRIBUTES_EXISTING
);
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
correct
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Requirement
();
correct
.
set
RequirementTyp
e
(
RequirementId
.
R_SE_ATTRIBUTES_CORRECT
);
missing
.
setEnabled
(
config
.
getSchematronFilePath
()
!=
null
);
correct
.
setEnabled
(
config
.
getSchematronFilePath
()
!=
null
);
plan
.
getRequirements
().
add
(
missing
);
plan
.
getRequirements
().
add
(
correct
);
plan
.
getRequirements
().
add
(
new
RequirementProperty
(
missing
)
)
;
plan
.
getRequirements
().
add
(
new
RequirementProperty
(
correct
)
)
;
plan
.
getFilter
().
addAll
(
filter
);
Parameter
numRounding
=
new
Parameter
();
numRounding
.
setName
(
"numberOfRoundingPlaces"
);
numRounding
.
setValue
(
""
+
config
.
getNumberOfRoundingPlaces
());
...
...
@@ -289,9 +293,11 @@ public class Checker {
Parameter
schematronFile
=
new
Parameter
();
schematronFile
.
setName
(
"schematronFile"
);
schematronFile
.
setValue
(
config
.
getSchematronFilePath
());
plan
.
getGlobalParameters
().
add
(
numRounding
);
plan
.
getGlobalParameters
().
add
(
minVertexDistance
);
plan
.
getGlobalParameters
().
add
(
schematronFile
);
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
GlobalParameters
globParams
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
GlobalParameters
();
plan
.
setGlobalParameters
(
new
GlobalParametersProperty
(
globParams
));
globParams
.
getParameters
().
add
(
new
ParameterProperty
(
numRounding
));
globParams
.
getParameters
().
add
(
new
ParameterProperty
(
minVertexDistance
));
globParams
.
getParameters
().
add
(
new
ParameterProperty
(
schematronFile
));
return
plan
;
}
...
...
@@ -308,8 +314,8 @@ public class Checker {
return
null
;
}
private
List
<
Checking
>
createFilter
()
{
List
<
Checking
>
filter
=
new
ArrayList
<>
();
private
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
createFilter
()
{
var
filter
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
();
handleInputFilter
(
filter
);
if
(
excludeFilters
!=
null
)
{
for
(
Filter
f
:
excludeFilters
)
{
...
...
@@ -327,23 +333,24 @@ public class Checker {
return
filter
;
}
private
void
handleInputFilter
(
List
<
Checking
>
filter
)
{
private
void
handleInputFilter
(
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
filter
)
{
if
(
includeFilters
==
null
||
includeFilters
.
isEmpty
())
{
// no filter means, use all
addAllFilters
(
filter
);
}
else
{
for
(
Filter
f
:
includeFilters
)
{
if
(
f
instanceof
TypeFilter
)
{
TypeFilter
tf
=
(
TypeFilter
)
f
;
if
(
f
instanceof
TypeFilter
tf
)
{
FeatureType
type
=
tf
.
getType
();
TopLevelFeatureType
tlft
=
mapToTopLevelFeatureType
(
type
);
if
(
tlft
==
null
)
{
continue
;
}
filter
.
add
(
new
Checking
(
tlft
));
Checking
c
=
new
Checking
();
c
.
setFeatureType
(
tlft
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
c
));
}
}
if
(
filter
.
isEmpty
())
{
if
(
filter
.
getChecking
().
isEmpty
())
{
// this happens if no type include filter was used
// it is possible only single objects were tested then
// so include everything
...
...
@@ -352,19 +359,36 @@ public class Checker {
}
}
private
void
addAllFilters
(
List
<
Checking
>
filter
)
{
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
BUILDING
));
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
BRIDGE
));
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
LAND
));
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
TRANSPORTATION
));
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
VEGETATION
));
filter
.
add
(
new
Checking
(
TopLevelFeatureType
.
WATER
));
private
void
addAllFilters
(
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
filter
)
{
Checking
buildingChecking
=
new
Checking
();
buildingChecking
.
setFeatureType
(
TopLevelFeatureType
.
BUILDING
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
buildingChecking
));
Checking
bridgeChecking
=
new
Checking
();
bridgeChecking
.
setFeatureType
(
TopLevelFeatureType
.
BRIDGE
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
bridgeChecking
));
Checking
landChecking
=
new
Checking
();
landChecking
.
setFeatureType
(
TopLevelFeatureType
.
LAND
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
landChecking
));
Checking
transportationChecking
=
new
Checking
();
transportationChecking
.
setFeatureType
(
TopLevelFeatureType
.
TRANSPORTATION
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
transportationChecking
));
Checking
vegetationChecking
=
new
Checking
();
vegetationChecking
.
setFeatureType
(
TopLevelFeatureType
.
VEGETATION
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
vegetationChecking
));
Checking
waterChecking
=
new
Checking
();
waterChecking
.
setFeatureType
(
TopLevelFeatureType
.
WATER
);
filter
.
getChecking
().
add
(
new
CheckingProperty
(
waterChecking
));
}
private
void
removeFilter
(
TopLevelFeatureType
tlft
,
List
<
Checking
>
filter
)
{
for
(
Checking
c
:
filter
)
{
if
(
c
.
get
Valu
e
().
equals
(
tlft
))
{
filter
.
remove
(
c
);
private
void
removeFilter
(
TopLevelFeatureType
tlft
,
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Filter
filter
)
{
for
(
Checking
Property
c
:
filter
.
getChecking
()
)
{
if
(
c
.
get
Object
().
getFeatureTyp
e
().
equals
(
tlft
))
{
filter
.
getChecking
().
remove
(
c
);
return
;
}
}
...
...
@@ -762,7 +786,7 @@ public class Checker {
SvrlContentHandler
handler
=
executeSchematronValidationIfAvailable
(
config
,
inputFile
);
CityGmlConsumer
con
=
new
StreamCityGmlConsumer
(
c
,
xmlReporter
,
pdfReporter
,
handler
,
config
,
l
);
// parse and validate
CityGmlParser
.
streamCityGml
(
inputFile
,
config
.
getParserConfiguration
(),
con
,
outputFile
);
CityGmlParser
.
streamCityGml
(
inputFile
.
getAbsolutePath
()
,
config
.
getParserConfiguration
(),
con
,
outputFile
);
// write reports if available
writeReport
(
xmlReporter
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/RequirementConfiguration.java
View file @
3f3c1884
...
...
@@ -35,6 +35,13 @@ public class RequirementConfiguration implements Serializable {
private
boolean
enabled
;
private
Map
<
String
,
String
>
parameters
;
public
RequirementConfiguration
()
{
}
public
RequirementConfiguration
(
boolean
enabled
)
{
this
.
enabled
=
enabled
;
}
/**
* @return Whether this check is enabled
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/StreamCityGmlConsumer.java
View file @
3f3c1884
...
...
@@ -24,14 +24,16 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.core.CityModel
;
import
org.citygml4j.core.model.core.AbstractFeatureProperty
;
import
org.citygml4j.core.model.core.CityModel
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
de.hft.stuttgart.citydoctor2.check.error.SchematronError
;
import
de.hft.stuttgart.citydoctor2.checks.SvrlContentHandler
;
...
...
@@ -48,10 +50,13 @@ import de.hft.stuttgart.citydoctor2.reporting.XmlStreamReporter;
import
de.hft.stuttgart.citydoctor2.reporting.pdf.PdfStreamReporter
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.model.Validation
;
import
de.hft.stuttgart.quality.model.jaxb.ErrorStatistics
;
import
de.hft.stuttgart.quality.model.jaxb.FeatureStatistics
;
import
de.hft.stuttgart.quality.model.jaxb.Statistics
;
import
de.hft.stuttgart.quality.model.properties.ErrorProperty
;
import
de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty
;
import
de.hft.stuttgart.quality.model.properties.StatisticsProperty
;
import
de.hft.stuttgart.quality.model.properties.ValidationPlanProperty
;
import
de.hft.stuttgart.quality.model.types.FeatureStatistics
;
import
de.hft.stuttgart.quality.model.types.Statistics
;
import
de.hft.stuttgart.quality.model.types.Validation
;
public
class
StreamCityGmlConsumer
implements
CityGmlConsumer
{
...
...
@@ -62,7 +67,7 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
private
PdfStreamReporter
pdfReporter
;
private
SvrlContentHandler
handler
;
private
Map
<
ErrorId
,
AtomicInteger
>
errorCount
;
private
GML
GeometryFactory
gmlFactory
;
private
GeometryFactory
gmlFactory
;
private
ValidationConfiguration
config
;
private
Statistics
statistics
;
private
FeatureStatistics
buildingStatistics
;
...
...
@@ -83,24 +88,25 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
this
.
config
=
config
;
this
.
l
=
l
;
errorCount
=
new
HashMap
<>();
gmlFactory
=
new
GML
GeometryFactory
();
gmlFactory
=
GeometryFactory
.
newInstance
();
val
=
new
Validation
();
val
.
setId
(
"CD"
+
UUID
.
randomUUID
().
toString
());
val
.
setValidationDate
(
ZonedDateTime
.
now
());
val
.
setValidationSoftware
(
"CityDoctor "
+
Localization
.
getText
(
Localization
.
VERSION
));
statistics
=
new
Statistics
();
buildingStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorBuildings
(
buildingStatistics
);
statistics
.
setNumErrorBuildings
(
new
FeatureStatisticsProperty
(
buildingStatistics
)
)
;
bridgeStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorBridgeObjects
(
bridgeStatistics
);
statistics
.
setNumErrorBridgeObjects
(
new
FeatureStatisticsProperty
(
bridgeStatistics
)
)
;
transportationStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorTransportation
(
transportationStatistics
);
statistics
.
setNumErrorTransportation
(
new
FeatureStatisticsProperty
(
transportationStatistics
)
)
;
vegetationStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorVegetation
(
vegetationStatistics
);
statistics
.
setNumErrorVegetation
(
new
FeatureStatisticsProperty
(
vegetationStatistics
)
)
;
landStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorLandObjects
(
landStatistics
);
statistics
.
setNumErrorLandObjects
(
new
FeatureStatisticsProperty
(
landStatistics
)
)
;
waterStatistics
=
new
FeatureStatistics
();
statistics
.
setNumErrorWaterObjects
(
waterStatistics
);
statistics
.
setNumErrorWaterObjects
(
new
FeatureStatisticsProperty
(
waterStatistics
)
)
;
}
...
...
@@ -132,10 +138,8 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
pdfReporter
.
report
(
co
);
}
// remove existing quality ade datastructure if existing
QualityADEUtils
.
removeValidationResult
(
co
);
// store quality ade datastructures in cityobject
QualityADEUtils
.
writeQualityAde
(
co
);
QualityADEUtils
.
writeQualityAde
(
co
,
val
);
// recreate geometry
co
.
reCreateGeometries
(
gmlFactory
,
config
.
getParserConfiguration
());
...
...
@@ -164,21 +168,21 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
@Override
public
void
accept
(
CityModel
cm
)
{
QualityADEUtils
.
removeValidation
(
cm
);
for
(
Entry
<
ErrorId
,
AtomicInteger
>
e
:
errorCount
.
entrySet
())
{
ErrorStatistics
stats
=
new
ErrorStatistics
();
stats
.
set
Amount
(
e
.
getValue
().
get
());
de
.
hft
.
stuttgart
.
quality
.
model
.
jaxb
.
ErrorId
adeId
=
QualityADEUtils
.
mapErrorIdToAdeId
(
e
.
getKey
());
var
stats
=
new
de
.
hft
.
stuttgart
.
quality
.
model
.
types
.
Error
();
stats
.
set
Occurrences
(
e
.
getValue
().
get
());
de
.
hft
.
stuttgart
.
quality
.
model
.
enums
.
ErrorId
adeId
=
QualityADEUtils
.
mapErrorIdToAdeId
(
e
.
getKey
());
if
(
adeId
==
null
)
{
// error that is not part of the ade standard
continue
;
}
statistics
.
getErrorStatistics
().
add
(
stats
);
stats
.
setName
(
adeId
);
statistics
.
getErrors
().
add
(
new
ErrorProperty
(
stats
));
}
val
.
setStatistics
(
statistics
);
val
.
setValidationPlan
(
c
.
createValidationPlan
());
val
.
setStatistics
(
new
StatisticsProperty
(
statistics
)
)
;
val
.
setValidationPlan
(
new
ValidationPlanProperty
(
c
.
createValidationPlan
())
)
;
cm
.
addGenericApplicationPropertyOfCityModel
(
val
);
cm
.
getFeatureMembers
().
add
(
new
AbstractFeatureProperty
(
val
)
)
;
}
private
static
void
applyToStatistics
(
FeatureStatistics
buildingStatistics
,
FeatureStatistics
bridgeStatistics
,
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/check/CheckerTest.java
View file @
3f3c1884
...
...
@@ -24,9 +24,6 @@ import static org.junit.Assert.assertTrue;
import
java.io.File
;
import
java.io.IOException
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
...
...
@@ -34,6 +31,7 @@ import org.junit.rules.TemporaryFolder;
import
de.hft.stuttgart.citydoctor2.CityDoctorValidation
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParseException
;
import
de.hft.stuttgart.citydoctor2.parser.CityGmlParser
;
import
de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException
;
...
...
@@ -58,20 +56,17 @@ public class CheckerTest {
Checker
checker
=
new
Checker
(
config
,
model
);
checker
.
runChecks
();
for
(
Building
b
:
model
.
getBuildings
())
{
if
(!
b
.
getGmlId
().
getGmlString
().
startsWith
(
"UUID"
))
{
// if it starts with UUID the gml id was generated by citygml4j, but the file
// does not actually contain that gml id
// the schematron errors cannot be assigned to buildings without gml id, so they
// are excluded here
if
(
b
.
getGmlId
().
getGmlString
().
equals
(
"_Simple_BD.1"
))
{
assertTrue
(
b
.
containsAnyError
());
}
else
{
assertFalse
(
b
.
containsAnyError
());
}
}
assertFalse
(
model
.
getGlobalErrors
().
isEmpty
());
}
@Test
public
void
testChecker
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
public
void
testChecker
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityDoctorWriteException
{
File
f
=
folder
.
newFile
();
File
f2
=
folder
.
newFile
();
...
...
@@ -93,8 +88,7 @@ public class CheckerTest {
}
@Test
public
void
testStreaming
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
public
void
testStreaming
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityDoctorWriteException
{
File
f
=
folder
.
newFile
();
File
f2
=
folder
.
newFile
();
File
f3
=
folder
.
newFile
();
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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