Exemple #1
0
 /**
  * @param int $numPoints
  *
  * @return LineString
  */
 public function generateLineString($numPoints = 2)
 {
     $lineString = new LineString($this->generatePoint(), $this->generatePoint());
     for ($i = 2; $i < $numPoints; $i++) {
         $lineString->add([$this->generatePoint()]);
     }
     return $lineString;
 }
Exemple #2
0
 /**
  * @param LineString $lineString
  *
  * @throws \InvalidArgumentException
  */
 public function add($lineString)
 {
     if (!$lineString instanceof LineString) {
         throw new \InvalidArgumentException('Only LineString objects may be added to a MultiLineString', self::INVALID_ARGUMENT_CODE);
     }
     if (!$lineString->isLinearRing()) {
         throw new \InvalidArgumentException('The LineString instance passed is not a LinearRing (at least 4 points, first and last must be equal)', self::NON_LINEARRING_CODE);
     }
     $this->addGeometry([$lineString]);
 }
Exemple #3
0
 public function testIntegerCoordinatesAreProcessedProperly()
 {
     $this->assertTrue(LineString::equal([1, 2], new Point(1, 2)));
 }