components); for ($i = 0; $i < $componentCount; $i++) { for ($j = $i + 1; $j < $componentCount; $j++) { if ($this->components[$i]->equals($this->components[$j])) { return false; } } } return true; } /** * The boundary of a MultiPoint is the empty set. * @return GeometryCollection */ public function boundary() { return new GeometryCollection(); } public function numPoints() { return $this->numGeometries(); } public function centroid() { if ($this->isEmpty()) { return new Point(); } if ($this->getGeos()) { // @codeCoverageIgnoreStart /** @noinspection PhpUndefinedMethodInspection */ return geoPHP::geosToGeometry($this->getGeos()->centroid()); // @codeCoverageIgnoreEnd } $x = 0; $y = 0; foreach ($this->getComponents() as $component) { $x += $component->x(); $y += $component->y(); } return new Point($x / $this->numPoints(), $y / $this->numPoints()); } // Not valid for this geometry type // -------------------------------- public function explode($toArray = false) { return null; } }