/** * {@inheritdoc} */ public function coordinateSystem() { if ($this->proxyGeometry === null) { $this->load(); } return $this->proxyGeometry->coordinateSystem(); }
/** * {@inheritdoc} * * @throws UnexpectedGeometryException If the patches are not triangles. */ public function __construct(CoordinateSystem $cs, Polygon ...$patches) { parent::__construct($cs, ...$patches); foreach ($patches as $patch) { if (!$patch instanceof Triangle) { throw new UnexpectedGeometryException('The patches in a TIN must be triangles.'); } } }
/** * 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)); }