VIAMICHELIN JAVASCRIPT API


Polygon

Polygon is responsible for graphic object of polygon type. Launched via new and extends Layer.

Constructor

PropertyTypeDescriptionDefault
coords [GeoPoint] ou [[float], [float]] Array of geographical coordinates representing polygone vertices. N/A
strokeColor string Colour of the polygon stroke path in HTML hex style. '#000'
strokeOpacity float Opacity of the polygon stroke path between 0.0 (fully transparent) and 1.0 (fully opaque). 1.0
strokeWeight int Pixel width of the polygon stroke path. 2
fillColor string Fill colour in HTML hex style. '#0F0'
fillOpacity float The fill opacity between 0.0 (fully transparent) and 1.0 (fully opaque). 0.0
htm string HTML content to be displayed in the Info-bubble. ''

 

Methods

MethodsReturn valueDescription
getGeoBoundaries() [GeoPoint,GeoPoint] Returns the geographical coordinates of the polygon boundaries as north-west and south-east corners.
getPath() [GeoPoint] Retrieves vertices from the path. The last vertice is always the same as the first one.
setPath([GeoPoint] ou [[float], [float]]) - Replaces path vertices and automatically updates the polygon on the map.
getStrokeColor() string Retrieves current polygon stroke colour.
setStrokeColor(newColor: string) - Sets new polygon stroke colour.
getStrokeOpacity() float Retrieves current polygon stroke opacity.
setStrokeOpacity(newOpacity: float) - Sets new polygon stroke opacity.
getStrokeWeight() int Retrieves current polygon stroke width.
setStrokeWeight(newWeight: int) - Sets new polygon stroke width.
getFillColor() string Retrieves current polygon fill color.
setFillColor(newColor: string) - Sets polygon new fill color.
getFillOpacity() float Retrieves polygon current fill opacity.
setFillOpacity(newOpacity: float) - Sets polygon new fill opacity.
setBubbleContent(htm: string) - HTML content to be displayed in the Info-bubble.

 

Events

EventsArgumentsDescription
onClick GeoPoint Fired when a mouse click takes place on the polygon.
onExpandOpen - Fired when polygone info-bubble is opened.
onExpandClose - Fired when polygone info-bubble is closed.

Back to top