/** * @dataProvider providerCreate * * @param string[] $patchesWKT The WKT of the patches (polygons) that compose the PolyhedralSurface. * @param boolean $is3D Whether the patches have Z coordinates. * @param boolean $isMeasured Whether the patches have M coordinates. * @param string $polyhedralSurfaceWKT The WKT of the expected PolyhedralSurface. */ public function testCreate(array $patchesWKT, $is3D, $isMeasured, $polyhedralSurfaceWKT) { foreach ([0, 1] as $srid) { $instantiatePolygon = function ($patch) use($srid) { return Polygon::fromText($patch, $srid); }; $cs = new CoordinateSystem($is3D, $isMeasured, $srid); $polyhedralSurface = new PolyhedralSurface($cs, ...array_map($instantiatePolygon, $patchesWKT)); $this->assertWktEquals($polyhedralSurface, $polyhedralSurfaceWKT, $srid); } }
/** * @dataProvider providerInteriorRingN * * @param string $polygon The WKT of the Polygon to test. * @param integer $n The ring number. * @param string|null $interiorRingN The WKT of the expected interior ring, or NULL if an exception is expected. * @param integer $srid The SRID of the geometries. */ public function testInteriorRingN($polygon, $n, $interiorRingN, $srid) { if ($interiorRingN === null) { $this->setExpectedException(NoSuchGeometryException::class); } $ring = Polygon::fromText($polygon, $srid)->interiorRingN($n); $this->assertWktEquals($ring, $interiorRingN, $srid); }
/** * Loads the underlying geometry. * * @return void * * @throws GeometryIOException If the proxy data is not valid. * @throws CoordinateSystemException If the resulting geometry contains mixed coordinate systems. * @throws InvalidGeometryException If the resulting geometry is not valid. * @throws UnexpectedGeometryException If the resulting geometry is not an instance of the proxied class. */ private function load() { $this->proxyGeometry = $this->proxyIsBinary ? Polygon::fromBinary($this->proxyData, $this->proxySRID) : Polygon::fromText($this->proxyData, $this->proxySRID); }