Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
d9d18caa
Commit
d9d18caa
authored
Jan 26, 2026
by
Luna Riegel
Browse files
Refactor: Build feature bboxes during parsing
parent
7a51e009
Changes
4
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundingBox.java
View file @
d9d18caa
...
@@ -22,6 +22,8 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d;
...
@@ -22,6 +22,8 @@ import de.hft.stuttgart.citydoctor2.math.Vector3d;
import
de.hft.stuttgart.citydoctor2.utils.BoundingBoxCalculator
;
import
de.hft.stuttgart.citydoctor2.utils.BoundingBoxCalculator
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.MinMaxExtentVisitor
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.MinMaxExtentVisitor
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
...
@@ -31,7 +33,10 @@ import java.util.Locale;
...
@@ -31,7 +33,10 @@ import java.util.Locale;
*
*
* @author Matthias Betz
* @author Matthias Betz
*/
*/
public
class
BoundingBox
{
public
class
BoundingBox
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1998769586245522486L
;
private
final
Vector3d
[]
bbox
;
private
final
Vector3d
[]
bbox
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java
View file @
d9d18caa
...
@@ -43,7 +43,7 @@ public abstract class CityObject extends GmlElement {
...
@@ -43,7 +43,7 @@ public abstract class CityObject extends GmlElement {
@Serial
@Serial
private
static
final
long
serialVersionUID
=
651712070755024188L
;
private
static
final
long
serialVersionUID
=
651712070755024188L
;
private
BoundingBox
bbox
;
private
final
List
<
Geometry
>
geometryList
=
new
ArrayList
<>();
private
final
List
<
Geometry
>
geometryList
=
new
ArrayList
<>();
private
final
List
<
GenericAttribute
>
genericAttributeList
=
new
ArrayList
<>();
private
final
List
<
GenericAttribute
>
genericAttributeList
=
new
ArrayList
<>();
...
@@ -88,6 +88,14 @@ public abstract class CityObject extends GmlElement {
...
@@ -88,6 +88,14 @@ public abstract class CityObject extends GmlElement {
this
.
accept
(
new
UnsetGeometriesVisitor
());
this
.
accept
(
new
UnsetGeometriesVisitor
());
}
}
public
void
setBbox
(
BoundingBox
bbox
){
this
.
bbox
=
bbox
;
}
public
BoundingBox
getBbox
(){
return
bbox
;
}
/**
/**
* Adds a Geometry to this object.
* Adds a Geometry to this object.
* @param geom the Geometry to add.
* @param geom the Geometry to add.
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ImplicitGeometryHolder.java
View file @
d9d18caa
...
@@ -61,6 +61,7 @@ public class ImplicitGeometryHolder extends Geometry {
...
@@ -61,6 +61,7 @@ public class ImplicitGeometryHolder extends Geometry {
if
(!
deferredRelGeomObjects
.
isEmpty
())
{
if
(!
deferredRelGeomObjects
.
isEmpty
())
{
logger
.
info
(
"Resolving deferred relative geometries"
);
logger
.
info
(
"Resolving deferred relative geometries"
);
}
}
Set
<
GmlId
>
changedFeatures
=
new
HashSet
<>();
for
(
ImplicitGeometryHolder
key
:
deferredRelGeomObjects
.
keySet
())
{
for
(
ImplicitGeometryHolder
key
:
deferredRelGeomObjects
.
keySet
())
{
ImplicitGeometry
ig
=
deferredRelGeomObjects
.
get
(
key
);
ImplicitGeometry
ig
=
deferredRelGeomObjects
.
get
(
key
);
String
hrefId
=
ig
.
getRelativeGeometry
().
getHref
();
String
hrefId
=
ig
.
getRelativeGeometry
().
getHref
();
...
@@ -72,10 +73,15 @@ public class ImplicitGeometryHolder extends Geometry {
...
@@ -72,10 +73,15 @@ public class ImplicitGeometryHolder extends Geometry {
CityObject
parent
=
cache
.
get
(
key
.
getParent
().
getGmlId
());
CityObject
parent
=
cache
.
get
(
key
.
getParent
().
getGmlId
());
parent
.
removeGeometry
(
igh
.
getLod
(),
igh
.
getType
());
parent
.
removeGeometry
(
igh
.
getLod
(),
igh
.
getType
());
parent
.
addGeometry
(
igh
);
parent
.
addGeometry
(
igh
);
changedFeatures
.
add
(
parent
.
getTopLevelCityObject
().
getGmlId
());
}
else
{
}
else
{
missingGeoms
.
add
(
gmlId
);
missingGeoms
.
add
(
gmlId
);
}
}
}
}
changedFeatures
.
forEach
(
gmlId
->
{
CityObject
co
=
cache
.
get
(
gmlId
);
co
.
setBbox
(
BoundingBox
.
of
(
co
));
});
if
(!
missingGeoms
.
isEmpty
())
{
if
(!
missingGeoms
.
isEmpty
())
{
logger
.
warn
(
"RelativeGeometries of the following gmlIDs could not be resolved: {}"
,
missingGeoms
);
logger
.
warn
(
"RelativeGeometries of the following gmlIDs could not be resolved: {}"
,
missingGeoms
);
}
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
d9d18caa
...
@@ -28,6 +28,7 @@ import java.util.function.Function;
...
@@ -28,6 +28,7 @@ import java.util.function.Function;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.FeatureCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.database.UnconnectedCache
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundingBox
;
import
de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -940,6 +941,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -940,6 +941,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
co
.
clearGmlGeometries
();
co
.
clearGmlGeometries
();
resolveAndClearReferences
(
co
);
resolveAndClearReferences
(
co
);
updateEdgesAndVertices
(
co
);
updateEdgesAndVertices
(
co
);
co
.
setBbox
(
BoundingBox
.
of
(
co
));
}
}
private
void
mapAbstractTransportationSpace
(
AbstractTransportationSpace
ats
,
TransportationSpace
trsp
)
{
private
void
mapAbstractTransportationSpace
(
AbstractTransportationSpace
ats
,
TransportationSpace
trsp
)
{
...
...
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