Polyline Class


Polylines allow you to draw connected lines on a map. In many spatial database systems, this is also known as a LineString. The Polyline class derives from the IPrimitive interface. When creating a polyline, an array of locations must be passed as an argument in the constructor. Optionally polyline options can also be passed in as an argument.

Polyline(locations: Location[], options?: PolylineOptions)

The Polyline class has the following methods.

NameReturn TypeDescription
getCursor()stringGets the css cursor value when the polyline has mouse events on it.
getGeneralizable()booleanReturns whether the polyline is generalizable based on zoom level or not.
getLocations()Location[]Returns the locations that define the polyline.
getStrokeColor()string or ColorReturns the color of the polyline.
getStrokeDashArray()string or number[]Returns the string that represents the stroke/gap sequence used to draw the polyline.
getStrokeThickness()numberReturns the thickness of the polyline.
getVisible()booleanReturns whether the polyline is visible. A value of false indicates that the polyline is hidden, although it is still an entity on the map.
setLocations(locs: Location[])Sets the locations that define the polyline.
setOptions(opt: PolylineOptions)Sets options for the polyline.
metadataobjectInformation that is linked to the polyline. Some modules such at the GeoJSON, and Spatial Data Service modules will also often add information to this property.
changedIPrimitiveChangedEventArgsOccurs when the locations or options of the polyline has changed.
clickMouseEventArgsOccurs when the mouse is used to click the polyline.
dblclickMouseEventArgsOccurs when the mouse is used to double click the polyline.
mousedownMouseEventArgsOccurs when the left mouse button is pressed when the mouse is over the polyline.
mouseoutMouseEventArgsOccurs when the mouse cursor moves out of the area covered by the polyline.
mouseoverMouseEventArgsOccurs when the mouse is over the polyline.
mouseupMouseEventArgsOccurs when the left mouse button is lifted up when the mouse is over the polyline.