Example #1
0
 /**
  * Tests Countable and Traversable interfaces.
  */
 public function testInterfaces()
 {
     $circularString = CircularString::fromText('CIRCULARSTRING (1 2, 3 4, 5 6)');
     $this->assertInstanceOf(\Countable::class, $circularString);
     $this->assertSame(3, count($circularString));
     $this->assertInstanceOf(\Traversable::class, $circularString);
     $this->assertSame([$circularString->pointN(1), $circularString->pointN(2), $circularString->pointN(3)], iterator_to_array($circularString));
 }
Example #2
0
 /**
  * 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 ? CircularString::fromBinary($this->proxyData, $this->proxySRID) : CircularString::fromText($this->proxyData, $this->proxySRID);
 }