Skip to content

Commit

Permalink
Improve getPoints() + explode() performance for large geometries (mer…
Browse files Browse the repository at this point in the history
…ges PR phayes#127)
  • Loading branch information
itamair committed Feb 4, 2023
1 parent 84803f6 commit c1a7af6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/geometry/Collection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ public function numPoints() {
public function getPoints() {
$points = array();
foreach ($this->components as $component) {
$points = array_merge($points, $component->getPoints());
foreach ($component->getPoints() as $point) {
$points[] = $point;
}
}
return $points;
}
Expand Down Expand Up @@ -290,7 +292,9 @@ public function isSimple() {
public function explode() {
$parts = array();
foreach ($this->components as $component) {
$parts = array_merge($parts, $component->explode());
foreach ($component->explode() as $subComponent) {
$parts[] = $subComponent;
}
}
return $parts;
}
Expand Down

0 comments on commit c1a7af6

Please sign in to comment.