/** * @param array $positions The Point array * * @throws \Kdyby\Extension\GeoJson\InvalidArgumentException */ public function __construct(array $positions) { if (count($positions) <= 1) { throw new InvalidArgumentException('LineString have to have at least two points.'); } parent::__construct($positions); }
/** * The first linestring is the outer ring * The subsequent ones are holes * All lineStrings should be linearRings * * @param array $lineStrings The LineString array * * @throws \Kdyby\Extension\GeoJson\InvalidArgumentException */ public function __construct(array $lineStrings) { if (count($lineStrings) < 1) { throw new InvalidArgumentException("Polygon have to have at least one line string."); // todo: the GeoJSON spec (http://geojson.org/geojson-spec.html) says nothing about linestring count. } parent::__construct($lineStrings); }
/** * Constructor * * @param array $points The Point array */ public function __construct(array $points) { parent::__construct($points); }