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
7f7aa06e
Commit
7f7aa06e
authored
Aug 12, 2024
by
Riegel
Browse files
Refactored addRing method. Ref
#69
parent
27bb39a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java
View file @
7f7aa06e
...
...
@@ -30,6 +30,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Stream
;
import
org.citygml4j.core.model.CityGMLVersion
;
...
...
@@ -173,9 +174,9 @@ public class CityDoctorModel {
return
;
}
Map
<
Vertex
,
Integer
>
idMap
=
new
LinkedHashMap
<>();
int
counter
=
0
;
AtomicInteger
counter
=
new
AtomicInteger
(
0
)
;
for
(
Polygon
poly
:
highestLod
)
{
counter
=
addRing
(
poly
.
getExteriorRing
(),
idMap
,
counter
);
addRing
(
poly
.
getExteriorRing
(),
idMap
,
counter
);
}
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
folder
.
toPath
().
resolve
(
co
.
getGmlId
()
+
".off"
)))
{
...
...
@@ -209,14 +210,10 @@ public class CityDoctorModel {
});
}
private
int
addRing
(
LinearRing
ring
,
Map
<
Vertex
,
Integer
>
idMap
,
int
counter
)
{
private
void
addRing
(
LinearRing
ring
,
Map
<
Vertex
,
Integer
>
idMap
,
AtomicInteger
counter
)
{
for
(
Vertex
v
:
ring
.
getVertices
())
{
if
(!
idMap
.
containsKey
(
v
))
{
idMap
.
put
(
v
,
counter
);
counter
++;
}
idMap
.
computeIfAbsent
(
v
,
k
->
counter
.
getAndIncrement
());
}
return
counter
;
}
public
Set
<
CheckError
>
collectErrors
()
{
...
...
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