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/main/java/de/hft/stuttgart/citydoctor2/check/error/PolygonWrongOrientationError.java
View file @
3f3c1884
...
...
@@ -20,7 +20,6 @@ package de.hft.stuttgart.citydoctor2.check.error;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Set
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -34,9 +33,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.model.PolygonWrongOrientation
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* If a polygon is wrongly oriented it results in edges being traversed in the
...
...
@@ -105,14 +101,4 @@ public class PolygonWrongOrientationError implements CheckError {
public
GmlElement
getFeature
()
{
return
getGeometry
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
PolygonWrongOrientation
err
=
new
PolygonWrongOrientation
();
err
.
setGeometryId
(
g
.
getGmlId
().
getGmlString
());
for
(
Edge
e
:
edges
)
{
err
.
getEdges
().
add
(
QualityADEUtils
.
convertEdge
(
e
));
}
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/RingDuplicatePointError.java
View file @
3f3c1884
...
...
@@ -18,8 +18,6 @@
*/
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
...
...
@@ -30,10 +28,6 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.model.RingSelfIntersection
;
import
de.hft.stuttgart.quality.model.ValidationError
;
import
de.hft.stuttgart.quality.model.jaxb.RingSelfIntType
;
/**
* When a point is repeated in a linear ring, but is not consecutive. This
...
...
@@ -104,15 +98,4 @@ public class RingDuplicatePointError implements CheckError {
public
GmlElement
getFeature
()
{
return
getRing
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
RingSelfIntersection
err
=
new
RingSelfIntersection
();
err
.
setType
(
RingSelfIntType
.
DUPLICATE_POINT
);
err
.
setVertex1
(
QualityADEUtils
.
convertVertex
(
v1
));
err
.
setVertex2
(
QualityADEUtils
.
convertVertex
(
v2
));
err
.
setLinearRingId
(
r
.
getGmlId
().
getGmlString
());
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/RingEdgeIntersectionError.java
View file @
3f3c1884
...
...
@@ -18,8 +18,6 @@
*/
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
...
...
@@ -31,10 +29,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.model.RingSelfIntersection
;
import
de.hft.stuttgart.quality.model.ValidationError
;
import
de.hft.stuttgart.quality.model.jaxb.RingSelfIntType
;
/**
* When two edges of the same linear ring are intersecting with each other this
...
...
@@ -116,16 +110,4 @@ public class RingEdgeIntersectionError implements CheckError {
public
GmlElement
getFeature
()
{
return
getRing
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
RingSelfIntersection
err
=
new
RingSelfIntersection
();
err
.
setLinearRingId
(
lr
.
getGmlId
().
getGmlString
());
err
.
setEdge1
(
QualityADEUtils
.
convertEdge
(
e1
));
err
.
setEdge2
(
QualityADEUtils
.
convertEdge
(
e2
));
err
.
setVertex1
(
QualityADEUtils
.
convertVertex
(
intersection
));
err
.
setType
(
RingSelfIntType
.
EDGE_INTERSECTS_EDGE
);
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/RingNotClosedError.java
View file @
3f3c1884
...
...
@@ -18,8 +18,6 @@
*/
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
...
...
@@ -29,8 +27,6 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.quality.model.RingNotClosed
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* If the first and last point of a linear ring are not the same, this error is
...
...
@@ -87,11 +83,4 @@ public class RingNotClosedError implements CheckError {
public
GmlElement
getFeature
()
{
return
getRing
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
RingNotClosed
err
=
new
RingNotClosed
();
err
.
setLinearRingId
(
ring
.
getGmlId
().
getGmlString
());
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/RingTooFewPointsError.java
View file @
3f3c1884
...
...
@@ -18,8 +18,6 @@
*/
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
...
...
@@ -29,8 +27,6 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.quality.model.TooFewPoints
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* If a linear ring has less than 4 distinct points, it is has too few points.
...
...
@@ -86,11 +82,4 @@ public class RingTooFewPointsError implements CheckError {
public
GmlElement
getFeature
()
{
return
getRing
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
TooFewPoints
err
=
new
TooFewPoints
();
err
.
setLinearRingId
(
lr
.
getGmlId
().
getGmlString
());
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/SolidNotClosedError.java
View file @
3f3c1884
...
...
@@ -19,7 +19,6 @@
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.List
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
...
...
@@ -31,9 +30,6 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import
de.hft.stuttgart.citydoctor2.datastructure.Edge
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.model.SolidNotClosed
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* If a geometry has holes in it, it results in edges being traversed only once.
...
...
@@ -97,14 +93,4 @@ public class SolidNotClosedError implements CheckError {
public
GmlElement
getFeature
()
{
return
getGeometry
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
SolidNotClosed
err
=
new
SolidNotClosed
();
err
.
setGeometryId
(
g
.
getGmlId
().
getGmlString
());
for
(
Edge
e
:
errorEdges
)
{
err
.
getEdges
().
add
(
QualityADEUtils
.
convertEdge
(
e
));
}
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/SolidSelfIntError.java
View file @
3f3c1884
...
...
@@ -19,7 +19,6 @@
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.List
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
...
...
@@ -31,8 +30,6 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection
;
import
de.hft.stuttgart.quality.model.SolidSelfIntersection
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* When two polygons of the same geometry are intersecting each other.
...
...
@@ -95,14 +92,4 @@ public class SolidSelfIntError implements CheckError {
public
GmlElement
getFeature
()
{
return
getGeometry
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
SolidSelfIntersection
err
=
new
SolidSelfIntersection
();
err
.
setGeometryId
(
g
.
getGmlId
().
getGmlString
());
PolygonIntersection
polygonIntersection
=
intersections
.
get
(
0
);
err
.
setPolygonId1
(
polygonIntersection
.
getP1
().
getGmlId
().
getGmlString
());
err
.
setPolygonId2
(
polygonIntersection
.
getP2
().
getGmlId
().
getGmlString
());
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/TooFewPolygonsError.java
View file @
3f3c1884
...
...
@@ -18,8 +18,6 @@
*/
package
de.hft.stuttgart.citydoctor2.check.error
;
import
java.util.Optional
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
...
...
@@ -29,8 +27,6 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.quality.model.TooFewPolygons
;
import
de.hft.stuttgart.quality.model.ValidationError
;
/**
* When a geometry has less than 4 polygons, it cannot form a valid solid.
...
...
@@ -87,11 +83,4 @@ public class TooFewPolygonsError implements CheckError {
public
GmlElement
getFeature
()
{
return
getGeometry
();
}
@Override
public
Optional
<
ValidationError
>
convertToQualityAdeDatastructure
()
{
TooFewPolygons
err
=
new
TooFewPolygons
();
err
.
setGeometryId
(
g
.
getGmlId
().
getGmlString
());
return
Optional
.
of
(
err
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java
View file @
3f3c1884
...
...
@@ -23,12 +23,12 @@ import java.util.List;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.
factory.GMLGeometryFactor
y
;
import
org.citygml4j.
model.citygml.building.BoundarySurfacePropert
y
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurface
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurfaceProperty
;
import
org.
city
gml
4j
.model.
gml.
geometry.primitives.Solid
;
import
org.
city
gml
4j
.model.
gml.
geometry.primitives.SolidProperty
;
import
org.citygml4j.
core.model.core.AbstractSpaceBoundaryPropert
y
;
import
org.citygml4j.
core.util.geometry.GeometryFactor
y
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurface
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.
xmlobjects.
gml.model.geometry.primitives.Solid
;
import
org.
xmlobjects.
gml.model.geometry.primitives.SolidProperty
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -54,7 +54,7 @@ public abstract class AbstractBuilding extends CityObject {
private
List
<
BuildingInstallation
>
buildingInstallations
=
new
ArrayList
<>(
2
);
private
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
private
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
ab
;
private
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
ab
;
/**
* Getter for all boundary surfaces contained in this building.
...
...
@@ -66,7 +66,7 @@ public abstract class AbstractBuilding extends CityObject {
}
@Override
public
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
getGmlObject
()
{
public
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
getGmlObject
()
{
return
ab
;
}
...
...
@@ -77,14 +77,15 @@ public abstract class AbstractBuilding extends CityObject {
@Override
public
void
unsetGmlGeometries
()
{
ab
.
unsetLod1MultiSurface
();
ab
.
unsetLod2MultiSurface
();
ab
.
unsetLod3MultiSurface
();
ab
.
unsetLod4MultiSurface
();
ab
.
unsetLod1Solid
();
ab
.
unsetLod2Solid
();
ab
.
unsetLod3Solid
();
ab
.
unsetLod4Solid
();
ab
.
setLod1Solid
(
null
);
ab
.
setLod2Solid
(
null
);
ab
.
setLod3Solid
(
null
);
ab
.
setLod2MultiSurface
(
null
);
ab
.
setLod3MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
bs
.
unsetGmlGeometries
();
}
...
...
@@ -94,7 +95,7 @@ public abstract class AbstractBuilding extends CityObject {
}
@Override
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
...
@@ -112,12 +113,12 @@ public abstract class AbstractBuilding extends CityObject {
}
}
private
void
reCreateBoundarySurface
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
private
void
reCreateBoundarySurface
(
GeometryFactory
factory
,
ParserConfiguration
config
,
BoundarySurface
bs
)
{
if
(
bs
.
getGeometries
().
isEmpty
())
{
for
(
Boundary
Surface
Property
bsp
:
ab
.
getBound
edBySurface
())
{
if
(
bsp
.
get
BoundarySurface
()
!=
null
&&
bsp
.
get
BoundarySurface
()
==
bs
.
getGmlObject
())
{
for
(
AbstractSpace
BoundaryProperty
bsp
:
ab
.
getBound
aries
())
{
if
(
bsp
.
get
Object
()
!=
null
&&
bsp
.
get
Object
()
==
bs
.
getGmlObject
())
{
logger
.
warn
(
"Found empty boundary surface: {}, removing from building"
,
bs
.
getGmlId
());
ab
.
getBound
edBySurface
().
remove
(
bsp
);
ab
.
getBound
aries
().
remove
(
bsp
);
break
;
}
}
...
...
@@ -128,8 +129,11 @@ public abstract class AbstractBuilding extends CityObject {
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
switch
(
geom
.
getLod
())
{
case
LOD0:
ab
.
setLod0MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD1:
ab
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
ab
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
...
...
@@ -138,7 +142,7 @@ public abstract class AbstractBuilding extends CityObject {
ab
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD4:
ab
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" multi surface to buildings"
);
...
...
@@ -157,7 +161,7 @@ public abstract class AbstractBuilding extends CityObject {
ab
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD4:
ab
.
setLod4Solid
(
new
SolidProperty
(
solid
));
ab
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" solid to buildings"
);
...
...
@@ -238,7 +242,7 @@ public abstract class AbstractBuilding extends CityObject {
return
false
;
}
void
setCityGmlBuilding
(
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
ab
)
{
void
setCityGmlBuilding
(
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
ab
)
{
this
.
ab
=
ab
;
}
...
...
@@ -252,7 +256,7 @@ public abstract class AbstractBuilding extends CityObject {
coBi
.
setParent
(
this
);
}
public
void
setGmlObject
(
org
.
citygml4j
.
model
.
citygm
l
.
building
.
AbstractBuilding
ab
)
{
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
mode
l
.
building
.
AbstractBuilding
ab
)
{
this
.
ab
=
ab
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java
View file @
3f3c1884
...
...
@@ -21,10 +21,10 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.
model.citygml.core.AbstractCityObject
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurface
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.
core.model.core.AbstractThematicSurface
;
import
org.citygml4j.
core.util.geometry.GeometryFactory
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurface
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -50,13 +50,13 @@ public class BoundarySurface extends CityObject {
private
List
<
Opening
>
openings
=
new
ArrayList
<>(
2
);
private
CityObject
parent
;
private
Abstract
CityObject
gmlObject
;
private
Abstract
ThematicSurface
gmlObject
;
public
BoundarySurface
(
Abstract
CityObject
aco
)
{
public
BoundarySurface
(
Abstract
ThematicSurface
aco
)
{
this
(
SurfaceFeatureType
.
BUILDING
,
BoundarySurfaceType
.
UNDEFINED
,
aco
);
}
public
BoundarySurface
(
SurfaceFeatureType
featureType
,
BoundarySurfaceType
type
,
Abstract
CityObject
aco
)
{
public
BoundarySurface
(
SurfaceFeatureType
featureType
,
BoundarySurfaceType
type
,
Abstract
ThematicSurface
aco
)
{
this
.
featureType
=
featureType
;
this
.
type
=
type
;
gmlObject
=
aco
;
...
...
@@ -70,7 +70,7 @@ public class BoundarySurface extends CityObject {
this
.
type
=
type
;
}
public
void
setGmlObject
(
Abstract
CityObject
gmlObject
)
{
public
void
setGmlObject
(
Abstract
ThematicSurface
gmlObject
)
{
this
.
gmlObject
=
gmlObject
;
}
...
...
@@ -87,8 +87,8 @@ public class BoundarySurface extends CityObject {
}
@Override
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
!
gmlObject
.
isS
etId
())
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
if
(
gmlObject
.
g
etId
()
==
null
)
{
gmlObject
.
setId
(
getGmlId
().
getGmlString
());
}
for
(
Geometry
geom
:
getGeometries
())
{
...
...
@@ -108,69 +108,26 @@ public class BoundarySurface extends CityObject {
private
void
setGeometryAccordingToLod
(
Lod
lod
,
MultiSurfaceProperty
ms
)
{
switch
(
lod
)
{
case
LOD0:
gmlObject
.
setLod0MultiSurface
(
ms
);
break
;
case
LOD1:
gmlObject
.
setLod1MultiSurface
(
ms
);
break
;
case
LOD2:
setLod2Ms
(
ms
);
gmlObject
.
setLod2MultiSurface
(
ms
);
break
;
case
LOD3:
setLod3Ms
(
ms
);
gmlObject
.
setLod3MultiSurface
(
ms
);
break
;
case
LOD4:
setLod4Ms
(
ms
);
gmlObject
.
getDeprecatedProperties
().
setLod4MultiSurface
(
ms
);
break
;
default
:
throw
new
IllegalStateException
(
"Found geometry with LOD other than LOD2,"
+
" LOD3, LOD4, which is illegal for BoundarySurfaces: "
+
lod
);
}
}
private
void
setLod2Ms
(
MultiSurfaceProperty
ms
)
{
switch
(
featureType
)
{
case
BRIDGE:
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
bridgeAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
)
gmlObject
;
bridgeAbs
.
setLod2MultiSurface
(
ms
);
break
;
case
BUILDING:
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
buildAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
)
gmlObject
;
buildAbs
.
setLod2MultiSurface
(
ms
);
break
;
case
TUNNEL:
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
tunAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
)
gmlObject
;
tunAbs
.
setLod2MultiSurface
(
ms
);
}
}
private
void
setLod3Ms
(
MultiSurfaceProperty
ms
)
{
switch
(
featureType
)
{
case
BRIDGE:
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
bridgeAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
)
gmlObject
;
bridgeAbs
.
setLod3MultiSurface
(
ms
);
break
;
case
BUILDING:
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
buildAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
)
gmlObject
;
buildAbs
.
setLod3MultiSurface
(
ms
);
break
;
case
TUNNEL:
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
tunAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
)
gmlObject
;
tunAbs
.
setLod3MultiSurface
(
ms
);
throw
new
IllegalStateException
(
"Found geometry with LOD other than LOD1-4, which is illegal for BoundarySurfaces: "
+
lod
);
}
}
private
void
setLod4Ms
(
MultiSurfaceProperty
ms
)
{
switch
(
featureType
)
{
case
BRIDGE:
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
bridgeAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
)
gmlObject
;
bridgeAbs
.
setLod4MultiSurface
(
ms
);
break
;
case
BUILDING:
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
buildAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
)
gmlObject
;
buildAbs
.
setLod4MultiSurface
(
ms
);
break
;
case
TUNNEL:
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
tunAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
)
gmlObject
;
tunAbs
.
setLod4MultiSurface
(
ms
);
}
}
@Override
public
void
clearAllContainedCheckResults
()
{
super
.
clearAllContainedCheckResults
();
...
...
@@ -234,26 +191,14 @@ public class BoundarySurface extends CityObject {
return
parent
;
}
@Override
public
void
unsetGmlGeometries
()
{
switch
(
featureType
)
{
case
BRIDGE:
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
bridgeAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
bridge
.
AbstractBoundarySurface
)
gmlObject
;
bridgeAbs
.
unsetLod2MultiSurface
();
bridgeAbs
.
unsetLod3MultiSurface
();
bridgeAbs
.
unsetLod4MultiSurface
();
break
;
case
BUILDING:
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
buildAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
building
.
AbstractBoundarySurface
)
gmlObject
;
buildAbs
.
unsetLod2MultiSurface
();
buildAbs
.
unsetLod3MultiSurface
();
buildAbs
.
unsetLod4MultiSurface
();
break
;
case
TUNNEL:
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
tunAbs
=
(
org
.
citygml4j
.
model
.
citygml
.
tunnel
.
AbstractBoundarySurface
)
gmlObject
;
tunAbs
.
unsetLod2MultiSurface
();
tunAbs
.
unsetLod3MultiSurface
();
tunAbs
.
unsetLod4MultiSurface
();
}
gmlObject
.
setLod0MultiSurface
(
null
);
gmlObject
.
setLod1MultiSurface
(
null
);
gmlObject
.
setLod2MultiSurface
(
null
);
gmlObject
.
setLod3MultiSurface
(
null
);
gmlObject
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
for
(
Opening
o
:
openings
)
{
o
.
unsetGmlGeometries
();
}
...
...
@@ -265,21 +210,20 @@ public class BoundarySurface extends CityObject {
}
void
anonymize
()
{
gmlObject
.
unsetAppearance
();
gmlObject
.
unsetBoundedBy
();
gmlObject
.
unsetCreationDate
();
gmlObject
.
unsetDescription
();
gmlObject
.
unsetExternalReference
();
gmlObject
.
unsetGeneralizesTo
();
gmlObject
.
unsetGenericADEElement
();
gmlObject
.
unsetGenericApplicationPropertyOfCityObject
();
gmlObject
.
unsetGenericAttribute
();
gmlObject
.
setAppearances
(
null
);
gmlObject
.
setBoundedBy
(
null
);
gmlObject
.
setCreationDate
(
null
);
gmlObject
.
setDescription
(
null
);
gmlObject
.
setExternalReferences
(
null
);
gmlObject
.
setGeneralizesTo
(
null
);
gmlObject
.
setADEProperties
(
null
);
gmlObject
.
setGenericAttributes
(
null
);
setGmlId
(
GmlId
.
generateId
());
gmlObject
.
setId
(
getGmlId
().
getGmlString
());
}
@Override
public
Abstract
CityObject
getGmlObject
()
{
public
Abstract
ThematicSurface
getGmlObject
()
{
return
gmlObject
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java
View file @
3f3c1884
...
...
@@ -21,12 +21,12 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.
model.citygml.bridge.AbstractBridge
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurface
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurfaceProperty
;
import
org.
city
gml
4j
.model.
gml.
geometry.primitives.Solid
;
import
org.
city
gml
4j
.model.
gml.
geometry.primitives.SolidProperty
;
import
org.citygml4j.
core.model.bridge.AbstractBridge
;
import
org.citygml4j.
core.util.geometry.GeometryFactory
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurface
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.
xmlobjects.
gml.model.geometry.primitives.Solid
;
import
org.
xmlobjects.
gml.model.geometry.primitives.SolidProperty
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -52,6 +52,8 @@ public class BridgeObject extends CityObject {
private
AbstractBridge
ab
;
private
BridgeType
type
;
private
List
<
BridgeObject
>
parts
=
null
;
private
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>();
...
...
@@ -66,7 +68,7 @@ public class BridgeObject extends CityObject {
}
@Override
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
...
@@ -84,7 +86,7 @@ public class BridgeObject extends CityObject {
private
void
setMultiSurfaceAccordingToLod
(
Geometry
geom
,
MultiSurface
ms
)
{
switch
(
geom
.
getLod
())
{
case
LOD1:
ab
.
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD2:
ab
.
setLod2MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
...
...
@@ -93,7 +95,7 @@ public class BridgeObject extends CityObject {
ab
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD4:
ab
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" multi surface to bridges"
);
...
...
@@ -112,7 +114,7 @@ public class BridgeObject extends CityObject {
ab
.
setLod3Solid
(
new
SolidProperty
(
solid
));
break
;
case
LOD4:
ab
.
setLod4Solid
(
new
SolidProperty
(
solid
));
ab
.
getDeprecatedProperties
().
setLod4Solid
(
new
SolidProperty
(
solid
));
break
;
default
:
throw
new
IllegalStateException
(
"Cannot add "
+
geom
.
getLod
()
+
" solid to bridges"
);
...
...
@@ -204,14 +206,14 @@ public class BridgeObject extends CityObject {
@Override
public
void
unsetGmlGeometries
()
{
ab
.
un
setLod1
MultiSurface
(
);
ab
.
un
setLod2
MultiSurface
(
);
ab
.
un
setLod3
MultiSurface
(
);
ab
.
un
setLod
4
MultiSurface
();
ab
.
un
setLod
1Solid
(
);
ab
.
unsetLod2Solid
(
);
ab
.
unsetLod3Solid
(
);
ab
.
un
setLod4Solid
();
ab
.
setLod1
Solid
(
null
);
ab
.
setLod2
Solid
(
null
);
ab
.
setLod3
Solid
(
null
);
ab
.
setLod
2
MultiSurface
(
null
);
ab
.
setLod
3MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod1MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
ab
.
getDeprecatedProperties
().
setLod4Solid
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
bs
.
unsetGmlGeometries
();
}
...
...
@@ -263,5 +265,19 @@ public class BridgeObject extends CityObject {
public
Copyable
createCopyInstance
()
{
return
new
BridgeObject
(
type
,
ab
);
}
public
List
<
BridgeObject
>
getParts
()
{
if
(
parts
==
null
)
{
parts
=
new
ArrayList
<>(
2
);
}
return
parts
;
}
public
void
addBridgePart
(
BridgeObject
bPart
)
{
if
(
parts
==
null
)
{
parts
=
new
ArrayList
<>(
2
);
}
parts
.
add
(
bPart
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java
View file @
3f3c1884
...
...
@@ -21,10 +21,9 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.building.AbstractBoundarySurface
;
import
org.citygml4j.model.citygml.building.BoundarySurfaceProperty
;
import
org.citygml4j.model.citygml.building.BuildingInstallationProperty
;
import
org.citygml4j.core.model.building.BuildingInstallationProperty
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -44,7 +43,7 @@ public class Building extends AbstractBuilding {
}
@Override
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
super
.
reCreateGeometries
(
factory
,
config
);
for
(
BuildingPart
bp
:
buildingParts
)
{
bp
.
reCreateGeometries
(
factory
,
config
);
...
...
@@ -119,15 +118,15 @@ public class Building extends AbstractBuilding {
for
(
Geometry
geom
:
getGeometries
())
{
geom
.
anonymize
();
}
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
();
gmlB
.
setId
(
GmlId
.
generateId
().
getGmlString
());
for
(
BuildingInstallation
bi
:
getBuildingInstallations
())
{
bi
.
anonymize
();
gmlB
.
addOuter
BuildingInstallation
(
new
BuildingInstallationProperty
(
bi
.
getGmlObject
()));
gmlB
.
get
BuildingInstallation
s
().
add
(
new
BuildingInstallationProperty
(
bi
.
getGmlObject
()));
}
for
(
BoundarySurface
bs
:
getBoundarySurfaces
())
{
bs
.
anonymize
();
gmlB
.
addBound
edBySurface
(
new
BoundarySurfaceProperty
((
AbstractBoundary
Surface
)
bs
.
getGmlObject
()));
gmlB
.
addBound
ary
(
new
Abstract
Space
Boundary
Property
(
bs
.
getGmlObject
()));
}
setCityGmlBuilding
(
gmlB
);
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingInstallation.java
View file @
3f3c1884
...
...
@@ -21,14 +21,13 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.building.AbstractBoundarySurface
;
import
org.citygml4j.model.citygml.building.BoundarySurfaceProperty
;
import
org.citygml4j.model.gml.geometry.GeometryProperty
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurface
;
import
org.citygml4j.model.gml.geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.model.gml.geometry.complexes.CompositeSurface
;
import
org.citygml4j.model.gml.geometry.complexes.CompositeSurfaceProperty
;
import
org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.xmlobjects.gml.model.geometry.GeometryProperty
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurface
;
import
org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.complexes.CompositeSurface
;
import
org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -44,11 +43,11 @@ public class BuildingInstallation extends CityObject {
private
List
<
BoundarySurface
>
boundarySurfaces
=
new
ArrayList
<>(
4
);
private
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
gmlBi
;
private
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
gmlBi
;
private
AbstractBuilding
parent
;
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
...
@@ -58,7 +57,7 @@ public class BuildingInstallation extends CityObject {
}
else
if
(
geom
.
getType
()
==
GeometryType
.
COMPOSITE_SURFACE
)
{
CompositeSurface
cs
=
CityGmlUtils
.
createCompositeSurface
(
geom
,
factory
,
config
);
if
(
cs
!=
null
)
{
setGeometryAccordingToLod
(
geom
.
getLod
(),
new
Composite
SurfaceProperty
(
cs
));
setGeometryAccordingToLod
(
geom
.
getLod
(),
new
SurfaceProperty
(
cs
));
}
}
else
{
throw
new
IllegalStateException
(
"BuildingInstallation not have Solid geometries"
);
...
...
@@ -70,15 +69,16 @@ public class BuildingInstallation extends CityObject {
}
private
void
setGeometryAccordingToLod
(
Lod
lod
,
GeometryProperty
<?>
ms
)
{
switch
(
lod
)
{
case
LOD2:
gmlBi
.
setLod2Geometry
(
ms
);
gmlBi
.
getDeprecatedProperties
().
setLod2Geometry
(
ms
);
break
;
case
LOD3:
gmlBi
.
setLod3Geometry
(
ms
);
gmlBi
.
getDeprecatedProperties
().
setLod3Geometry
(
ms
);
break
;
case
LOD4:
gmlBi
.
setLod4Geometry
(
ms
);
gmlBi
.
getDeprecatedProperties
().
setLod4Geometry
(
ms
);
break
;
default
:
throw
new
IllegalStateException
(
"Found geometry with LOD other than LOD2,"
...
...
@@ -155,15 +155,15 @@ public class BuildingInstallation extends CityObject {
}
public
void
unsetGmlGeometries
()
{
gmlBi
.
un
setLod2Geometry
();
gmlBi
.
un
setLod3Geometry
();
gmlBi
.
un
setLod4Geometry
();
gmlBi
.
getDeprecatedProperties
().
setLod2Geometry
(
null
);
gmlBi
.
getDeprecatedProperties
().
setLod3Geometry
(
null
);
gmlBi
.
getDeprecatedProperties
().
setLod4Geometry
(
null
);
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
bs
.
unsetGmlGeometries
();
}
}
public
void
setGmlObject
(
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
gmlBi
)
{
public
void
setGmlObject
(
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
gmlBi
)
{
this
.
gmlBi
=
gmlBi
;
}
...
...
@@ -174,17 +174,17 @@ public class BuildingInstallation extends CityObject {
void
anonymize
()
{
setGmlId
(
GmlId
.
generateId
());
gmlBi
=
new
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
();
gmlBi
=
new
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
();
gmlBi
.
setId
(
getGmlId
().
getGmlString
());
for
(
BoundarySurface
bs
:
boundarySurfaces
)
{
bs
.
anonymize
();
gmlBi
.
add
Bound
edBySurface
(
new
BoundarySurfaceProperty
((
AbstractBoundary
Surface
)
bs
.
getGmlObject
()));
gmlBi
.
get
Bound
aries
().
add
(
new
Abstract
Space
Boundary
Property
(
bs
.
getGmlObject
()));
}
}
@Override
public
org
.
citygml4j
.
model
.
citygm
l
.
building
.
BuildingInstallation
getGmlObject
()
{
public
org
.
citygml4j
.
core
.
mode
l
.
building
.
BuildingInstallation
getGmlObject
()
{
return
gmlBi
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java
View file @
3f3c1884
...
...
@@ -23,46 +23,25 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.UncheckedIOException
;
import
java.nio.file.Files
;
import
java.time.ZonedDateTime
;
import
java.util.ArrayList
;
import
java.util.EnumMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.ServiceLoader
;
import
java.util.Set
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Stream
;
import
org.citygml4j.CityGMLContext
;
import
org.citygml4j.builder.jaxb.CityGMLBuilder
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.model.citygml.ade.binding.ADEContext
;
import
org.citygml4j.model.citygml.core.CityModel
;
import
org.citygml4j.model.citygml.core.CityObjectMember
;
import
org.citygml4j.model.module.citygml.CityGMLVersion
;
import
org.citygml4j.xml.io.CityGMLOutputFactory
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
org.citygml4j.xml.io.writer.CityGMLWriter
;
import
org.citygml4j.core.model.CityGMLVersion
;
import
org.citygml4j.core.model.core.CityModel
;
import
de.hft.stuttgart.citydoctor2.check.AbstractCheck
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.
check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.
exceptions.CityDoctorWriteException
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
de.hft.stuttgart.citydoctor2.utils.QualityADEUtils
;
import
de.hft.stuttgart.quality.QualityADEModule
;
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.jaxb.ValidationPlan
;
import
de.hft.stuttgart.citydoctor2.writer.CityGMLWriterUtils
;
import
de.hft.stuttgart.quality.model.types.ValidationPlan
;
/**
* The complete CityGML model containing all features that are used in
...
...
@@ -87,6 +66,7 @@ public class CityDoctorModel {
private
List
<
CheckError
>
globalErrors
;
private
boolean
isValidated
=
false
;
private
ValidationPlan
plan
;
private
CityGMLVersion
cityGMLVersion
;
public
CityDoctorModel
(
ParserConfiguration
config
,
File
file
)
{
if
(
config
==
null
)
{
...
...
@@ -112,6 +92,10 @@ public class CityDoctorModel {
this
.
plan
=
plan
;
this
.
isValidated
=
true
;
}
public
ValidationPlan
getValidationPlan
()
{
return
plan
;
}
public
void
addGlobalError
(
CheckError
err
)
{
globalErrors
.
add
(
err
);
...
...
@@ -134,7 +118,7 @@ public class CityDoctorModel {
water
.
stream
()).
flatMap
(
co
->
co
);
}
public
void
saveAs
(
String
file
)
throws
City
GMLBuilderException
,
CityGMLWriteException
,
ADE
Exception
{
public
void
saveAs
(
String
file
)
throws
City
DoctorWrite
Exception
{
if
(
file
.
endsWith
(
".off"
))
{
exportAsOff
(
file
);
}
else
{
...
...
@@ -142,43 +126,8 @@ public class CityDoctorModel {
}
}
private
void
exportAsGML
(
String
file
)
throws
ADEException
,
CityGMLBuilderException
,
CityGMLWriteException
{
CityGMLContext
gmlContext
=
CityGMLContext
.
getInstance
();
// setup energy ade stuff, so the parser doesn't crash on encountering this
if
(!
gmlContext
.
hasADEContexts
())
{
for
(
ADEContext
adeContext
:
ServiceLoader
.
load
(
ADEContext
.
class
))
{
gmlContext
.
registerADEContext
(
adeContext
);
}
}
CityGMLBuilder
builder
=
gmlContext
.
createCityGMLBuilder
();
CityGMLOutputFactory
factory
=
builder
.
createCityGMLOutputFactory
();
try
(
CityGMLWriter
writer
=
factory
.
createCityGMLWriter
(
new
File
(
file
)))
{
if
(
isValidated
)
{
writer
.
setPrefix
(
"qual"
,
QualityADEModule
.
NAMESPACE_URI
);
writer
.
setSchemaLocation
(
QualityADEModule
.
NAMESPACE_URI
,
QualityADEModule
.
NAMESPACE_URI
+
"/qualityAde.xsd"
);
// remove old model if available
QualityADEUtils
.
removeValidation
(
cModel
);
// create new quality ade validation datastructures
Validation
val
=
createValidation
();
// add to city model
cModel
.
addGenericApplicationPropertyOfCityModel
(
val
);
}
writer
.
setIndentString
(
" "
);
writer
.
setPrefixes
(
CityGMLVersion
.
DEFAULT
);
writer
.
setSchemaLocations
(
CityGMLVersion
.
DEFAULT
);
GMLGeometryFactory
gmlFactory
=
new
GMLGeometryFactory
();
storeCityObjects
(
buildings
,
gmlFactory
);
storeCityObjects
(
vegetation
,
gmlFactory
);
storeCityObjects
(
bridges
,
gmlFactory
);
storeCityObjects
(
land
,
gmlFactory
);
storeCityObjects
(
roads
,
gmlFactory
);
storeCityObjects
(
water
,
gmlFactory
);
writer
.
write
(
cModel
);
cModel
.
unsetCityObjectMember
();
}
private
void
exportAsGML
(
String
file
)
throws
CityDoctorWriteException
{
CityGMLWriterUtils
.
writeCityModel
(
file
,
this
);
}
private
void
exportAsOff
(
String
file
)
{
...
...
@@ -258,55 +207,6 @@ public class CityDoctorModel {
return
counter
;
}
private
void
storeCityObjects
(
List
<?
extends
CityObject
>
cos
,
GMLGeometryFactory
gmlFactory
)
{
for
(
CityObject
co
:
cos
)
{
QualityADEUtils
.
removeValidationResult
(
co
);
if
(
isValidated
)
{
QualityADEUtils
.
writeQualityAde
(
co
);
}
co
.
reCreateGeometries
(
gmlFactory
,
config
);
cModel
.
addCityObjectMember
(
new
CityObjectMember
(
co
.
getGmlObject
()));
}
}
private
Validation
createValidation
()
{
Validation
val
=
new
Validation
();
val
.
setValidationDate
(
ZonedDateTime
.
now
());
val
.
setValidationSoftware
(
"CityDoctor "
+
Localization
.
getText
(
Localization
.
VERSION
));
Statistics
statistics
=
new
Statistics
();
Set
<
CheckError
>
errors
=
collectErrors
();
Map
<
ErrorId
,
AtomicInteger
>
errorCount
=
new
HashMap
<>();
for
(
CheckError
e
:
errors
)
{
errorCount
.
compute
(
e
.
getErrorId
(),
(
k
,
v
)
->
{
if
(
v
==
null
)
{
return
new
AtomicInteger
(
1
);
}
v
.
incrementAndGet
();
return
v
;
});
}
for
(
Entry
<
ErrorId
,
AtomicInteger
>
e
:
errorCount
.
entrySet
())
{
ErrorStatistics
stats
=
new
ErrorStatistics
();
stats
.
setAmount
(
e
.
getValue
().
get
());
de
.
hft
.
stuttgart
.
quality
.
model
.
jaxb
.
ErrorId
adeId
=
QualityADEUtils
.
mapErrorIdToAdeId
(
e
.
getKey
());
if
(
adeId
==
null
)
{
// error that is not part of the ade standard
continue
;
}
stats
.
setName
(
adeId
);
statistics
.
getErrorStatistics
().
add
(
stats
);
}
statistics
.
setNumErrorBuildings
(
countValidatedCityObjects
(
buildings
));
statistics
.
setNumErrorBridgeObjects
(
countValidatedCityObjects
(
bridges
));
statistics
.
setNumErrorLandObjects
(
countValidatedCityObjects
(
land
));
statistics
.
setNumErrorTransportation
(
countValidatedCityObjects
(
roads
));
statistics
.
setNumErrorVegetation
(
countValidatedCityObjects
(
vegetation
));
statistics
.
setNumErrorWaterObjects
(
countValidatedCityObjects
(
water
));
val
.
setStatistics
(
statistics
);
val
.
setValidationPlan
(
plan
);
return
val
;
}
public
Set
<
CheckError
>
collectErrors
()
{
List
<
CheckError
>
errors
=
new
ArrayList
<>();
collectErrorsFromList
(
errors
,
buildings
);
...
...
@@ -324,20 +224,6 @@ public class CityDoctorModel {
}
}
private
FeatureStatistics
countValidatedCityObjects
(
List
<?
extends
CityObject
>
cos
)
{
int
numChecked
=
0
;
int
numError
=
0
;
for
(
CityObject
co
:
cos
)
{
if
(
co
.
isValidated
())
{
numChecked
++;
if
(
co
.
containsAnyError
())
{
numError
++;
}
}
}
return
new
FeatureStatistics
(
numChecked
,
numError
);
}
public
String
getFileName
()
{
return
fileName
;
}
...
...
@@ -471,18 +357,26 @@ public class CityDoctorModel {
}
public
void
addCityObject
(
CityObject
co
)
{
if
(
co
instanceof
Building
)
{
buildings
.
add
(
(
Building
)
co
);
}
else
if
(
co
instanceof
BridgeObject
)
{
bridges
.
add
(
(
BridgeObject
)
c
o
);
}
else
if
(
co
instanceof
TransportationObject
)
{
roads
.
add
(
(
TransportationObject
)
c
o
);
}
else
if
(
co
instanceof
Vegetation
)
{
vegetation
.
add
(
(
Vegetation
)
co
);
}
else
if
(
co
instanceof
LandObject
)
{
land
.
add
(
(
LandObject
)
c
o
);
}
else
if
(
co
instanceof
WaterObject
)
{
water
.
add
(
(
WaterObject
)
c
o
);
if
(
co
instanceof
Building
b
)
{
buildings
.
add
(
b
);
}
else
if
(
co
instanceof
BridgeObject
bo
)
{
bridges
.
add
(
b
o
);
}
else
if
(
co
instanceof
TransportationObject
to
)
{
roads
.
add
(
t
o
);
}
else
if
(
co
instanceof
Vegetation
veg
)
{
vegetation
.
add
(
veg
);
}
else
if
(
co
instanceof
LandObject
lo
)
{
land
.
add
(
l
o
);
}
else
if
(
co
instanceof
WaterObject
wo
)
{
water
.
add
(
w
o
);
}
}
public
void
setParsedCityGMLVersion
(
CityGMLVersion
cityGMLVersion
)
{
this
.
cityGMLVersion
=
cityGMLVersion
;
}
public
CityGMLVersion
getCityGMLVersion
()
{
return
cityGMLVersion
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java
View file @
3f3c1884
...
...
@@ -23,8 +23,8 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.Objects
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.
model.citygml.core.AbstractCityObject
;
import
org.citygml4j.
core.model.core.AbstractCityObject
;
import
org.citygml4j.
core.util.geometry.GeometryFactory
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
...
...
@@ -58,7 +58,7 @@ public abstract class CityObject extends GmlElement {
* transformed to a different coordinate system. It would need to
* be transformed to the original coordinate system
*/
public
abstract
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
);
public
abstract
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
);
/**
* Getter for the CityGML4j data object
...
...
@@ -68,17 +68,9 @@ public abstract class CityObject extends GmlElement {
public
abstract
AbstractCityObject
getGmlObject
();
/**
* Remove the CityGML4j geometries from the data structure to save memory
* Remove the CityGML4j geometries from the data structure to save memory
.
*/
public
abstract
void
unsetGmlGeometries
();
// void copyAttributesInto(CityObject copy, ReferenceStore store) {
// super.copyAttributesInto(copy);
// copy.geometryList = new ArrayList<>();
// for (Geometry geom : geometryList) {
// copy.geometryList.add(geom.copy(store));
// }
// }
public
void
addGeometry
(
Geometry
geom
)
{
Objects
.
requireNonNull
(
geom
);
...
...
@@ -177,28 +169,28 @@ public abstract class CityObject extends GmlElement {
}
return
null
;
}
@Override
public
void
prepareForChecking
()
{
for
(
Geometry
geom
:
geometryList
)
{
geom
.
prepareForChecking
();
}
}
@Override
public
void
clearMetaInformation
()
{
for
(
Geometry
geom
:
geometryList
)
{
geom
.
clearMetaInformation
();
}
}
@Override
public
void
collectInstances
(
CopyHandler
handler
)
{
for
(
Geometry
geom
:
geometryList
)
{
handler
.
addInstance
(
geom
);
}
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
super
.
fillValues
(
original
,
handler
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java
View file @
3f3c1884
...
...
@@ -49,6 +49,10 @@ public class ConcretePolygon extends Polygon {
private
BuildingInstallation
partfOfInstallation
;
private
Geometry
parent
;
private
LinkedPolygon
linkedFromPolygon
;
public
ConcretePolygon
()
{
// TODO Auto-generated constructor stub
}
/*
* (non-Javadoc)
...
...
@@ -259,7 +263,7 @@ public class ConcretePolygon extends Polygon {
if
(
hasError
)
{
return
true
;
}
if
(
exterior
.
containsError
(
checkIdentifier
))
{
if
(
exterior
!=
null
&&
exterior
.
containsError
(
checkIdentifier
))
{
return
true
;
}
if
(
innerRings
!=
null
)
{
...
...
@@ -494,6 +498,11 @@ public class ConcretePolygon extends Polygon {
partOfSurface
=
handler
.
getCopyInstance
(
originalPoly
.
partOfSurface
);
linkedFromPolygon
=
handler
.
getCopyInstance
(
originalPoly
.
linkedFromPolygon
);
}
@Override
public
void
remove
()
{
parent
.
removePolygon
(
this
);
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java
View file @
3f3c1884
...
...
@@ -46,6 +46,8 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
*/
public
class
Geometry
extends
GmlElement
{
private
static
final
String
FAILED_REMOVING_POLYGON
=
"Removing polygon %s but polygon is not in geometry"
;
private
static
final
long
serialVersionUID
=
2539031030917731575L
;
private
static
Random
r
=
new
Random
();
...
...
@@ -55,7 +57,7 @@ public class Geometry extends GmlElement {
private
CityObject
parent
;
private
List
<
Polygon
>
polygons
=
new
ArrayList
<>();
private
List
<
Polygon
>
polygons
=
new
ArrayList
<>(
2
);
private
List
<
Edge
>
edges
;
private
Map
<
SerializablePair
<
Vertex
,
Vertex
>,
Edge
>
edgeMap
;
private
List
<
Vertex
>
vertices
;
...
...
@@ -93,14 +95,13 @@ public class Geometry extends GmlElement {
polygons
.
add
(
cdPoly
);
cdPoly
.
setParent
(
this
);
// set part of boundary surface or building installation or both
if
(
parent
instanceof
BoundarySurface
)
{
BoundarySurface
bs
=
(
BoundarySurface
)
parent
;
if
(
parent
instanceof
BoundarySurface
bs
)
{
cdPoly
.
setPartOfSurface
(
bs
);
if
(
bs
.
getParent
()
instanceof
BuildingInstallation
)
{
cdPoly
.
setPartOfInstallation
(
(
BuildingInstallation
)
bs
.
getParent
()
);
if
(
bs
.
getParent
()
instanceof
BuildingInstallation
bi
)
{
cdPoly
.
setPartOfInstallation
(
bi
);
}
}
else
if
(
parent
instanceof
BuildingInstallation
)
{
cdPoly
.
setPartOfInstallation
(
(
BuildingInstallation
)
parent
);
}
else
if
(
parent
instanceof
BuildingInstallation
bi
)
{
cdPoly
.
setPartOfInstallation
(
bi
);
}
}
...
...
@@ -323,15 +324,21 @@ public class Geometry extends GmlElement {
}
}
public
void
removePolygon
(
Polygon
p
)
{
void
removePolygon
(
Polygon
p
)
{
p
.
removeRings
();
polygons
.
remove
(
p
);
if
(!
polygons
.
remove
(
p
))
{
throw
new
IllegalStateException
(
String
.
format
(
FAILED_REMOVING_POLYGON
,
p
));
}
if
(
p
.
isLink
())
{
Polygon
original
=
p
.
getOriginal
();
original
.
getParent
().
polygons
.
remove
(
original
);
if
(!
original
.
getParent
().
polygons
.
remove
(
original
))
{
throw
new
IllegalStateException
(
String
.
format
(
FAILED_REMOVING_POLYGON
,
p
));
}
}
else
if
(
p
.
isLinkedTo
())
{
Polygon
link
=
p
.
getLinkedFromPolygon
();
link
.
getParent
().
polygons
.
remove
(
link
);
if
(!
link
.
getParent
().
polygons
.
remove
(
link
))
{
throw
new
IllegalStateException
(
String
.
format
(
FAILED_REMOVING_POLYGON
,
p
));
}
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/GmlElement.java
View file @
3f3c1884
...
...
@@ -46,6 +46,10 @@ public abstract class GmlElement extends Checkable implements Copyable {
return
gmlId
;
}
public
boolean
hasExistingGmlId
()
{
return
gmlId
!=
null
&&
!
gmlId
.
isGenerated
();
}
@Override
public
void
fillValues
(
Copyable
original
,
CopyHandler
handler
)
{
GmlElement
originalElement
=
(
GmlElement
)
original
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LandObject.java
View file @
3f3c1884
...
...
@@ -18,11 +18,11 @@
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
org.citygml4j.
factory.GMLGeometryFactory
;
import
org.citygml4j.model.
citygml.core.AbstractCityObject
;
import
org.citygml4j.
model.citygml.landuse.LandUse
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurface
;
import
org.
city
gml
4j
.model.
gml.
geometry.aggregates.MultiSurfaceProperty
;
import
org.citygml4j.
core.model.core.AbstractCityObject
;
import
org.citygml4j.
core.
model.
landuse.LandUse
;
import
org.citygml4j.
core.util.geometry.GeometryFactory
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurface
;
import
org.
xmlobjects.
gml.model.geometry.aggregates.MultiSurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
...
...
@@ -46,7 +46,7 @@ public class LandObject extends CityObject {
}
@Override
public
void
reCreateGeometries
(
GML
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
for
(
Geometry
geom
:
getGeometries
())
{
if
(
geom
.
getType
()
==
GeometryType
.
MULTI_SURFACE
)
{
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
...
...
@@ -77,7 +77,7 @@ public class LandObject extends CityObject {
lu
.
setLod3MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
case
LOD4:
lu
.
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
lu
.
getDeprecatedProperties
().
setLod4MultiSurface
(
new
MultiSurfaceProperty
(
ms
));
break
;
}
}
...
...
@@ -97,11 +97,11 @@ public class LandObject extends CityObject {
@Override
public
void
unsetGmlGeometries
()
{
lu
.
un
setLod0MultiSurface
();
lu
.
un
setLod1MultiSurface
();
lu
.
un
setLod2MultiSurface
();
lu
.
un
setLod3MultiSurface
();
lu
.
un
setLod4MultiSurface
();
lu
.
setLod0MultiSurface
(
null
);
lu
.
setLod1MultiSurface
(
null
);
lu
.
setLod2MultiSurface
(
null
);
lu
.
setLod3MultiSurface
(
null
);
lu
.
getDeprecatedProperties
().
setLod4MultiSurface
(
null
);
}
public
void
setGmlObject
(
LandUse
landUse
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java
View file @
3f3c1884
...
...
@@ -290,4 +290,9 @@ public class LinkedPolygon extends Polygon {
poly
=
handler
.
getCopyInstance
(
linkedOriginal
.
poly
);
}
@Override
public
void
remove
()
{
poly
.
remove
();
}
}
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