public function testMultiLineStringFromObjectsGetLastLineString() { $lineString1 = new LineString(array(new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), new Point(0, 0))); $lineString2 = new LineString(array(new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), new Point(5, 5))); $polygon = new MultiLineString(array($lineString1, $lineString2)); $this->assertEquals($lineString2, $polygon->getLineString(-1)); }
public function testJson() { $expected = '{"type":"MultiLineString","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; $lineStrings = array(array(array(0, 0), array(10, 0), array(10, 10), array(0, 10), array(0, 0)), array(array(0, 0), array(10, 0), array(10, 10), array(0, 10), array(0, 0))); $multiLineString = new MultiLineString($lineStrings); $this->assertEquals($expected, $multiLineString->toJson()); }