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
5b2b2c74
Commit
5b2b2c74
authored
Feb 18, 2026
by
Luna Riegel
Browse files
Docs: Add JavaDoc
parent
ad0c25f1
Pipeline
#12342
failed with stage
in 2 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/HighlightController.java
View file @
5b2b2c74
...
@@ -70,67 +70,108 @@ public class HighlightController {
...
@@ -70,67 +70,108 @@ public class HighlightController {
}
}
/**
/**
*
Adds a highlight
*
Clears existing highlights and adds a highlight geometry to a {@link TriangulatedGeometry}.
* @param p
* @param p
a polygon to highlight
* @param
currentTriGeom
* @param
triGeom the TriangulatedGeometry
*/
*/
public
void
highlight
(
Polygon
p
,
TriangulatedGeometry
currentT
riGeom
)
{
public
void
highlight
(
Polygon
p
,
TriangulatedGeometry
t
riGeom
)
{
clearHighlights
();
clearHighlights
();
addPolygonHighlight
(
p
,
currentT
riGeom
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
ORANGE
);
addPolygonHighlight
(
p
,
t
riGeom
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
ORANGE
);
}
}
public
void
highlight
(
LinearRing
ring
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlight geometry to a {@link TriangulatedGeometry}.
* @param ring a linear-ring to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlight
(
LinearRing
ring
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
if
(
ring
.
getType
()
==
LinearRingType
.
EXTERIOR
)
{
if
(
ring
.
getType
()
==
LinearRingType
.
EXTERIOR
)
{
addRingHighlight
(
ring
,
currentT
riGeom
,
Color
.
RED
,
Color
.
ORANGE
);
addRingHighlight
(
ring
,
t
riGeom
,
Color
.
RED
,
Color
.
ORANGE
);
}
else
{
}
else
{
addRingHighlight
(
ring
,
currentT
riGeom
,
Color
.
BLUE
,
Color
.
ORANGE
);
addRingHighlight
(
ring
,
t
riGeom
,
Color
.
BLUE
,
Color
.
ORANGE
);
}
}
}
}
public
void
highlight
(
Edge
e
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlight geometry to a {@link TriangulatedGeometry}.
* @param e an edge to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlight
(
Edge
e
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
addEdgeHighlight
(
e
,
currentTriGeom
);
addEdgeHighlight
(
e
,
triGeom
,
Color
.
RED
,
Color
.
ORANGE
);
}
}
public
void
highlight
(
Vertex
v
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlight geometry to a {@link TriangulatedGeometry}.
* @param v a vertex to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlight
(
Vertex
v
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
addVertexHighlight
(
v
,
currentT
riGeom
,
Color
.
RED
);
addVertexHighlight
(
v
,
t
riGeom
,
Color
.
RED
);
}
}
public
void
highlight
(
Triangle3d
t
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlight geometry to a {@link TriangulatedGeometry}.
* @param t a triangle to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlight
(
Triangle3d
t
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
addSegmentHighlight
(
t
.
getP1
(),
t
.
getP2
(),
currentT
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
addSegmentHighlight
(
t
.
getP1
(),
t
.
getP2
(),
t
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
addSegmentHighlight
(
t
.
getP2
(),
t
.
getP3
(),
currentT
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
addSegmentHighlight
(
t
.
getP2
(),
t
.
getP3
(),
t
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
addSegmentHighlight
(
t
.
getP3
(),
t
.
getP1
(),
currentT
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
addSegmentHighlight
(
t
.
getP3
(),
t
.
getP1
(),
t
riGeom
.
getMovedBy
(),
Color
.
ORANGE
);
}
}
public
void
highlightRings
(
List
<
LinearRing
>
rings
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlighted collection of linear-rings to a {@link TriangulatedGeometry}.
* @param rings a collection of linear-rings to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightRings
(
Collection
<
LinearRing
>
rings
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
for
(
LinearRing
lr
:
rings
)
{
for
(
LinearRing
lr
:
rings
)
{
if
(
lr
.
getType
()
==
LinearRingType
.
EXTERIOR
)
{
if
(
lr
.
getType
()
==
LinearRingType
.
EXTERIOR
)
{
addRingHighlight
(
lr
,
currentT
riGeom
,
Color
.
RED
,
Color
.
ORANGE
);
addRingHighlight
(
lr
,
t
riGeom
,
Color
.
RED
,
Color
.
ORANGE
);
}
else
{
}
else
{
addRingHighlight
(
lr
,
currentT
riGeom
,
Color
.
BLUE
,
Color
.
ORANGE
);
addRingHighlight
(
lr
,
t
riGeom
,
Color
.
BLUE
,
Color
.
ORANGE
);
}
}
}
}
}
}
public
void
highlightEdges
(
List
<
Edge
>
errorEdges
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlighted collection of edges to a {@link TriangulatedGeometry}.
* @param edges a collection of edges to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightEdges
(
Collection
<
Edge
>
edges
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
for
(
Edge
e
:
e
rrorE
dges
)
{
for
(
Edge
e
:
edges
)
{
addEdgeHighlight
(
e
,
currentTriGeom
);
addEdgeHighlight
(
e
,
triGeom
,
Color
.
RED
,
Color
.
ORANGE
);
}
}
}
}
public
void
highlightPolygons
(
Collection
<
Polygon
>
polygons
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and adds a highlighted collection of polygons to a {@link TriangulatedGeometry}.
* @param polygons a collection of edges to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightPolygons
(
Collection
<
Polygon
>
polygons
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
for
(
Polygon
p
:
polygons
)
{
for
(
Polygon
p
:
polygons
)
{
addPolygonHighlight
(
p
,
currentT
riGeom
);
addPolygonHighlight
(
p
,
t
riGeom
);
}
}
}
}
public
void
highlightPolygonClusters
(
List
<
List
<
Polygon
>>
components
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and highlights a list of polygon clusters in a {@link TriangulatedGeometry}. Cycles
* between three vertex color-schemes to distinguish the clusters.
* @param components a list of polygon-lists representing clusters
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightPolygonClusters
(
List
<
List
<
Polygon
>>
components
,
TriangulatedGeometry
triGeom
)
{
clearHighlights
();
clearHighlights
();
for
(
int
i
=
0
;
i
<
components
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
components
.
size
();
i
++)
{
Color
extColor
;
Color
extColor
;
...
@@ -151,16 +192,23 @@ public class HighlightController {
...
@@ -151,16 +192,23 @@ public class HighlightController {
// select some color pairs for exterior and inner rings
// select some color pairs for exterior and inner rings
List
<
Polygon
>
component
=
components
.
get
(
i
);
List
<
Polygon
>
component
=
components
.
get
(
i
);
for
(
Polygon
p
:
component
)
{
for
(
Polygon
p
:
component
)
{
addPolygonHighlight
(
p
,
currentT
riGeom
,
extColor
,
intColor
,
Color
.
ORANGE
);
addPolygonHighlight
(
p
,
t
riGeom
,
extColor
,
intColor
,
Color
.
ORANGE
);
}
}
}
}
}
}
private
void
addRingHighlight
(
LinearRing
ring
,
TriangulatedGeometry
currentTriGeom
,
Color
pointColor
,
Color
edgeColor
)
{
/**
if
(
currentTriGeom
==
null
||
ring
==
null
)
{
* Adds a linear-ring highlight to a {@link TriangulatedGeometry}.
* @param ring the ring to highlight
* @param triGeom the TriangulatedGeometry
* @param pointColor color for the vertex highlights
* @param edgeColor color for the edge highlights
*/
private
void
addRingHighlight
(
LinearRing
ring
,
TriangulatedGeometry
triGeom
,
Color
pointColor
,
Color
edgeColor
)
{
if
(
triGeom
==
null
||
ring
==
null
)
{
return
;
return
;
}
}
Vector3d
movedBy
=
currentT
riGeom
.
getMovedBy
();
Vector3d
movedBy
=
t
riGeom
.
getMovedBy
();
for
(
Vertex
v
:
ring
.
getVertices
())
{
for
(
Vertex
v
:
ring
.
getVertices
())
{
addPointHighlight
(
movedBy
,
v
,
pointColor
);
addPointHighlight
(
movedBy
,
v
,
pointColor
);
}
}
...
@@ -171,36 +219,61 @@ public class HighlightController {
...
@@ -171,36 +219,61 @@ public class HighlightController {
}
}
}
}
private
void
addPolygonHighlight
(
Polygon
p
,
TriangulatedGeometry
currentTriGeom
,
Color
extColor
,
Color
intColor
,
Color
edgeColor
)
{
/**
if
(
currentTriGeom
==
null
||
p
==
null
)
{
* Adds a polygon highlight to a {@link TriangulatedGeometry}.
* @param p the polygon to highlight
* @param triGeom the TriangulatedGeometry
* @param extColor color for the vertex highlights of the exterior ring
* @param intColor color for the vertex highlights of the interior rings
* @param edgeColor color for the edge highlights
*/
private
void
addPolygonHighlight
(
Polygon
p
,
TriangulatedGeometry
triGeom
,
Color
extColor
,
Color
intColor
,
Color
edgeColor
)
{
if
(
triGeom
==
null
||
p
==
null
)
{
return
;
return
;
}
}
addRingHighlight
(
p
.
getExteriorRing
(),
currentT
riGeom
,
extColor
,
edgeColor
);
addRingHighlight
(
p
.
getExteriorRing
(),
t
riGeom
,
extColor
,
edgeColor
);
for
(
LinearRing
intRing
:
p
.
getInnerRings
())
{
for
(
LinearRing
intRing
:
p
.
getInnerRings
())
{
addRingHighlight
(
intRing
,
currentT
riGeom
,
intColor
,
edgeColor
);
addRingHighlight
(
intRing
,
t
riGeom
,
intColor
,
edgeColor
);
}
}
}
}
/**
private
void
addEdgeHighlight
(
Edge
e
,
TriangulatedGeometry
currentTriGeom
)
{
* Adds an edge highlight to a {@link TriangulatedGeometry}.
if
(
currentTriGeom
==
null
||
e
==
null
)
{
* @param e the polygon to highlight
* @param triGeom the TriangulatedGeometry
* @param pointColor color for the vertex highlights
* @param edgeColor color for the edge highlight
*/
private
void
addEdgeHighlight
(
Edge
e
,
TriangulatedGeometry
triGeom
,
Color
pointColor
,
Color
edgeColor
)
{
if
(
triGeom
==
null
||
e
==
null
)
{
return
;
return
;
}
}
Vector3d
movedBy
=
currentT
riGeom
.
getMovedBy
();
Vector3d
movedBy
=
t
riGeom
.
getMovedBy
();
addSegmentHighlight
(
e
.
getFrom
(),
e
.
getTo
(),
movedBy
,
Color
.
ORANGE
);
addSegmentHighlight
(
e
.
getFrom
(),
e
.
getTo
(),
movedBy
,
edge
Color
);
addPointHighlight
(
movedBy
,
e
.
getFrom
(),
Color
.
RED
);
addPointHighlight
(
movedBy
,
e
.
getFrom
(),
point
Color
);
addPointHighlight
(
movedBy
,
e
.
getTo
(),
Color
.
RED
);
addPointHighlight
(
movedBy
,
e
.
getTo
(),
point
Color
);
}
}
/**
public
void
addVertexHighlight
(
Vertex
v
,
TriangulatedGeometry
currentTriGeom
,
Color
c
)
{
* Adds a vertex highlight to a {@link TriangulatedGeometry}.
if
(
currentTriGeom
==
null
||
v
==
null
)
{
* @param v the polygon to highlight
* @param triGeom the TriangulatedGeometry
* @param color color for the highlight
*/
public
void
addVertexHighlight
(
Vertex
v
,
TriangulatedGeometry
triGeom
,
Color
color
)
{
if
(
triGeom
==
null
||
v
==
null
)
{
return
;
return
;
}
}
Vector3d
movedBy
=
currentT
riGeom
.
getMovedBy
();
Vector3d
movedBy
=
t
riGeom
.
getMovedBy
();
addPointHighlight
(
movedBy
,
v
,
c
);
addPointHighlight
(
movedBy
,
v
,
c
olor
);
}
}
/**
* Creates a colored point in the JavaFX scenegraph at the relative position of a Vertex within a {@link TriangulatedGeometry}.
* @param movedBy offset vector of the origin of the TriangulatedGeometry
* @param v the vertex to highlight
* @param color color for the highlight
*/
private
void
addPointHighlight
(
Vector3d
movedBy
,
Vertex
v
,
Color
color
)
{
private
void
addPointHighlight
(
Vector3d
movedBy
,
Vertex
v
,
Color
color
)
{
Sphere
sp
=
new
Sphere
(
0.5
);
Sphere
sp
=
new
Sphere
(
0.5
);
sp
.
setMaterial
(
new
PhongMaterial
(
color
));
sp
.
setMaterial
(
new
PhongMaterial
(
color
));
...
@@ -216,6 +289,13 @@ public class HighlightController {
...
@@ -216,6 +289,13 @@ public class HighlightController {
points
.
getChildren
().
add
(
sp
);
points
.
getChildren
().
add
(
sp
);
}
}
/**
* Creates a colored segment in the JavaFX scenegraph at the relative position of an edge within a {@link TriangulatedGeometry}.
* @param v1 start point of the edge
* @param v2 end point of the edge
* @param movedBy offset vector of the origin of the TriangulatedGeometry
* @param color color for the highlight
*/
private
void
addSegmentHighlight
(
Vector3d
v1
,
Vector3d
v2
,
Vector3d
movedBy
,
Color
color
)
{
private
void
addSegmentHighlight
(
Vector3d
v1
,
Vector3d
v2
,
Vector3d
movedBy
,
Color
color
)
{
Point3D
origin
=
new
Point3D
(
v1
.
getX
()
-
movedBy
.
getX
(),
v1
.
getY
()
-
movedBy
.
getY
(),
Point3D
origin
=
new
Point3D
(
v1
.
getX
()
-
movedBy
.
getX
(),
v1
.
getY
()
-
movedBy
.
getY
(),
v1
.
getZ
()
-
movedBy
.
getZ
());
v1
.
getZ
()
-
movedBy
.
getZ
());
...
@@ -239,46 +319,91 @@ public class HighlightController {
...
@@ -239,46 +319,91 @@ public class HighlightController {
edges
.
getChildren
().
add
(
cy
);
edges
.
getChildren
().
add
(
cy
);
}
}
public
void
addCandidateSkeletonHighlight
(
CityObject
candidate
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Adds a gray wireframe highlight of a CityObject to a {@link TriangulatedGeometry} to allow for unobtrusive
* display of candidate features in TopologicalErrors.
* @param candidate the candidate feature
* @param triGeom the TriangulatedGeometry
*/
public
void
addCandidateSkeletonHighlight
(
CityObject
candidate
,
TriangulatedGeometry
triGeom
)
{
candidate
.
accept
(
new
CheckableUtilsVisitor
()
{
candidate
.
accept
(
new
CheckableUtilsVisitor
()
{
@Override
@Override
public
void
check
(
Geometry
geom
)
{
public
void
check
(
Geometry
geom
)
{
geom
.
getPolygons
().
forEach
(
p
->
{
geom
.
getPolygons
().
forEach
(
p
->
{
addPolygonHighlight
(
p
,
currentT
riGeom
,
Color
.
GRAY
,
Color
.
GRAY
,
Color
.
DARKGRAY
);
addPolygonHighlight
(
p
,
t
riGeom
,
Color
.
GRAY
,
Color
.
GRAY
,
Color
.
DARKGRAY
);
});
});
}
}
});
});
}
}
public
void
addPolygonHighlight
(
Polygon
p
,
TriangulatedGeometry
currentTriGeom
)
{
/**
addPolygonHighlight
(
p
,
currentTriGeom
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
ORANGE
);
* Adds a polygon highlight to a {@link TriangulatedGeometry}.
* @param p the polygon to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
addPolygonHighlight
(
Polygon
p
,
TriangulatedGeometry
triGeom
)
{
addPolygonHighlight
(
p
,
triGeom
,
Color
.
RED
,
Color
.
BLUE
,
Color
.
ORANGE
);
}
}
public
void
addCandidateHighlight
(
Polygon
p
,
TriangulatedGeometry
currentTriGeom
)
{
/**
addPolygonHighlight
(
p
,
currentTriGeom
,
Color
.
DARKRED
,
Color
.
NAVY
,
Color
.
ROSYBROWN
);
* Adds a polygon highlight to a {@link TriangulatedGeometry}, using darker colors to differentiate candidate polygons.
* @param p the polygon to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
addCandidateHighlight
(
Polygon
p
,
TriangulatedGeometry
triGeom
)
{
addPolygonHighlight
(
p
,
triGeom
,
Color
.
DARKRED
,
Color
.
NAVY
,
Color
.
ROSYBROWN
);
}
}
public
void
addCandidateHighlight
(
Collection
<
Polygon
>
polys
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Adds highlights for a collection of polygons to a {@link TriangulatedGeometry}, using darker colors to
* differentiate candidate polygons.
* @param polys the polygons to highlight
* @param triGeom the TriangulatedGeometry
*/
public
void
addCandidateHighlight
(
Collection
<
Polygon
>
polys
,
TriangulatedGeometry
triGeom
)
{
for
(
Polygon
p
:
polys
)
{
for
(
Polygon
p
:
polys
)
{
addCandidateHighlight
(
p
,
currentT
riGeom
);
addCandidateHighlight
(
p
,
t
riGeom
);
}
}
}
}
public
void
highlightGeometryCollisions
(
CollisionRecord
collRecord
,
TriangulatedGeometry
currentTriGeom
)
{
/**
* Clears existing highlights and highlights polygons within a {@link TriangulatedGeometry}, which were found to be
* colliding by the feature collision check. Darker colors will be used for differentiating the candidate polygons.
*
* @param collRecord the collision record of the check
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightGeometryCollisions
(
CollisionRecord
collRecord
,
TriangulatedGeometry
triGeom
)
{
Map
<
Polygon
,
List
<
Polygon
>>
collisionMap
=
collRecord
.
collisionMap
();
Map
<
Polygon
,
List
<
Polygon
>>
collisionMap
=
collRecord
.
collisionMap
();
Set
<
Polygon
>
collidingPolys
=
collisionMap
.
values
().
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toSet
());
Set
<
Polygon
>
collidingPolys
=
collisionMap
.
values
().
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toSet
());
highlightTopoPolygonGroups
(
collisionMap
.
keySet
(),
collidingPolys
,
currentT
riGeom
);
highlightTopoPolygonGroups
(
collisionMap
.
keySet
(),
collidingPolys
,
t
riGeom
);
}
}
public
void
highlightTopoPolygonPair
(
Polygon
subject
,
Polygon
candidate
,
TriangulatedGeometry
currentTriGeom
)
{
/**
highlight
(
subject
,
currentTriGeom
);
* Clears existing highlights and highlight a polygon pair within a {@link TriangulatedGeometry}, which were found to
addCandidateHighlight
(
candidate
,
currentTriGeom
);
* be conflicting a topological requirement. Darker colors will be used for differentiating the candidate polygon.
*
* @param subject the subject polygon
* @param candidate the candidate polygon
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightTopoPolygonPair
(
Polygon
subject
,
Polygon
candidate
,
TriangulatedGeometry
triGeom
)
{
highlight
(
subject
,
triGeom
);
addCandidateHighlight
(
candidate
,
triGeom
);
}
}
/**
* Clears existing highlights and highlights polygons {@link TriangulatedGeometry} which were found to
* be conflicting a topological requirement. Darker colors will be used for differentiating the candidate polygons.
*
* @param subjectPolys the subject polygons
* @param candidatePolys the candidate polygons
* @param triGeom the TriangulatedGeometry
*/
public
void
highlightTopoPolygonGroups
(
Collection
<
Polygon
>
subjectPolys
,
Collection
<
Polygon
>
candidatePolys
,
public
void
highlightTopoPolygonGroups
(
Collection
<
Polygon
>
subjectPolys
,
Collection
<
Polygon
>
candidatePolys
,
TriangulatedGeometry
currentT
riGeom
)
{
TriangulatedGeometry
t
riGeom
)
{
highlightPolygons
(
subjectPolys
,
currentT
riGeom
);
highlightPolygons
(
subjectPolys
,
t
riGeom
);
addCandidateHighlight
(
candidatePolys
,
currentT
riGeom
);
addCandidateHighlight
(
candidatePolys
,
t
riGeom
);
}
}
...
...
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