You are here

public function LineString::__construct in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/geometry/LineString.class.php \LineString::__construct()

Constructor

Parameters

array $points An array of at least two points with: which to build the LineString

Overrides Collection::__construct

File

geoPHP/lib/geometry/LineString.class.php, line 16

Class

LineString
LineString. A collection of Points representing a line. A line can have more than one segment.

Code

public function __construct($points = array()) {
  if (count($points) == 1) {
    throw new Exception("Cannot construct a LineString with a single point");
  }

  // Call the Collection constructor to build the LineString
  parent::__construct($points);
}