Пример #1
0
 public static function fromString($wktArgument)
 {
     $parts = preg_split('/(\\)\\s*\\)\\s*,\\s*\\(\\s*\\()/', $wktArgument, -1, PREG_SPLIT_DELIM_CAPTURE);
     $polygons = static::assembleParts($parts);
     return new static(array_map(function ($polygonString) {
         return Polygon::fromString($polygonString);
     }, $polygons));
 }
Пример #2
0
 public function testFromWKT()
 {
     $polygon = Polygon::fromWKT('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))');
     $this->assertInstanceOf(Polygon::class, $polygon);
     $this->assertEquals(2, $polygon->count());
 }