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
0a7d6299
Commit
0a7d6299
authored
Nov 26, 2020
by
Matthias Betz
Browse files
clearing adjacency list if unneeded, improving memory management
parent
d163d7c4
Pipeline
#1375
passed with stage
in 2 minutes and 2 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java
View file @
0a7d6299
...
...
@@ -329,15 +329,15 @@ public class Geometry extends GmlElement {
public
void
updateVertices
()
{
Set
<
Vertex
>
vertexSet
=
new
HashSet
<>();
for
(
Polygon
p
:
getPolygons
())
{
updateRing
(
p
,
vertexSet
,
p
.
getExteriorRing
());
updateRing
(
vertexSet
,
p
.
getExteriorRing
());
for
(
LinearRing
inner
:
p
.
getInnerRings
())
{
updateRing
(
p
,
vertexSet
,
inner
);
updateRing
(
vertexSet
,
inner
);
}
}
vertices
=
new
ArrayList
<>(
vertexSet
);
}
private
void
updateRing
(
Polygon
p
,
Set
<
Vertex
>
vertexSet
,
LinearRing
ring
)
{
private
void
updateRing
(
Set
<
Vertex
>
vertexSet
,
LinearRing
ring
)
{
for
(
Vertex
v
:
ring
.
getVertices
())
{
if
(
vertexSet
.
add
(
v
))
{
// new vertex, clear adjacent rings in case new rings have been added
...
...
@@ -413,6 +413,9 @@ public class Geometry extends GmlElement {
@Override
public
void
clearMetaInformation
()
{
for
(
Vertex
v
:
vertices
)
{
v
.
clearAdjacentRings
();
}
edges
=
null
;
vertices
=
null
;
edgeMap
=
null
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vertex.java
View file @
0a7d6299
...
...
@@ -197,4 +197,11 @@ public class Vertex extends Vector3d {
}
return
false
;
}
/**
* Remove all adjacent rings from this vertex, ignoring geometry association
*/
void
clearAdjacentRings
()
{
adjacentRings
=
new
ArrayList
<>(
2
);
}
}
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