Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function coordinateSystem()
 {
     if ($this->proxyGeometry === null) {
         $this->load();
     }
     return $this->proxyGeometry->coordinateSystem();
 }
Beispiel #2
0
 /**
  * Creates a rectangle out of two 2D corner points.
  *
  * The result is a linear ring (closed and simple).
  *
  * @param Point $a
  * @param Point $b
  *
  * @return LineString
  *
  * @throws CoordinateSystemException If the points use different coordinate systems, or are not 2D.
  */
 public static function rectangle(Point $a, Point $b)
 {
     $cs = $a->coordinateSystem();
     if ($cs != $b->coordinateSystem()) {
         // by-value comparison.
         throw CoordinateSystemException::dimensionalityMix($a, $b);
     }
     if ($cs->coordinateDimension() != 2) {
         throw new CoordinateSystemException(__METHOD__ . ' expects 2D points.');
     }
     $x1 = min($a->x(), $b->x());
     $x2 = max($a->x(), $b->x());
     $y1 = min($a->y(), $b->y());
     $y2 = max($a->y(), $b->y());
     $p1 = new Point($cs, $x1, $y1);
     $p2 = new Point($cs, $x2, $y1);
     $p3 = new Point($cs, $x2, $y2);
     $p4 = new Point($cs, $x1, $y2);
     return new LineString($cs, $p1, $p2, $p3, $p4, $p1);
 }
Beispiel #3
0
 /**
  * Creates a non-empty CircularString composed of the given points.
  *
  * @param Point    $point1 The first point.
  * @param Point ...$pointN The subsequent points.
  *
  * @return CircularString
  *
  * @throws InvalidGeometryException  If the number of points is invalid.
  * @throws CoordinateSystemException If the points use different coordinate systems.
  */
 public static function of(Point $point1, Point ...$pointN)
 {
     return new CircularString($point1->coordinateSystem(), $point1, ...$pointN);
 }