Skip to content

Commit

Permalink
update: [ANDROAPP-5698] remove duplicates using distinct, remove the …
Browse files Browse the repository at this point in the history
…last point
  • Loading branch information
DavidAparicioAlbaAsenjo committed Dec 14, 2023
1 parent 026e1eb commit d200599
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ class PolygonViewModel : ViewModel() {
}

return if (list[0].size > 2) {
if (list[0].last() != list[0].first()) {
for (index in 0..<list[0].size - 1) {
if (index != 0 && list[0].first() == list[0][index]) {
list[0].removeAt(index)
}
}
list[0].add(list[0][0]) // set last point same as first
}
list[0].distinct()
Gson().toJson(list)
} else {
onMessage("Polygon must contains at least 4 points.")
Expand Down

0 comments on commit d200599

Please sign in to comment.