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
15ef3d5e
Commit
15ef3d5e
authored
Mar 13, 2025
by
Riegel
Browse files
Fix: Add new TransportationObject model to calculator
parent
c2a12ed4
Changes
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/BoundingBoxCalculator.java
View file @
15ef3d5e
...
...
@@ -26,6 +26,10 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.TopLevelTransportFeature
;
import
de.hft.stuttgart.citydoctor2.datastructure.TrafficSpaceObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.TransportationObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.TransportationSpace
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
...
...
@@ -98,12 +102,16 @@ public class BoundingBoxCalculator {
Vector3d
low
=
new
Vector3d
(
Double
.
MAX_VALUE
,
Double
.
MAX_VALUE
,
Double
.
MAX_VALUE
);
Vector3d
high
=
new
Vector3d
(
Double
.
NEGATIVE_INFINITY
,
Double
.
NEGATIVE_INFINITY
,
Double
.
NEGATIVE_INFINITY
);
//TODO: Rework this using visitors
findMinMax
(
low
,
high
,
model
.
getBuildings
());
findMinMax
(
low
,
high
,
model
.
getBridges
());
findMinMax
(
low
,
high
,
model
.
getLand
());
findMinMax
(
low
,
high
,
model
.
getTransportation
());
findMinMax
Transport
(
low
,
high
,
model
.
getTransportation
());
findMinMax
(
low
,
high
,
model
.
getWater
());
findMinMax
(
low
,
high
,
model
.
getVegetation
());
findMinMax
(
low
,
high
,
model
.
getTunnels
());
findMinMax
(
low
,
high
,
model
.
getCityFurniture
());
findMinMax
(
low
,
high
,
model
.
getGenericCityObjects
());
Vector3d
[]
result
=
new
Vector3d
[
2
];
result
[
0
]
=
low
;
...
...
@@ -151,6 +159,23 @@ public class BoundingBoxCalculator {
}
}
//TODO: Implement this properly with visitor. Quick and dirty fix for the renderer
private
static
void
findMinMaxTransport
(
Vector3d
low
,
Vector3d
high
,
List
<?
extends
TransportationObject
>
features
)
{
for
(
TransportationObject
to
:
features
)
{
findMinMax
(
low
,
high
,
to
);
if
(
to
instanceof
TransportationSpace
ts
)
{
findMinMaxTransport
(
low
,
high
,
ts
.
getTrafficSpaces
());
findMinMaxTransport
(
low
,
high
,
ts
.
getAuxTrafficSpaces
());
if
(
to
instanceof
TopLevelTransportFeature
top
)
{
findMinMaxTransport
(
low
,
high
,
top
.
getSections
());
findMinMaxTransport
(
low
,
high
,
top
.
getIntersections
());
}
}
else
if
(
to
instanceof
TrafficSpaceObject
tso
)
{
findMinMaxTransport
(
low
,
high
,
tso
.
getTrafficAreas
());
}
}
}
private
static
void
findMinMax
(
Vector3d
low
,
Vector3d
high
,
CityObject
co
)
{
for
(
Geometry
geom
:
co
.
getGeometries
())
{
if
(
geom
.
getVertices
()
==
null
)
{
...
...
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