Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
ad3589e8
Commit
ad3589e8
authored
5 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Add export of CompositeSurfaces
parent
a6da3282
Pipeline
#10295
passed with stage
in 1 minute and 12 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CompositePolygon.java
+1
-0
...stuttgart/citydoctor2/datastructure/CompositePolygon.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java
+13
-0
.../stuttgart/citydoctor2/datastructure/ConcretePolygon.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/CityGmlUtils.java
+34
-6
...java/de/hft/stuttgart/citydoctor2/utils/CityGmlUtils.java
with
48 additions
and
6 deletions
+48
-6
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CompositePolygon.java
+
1
-
0
View file @
ad3589e8
...
@@ -54,6 +54,7 @@ public final class CompositePolygon extends ConcretePolygon{
...
@@ -54,6 +54,7 @@ public final class CompositePolygon extends ConcretePolygon{
public
void
addCompositeMember
(
ConcretePolygon
p
){
public
void
addCompositeMember
(
ConcretePolygon
p
){
compositeMembers
.
add
(
p
);
compositeMembers
.
add
(
p
);
p
.
setPartOfComposite
(
this
);
}
}
public
List
<
ConcretePolygon
>
getCompositeMembers
(){
public
List
<
ConcretePolygon
>
getCompositeMembers
(){
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java
+
13
-
0
View file @
ad3589e8
...
@@ -49,6 +49,7 @@ public class ConcretePolygon extends Polygon {
...
@@ -49,6 +49,7 @@ public class ConcretePolygon extends Polygon {
private
List
<
LinearRing
>
innerRings
;
private
List
<
LinearRing
>
innerRings
;
private
BoundarySurface
partOfSurface
;
private
BoundarySurface
partOfSurface
;
private
Installation
partfOfInstallation
;
private
Installation
partfOfInstallation
;
private
CompositePolygon
partOfComposite
=
null
;
private
Geometry
parent
;
private
Geometry
parent
;
private
LinkedPolygon
linkedFromPolygon
;
private
LinkedPolygon
linkedFromPolygon
;
...
@@ -138,6 +139,18 @@ public class ConcretePolygon extends Polygon {
...
@@ -138,6 +139,18 @@ public class ConcretePolygon extends Polygon {
parent
=
geometry
;
parent
=
geometry
;
}
}
protected
void
setPartOfComposite
(
CompositePolygon
comp
)
{
this
.
partOfComposite
=
comp
;
}
public
CompositePolygon
getPartOfComposite
()
{
return
partOfComposite
;
}
public
boolean
isCompositeMember
()
{
return
(
partOfComposite
!=
null
);
}
/*
/*
* (non-Javadoc)
* (non-Javadoc)
*
*
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/CityGmlUtils.java
+
34
-
6
View file @
ad3589e8
...
@@ -19,8 +19,11 @@
...
@@ -19,8 +19,11 @@
package
de.hft.stuttgart.citydoctor2.utils
;
package
de.hft.stuttgart.citydoctor2.utils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
de.hft.stuttgart.citydoctor2.datastructure.*
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.citygml4j.core.util.geometry.GeometryFactory
;
import
org.locationtech.proj4j.BasicCoordinateTransform
;
import
org.locationtech.proj4j.BasicCoordinateTransform
;
import
org.locationtech.proj4j.ProjCoordinate
;
import
org.locationtech.proj4j.ProjCoordinate
;
...
@@ -32,11 +35,6 @@ import org.xmlobjects.gml.model.geometry.primitives.ShellProperty;
...
@@ -32,11 +35,6 @@ import org.xmlobjects.gml.model.geometry.primitives.ShellProperty;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.Solid
;
import
org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty
;
import
org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GeometryType
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
/**
/**
...
@@ -81,6 +79,28 @@ public final class CityGmlUtils {
...
@@ -81,6 +79,28 @@ public final class CityGmlUtils {
return
gmlPoly
;
return
gmlPoly
;
}
}
public
static
CompositeSurface
createGmlComposite
(
GeometryFactory
factory
,
CompositePolygon
cdPoly
,
ParserConfiguration
config
)
{
List
<
ConcretePolygon
>
cdMembers
=
cdPoly
.
getCompositeMembers
();
List
<
SurfaceProperty
>
surfaces
=
new
ArrayList
<>();
for
(
ConcretePolygon
cd
:
cdMembers
)
{
surfaces
.
add
(
resolveCompositeMember
(
factory
,
cd
,
config
));
}
if
(
surfaces
.
isEmpty
()){
return
null
;
}
return
new
CompositeSurface
(
surfaces
);
}
private
static
SurfaceProperty
resolveCompositeMember
(
GeometryFactory
factory
,
ConcretePolygon
cdPoly
,
ParserConfiguration
config
){
if
(
cdPoly
instanceof
CompositePolygon
comp
)
{
return
new
SurfaceProperty
(
createGmlComposite
(
factory
,
comp
,
config
));
}
else
{
return
new
SurfaceProperty
(
createGmlPolygon
(
factory
,
cdPoly
,
config
));
}
}
public
static
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
LinearRing
createGmlRing
(
GeometryFactory
factory
,
public
static
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
LinearRing
createGmlRing
(
GeometryFactory
factory
,
ParserConfiguration
config
,
LinearRing
lr
)
{
ParserConfiguration
config
,
LinearRing
lr
)
{
...
@@ -145,8 +165,13 @@ public final class CityGmlUtils {
...
@@ -145,8 +165,13 @@ public final class CityGmlUtils {
throw
new
IllegalArgumentException
(
"This can only handle MultiSurfaces"
);
throw
new
IllegalArgumentException
(
"This can only handle MultiSurfaces"
);
}
}
List
<
SurfaceProperty
>
surfaces
=
new
ArrayList
<>();
List
<
SurfaceProperty
>
surfaces
=
new
ArrayList
<>();
Set
<
CompositePolygon
>
compositePolygons
=
new
HashSet
<>();
for
(
Polygon
cdPoly
:
geom
.
getPolygons
())
{
for
(
Polygon
cdPoly
:
geom
.
getPolygons
())
{
if
(!
cdPoly
.
isLink
())
{
if
(
cdPoly
instanceof
ConcretePolygon
conc
&&
conc
.
isCompositeMember
())
{
compositePolygons
.
add
(
conc
.
getPartOfComposite
());
}
else
if
(
cdPoly
instanceof
CompositePolygon
composite
)
{
compositePolygons
.
add
(
composite
);
}
else
if
(!
cdPoly
.
isLink
())
{
// is not part of a boundary surface
// is not part of a boundary surface
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
gmlPoly
=
createGmlPolygon
(
factory
,
cdPoly
,
config
);
org
.
xmlobjects
.
gml
.
model
.
geometry
.
primitives
.
Polygon
gmlPoly
=
createGmlPolygon
(
factory
,
cdPoly
,
config
);
if
(
gmlPoly
!=
null
)
{
if
(
gmlPoly
!=
null
)
{
...
@@ -157,6 +182,9 @@ public final class CityGmlUtils {
...
@@ -157,6 +182,9 @@ public final class CityGmlUtils {
surfaces
.
add
(
new
SurfaceProperty
(
"#"
+
cdPoly
.
getGmlId
().
getGmlString
()));
surfaces
.
add
(
new
SurfaceProperty
(
"#"
+
cdPoly
.
getGmlId
().
getGmlString
()));
}
}
}
}
for
(
CompositePolygon
cdPoly
:
compositePolygons
)
{
surfaces
.
add
(
new
SurfaceProperty
(
createGmlComposite
(
factory
,
cdPoly
,
config
)));
}
if
(
surfaces
.
isEmpty
())
{
if
(
surfaces
.
isEmpty
())
{
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets