Polyline Class
Bing
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.
| Name | Return Type | Description |
|---|---|---|
getCursor() | string | Gets the css cursor value when the polyline has mouse events on it. |
getGeneralizable() | boolean | Returns whether the polyline is generalizable based on zoom level or not. |
getLocations() | Location[] | Returns the locations that define the polyline. |
getStrokeColor() | string or Color | Returns the color of the polyline. |
getStrokeDashArray() | string or number[] | Returns the string that represents the stroke/gap sequence used to draw the polyline. |
getStrokeThickness() | number | Returns the thickness of the polyline. |
getVisible() | boolean | Returns 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. |
| Name | Type | Description |
|---|---|---|
metadata | object | Information 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. |
| Name | Arguments | Description |
|---|---|---|
changed | IPrimitiveChangedEventArgs | Occurs when the locations or options of the polyline has changed. |
click | MouseEventArgs | Occurs when the mouse is used to click the polyline. |
dblclick | MouseEventArgs | Occurs when the mouse is used to double click the polyline. |
mousedown | MouseEventArgs | Occurs when the left mouse button is pressed when the mouse is over the polyline. |
mouseout | MouseEventArgs | Occurs when the mouse cursor moves out of the area covered by the polyline. |
mouseover | MouseEventArgs | Occurs when the mouse is over the polyline. |
mouseup | MouseEventArgs | Occurs when the left mouse button is lifted up when the mouse is over the polyline. |
Show: