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
99385663
Commit
99385663
authored
Jul 23, 2025
by
Riegel
Browse files
Refactor: Add BBox calculation for single CityObjects
parent
1970e72e
Changes
2
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/DatabaseHandler.java
View file @
99385663
...
...
@@ -76,7 +76,7 @@ public class DatabaseHandler {
try
(
Connection
con
=
new
ConnectionWrapper
(
H2GISDBFactory
.
openSpatialDataBase
(
DB_NAME
)))
{
try
(
PreparedStatement
ps
=
con
.
prepareStatement
(
"MERGE INTO features VALUES (?, ?, ?, ?)"
))
{
ps
.
setString
(
1
,
co
.
getGmlId
().
toString
());
String
bbox
=
BoundingBox
.
of
(
co
.
getHighestLodGeometry
().
getPolygons
()
).
to2DWkt
();
String
bbox
=
BoundingBox
.
of
(
co
).
to2DWkt
();
ps
.
setString
(
2
,
bbox
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Attempting to serialize city object {} "
,
co
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundingBox.java
View file @
99385663
...
...
@@ -20,6 +20,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
de.hft.stuttgart.citydoctor2.utils.BoundingBoxCalculator
;
import
de.hft.stuttgart.citydoctor2.utils.visitors.MinMaxExtentVisitor
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -47,6 +48,12 @@ public class BoundingBox {
return
BoundingBoxCalculator
.
calculateBoundingBoxFromPoints
(
points
);
}
public
static
BoundingBox
of
(
CityObject
co
)
{
MinMaxExtentVisitor
mima
=
new
MinMaxExtentVisitor
();
co
.
accept
(
mima
);
return
BoundingBox
.
of
(
mima
.
getMinMaxExtent
());
}
/**
* Creates an axis aligned bounding box of the whole model.
*
...
...
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