コード例 #1
0
ファイル: PolyhedralSurfaceTest.php プロジェクト: brick/geo
 /**
  * Tests Countable and Traversable interfaces.
  */
 public function testInterfaces()
 {
     $polyhedralSurface = PolyhedralSurface::fromText('POLYHEDRALSURFACE(((0 0, 0 1, 1 1, 1 0, 0 0)), ((1 0, 1 1, 2 1, 2 0, 1 0)), ((2 0, 2 1, 3 1, 3 0, 2 0)))');
     $this->assertInstanceOf(\Countable::class, $polyhedralSurface);
     $this->assertSame(3, count($polyhedralSurface));
     $this->assertInstanceOf(\Traversable::class, $polyhedralSurface);
     $this->assertSame([$polyhedralSurface->patchN(1), $polyhedralSurface->patchN(2), $polyhedralSurface->patchN(3)], iterator_to_array($polyhedralSurface));
 }
コード例 #2
0
ファイル: PolyhedralSurfaceProxy.php プロジェクト: brick/geo
 /**
  * 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 ? PolyhedralSurface::fromBinary($this->proxyData, $this->proxySRID) : PolyhedralSurface::fromText($this->proxyData, $this->proxySRID);
 }