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
ef413298
Commit
ef413298
authored
Jun 04, 2025
by
Riegel
Browse files
Feature: Add 2D WKT representation for bbox
parent
b50c5f13
Changes
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundingBox.java
View file @
ef413298
...
@@ -161,4 +161,29 @@ public class BoundingBox {
...
@@ -161,4 +161,29 @@ public class BoundingBox {
public
double
getDiagonalLength
()
{
public
double
getDiagonalLength
()
{
return
bbox
[
1
].
getDistance
(
bbox
[
0
]);
return
bbox
[
1
].
getDistance
(
bbox
[
0
]);
}
}
/**
* Returns a WKT polygon representation in 2D (the "shadow") of this bbox
*
* @return WKT String of this bbox's shadow
*/
public
String
toWktShadow
()
{
double
x1
=
bbox
[
0
].
getX
();
double
y1
=
bbox
[
0
].
getY
();
double
x2
=
x1
+
bbox
[
1
].
getX
();
double
y2
=
y1
+
bbox
[
1
].
getY
();
double
minX
=
Math
.
min
(
x1
,
x2
);
double
minY
=
Math
.
min
(
y1
,
y2
);
double
maxX
=
Math
.
max
(
x1
,
x2
);
double
maxY
=
Math
.
max
(
y1
,
y2
);
return
String
.
format
(
"POLYGON((%.3f %.3f, %.3f %.3f, %.3f %.3f, %.3f %.3f, %.3f %.3f))"
,
minX
,
minY
,
maxX
,
minY
,
maxX
,
maxY
,
minX
,
maxY
,
minX
,
minY
);
}
}
}
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