Polygon Component
Properties
description Sets or gets the description displayed in the info window. The info window appears when the user taps on the Polygon.
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" description="Test description"> |
Code Writeable | true |
polygonName.description = "Test description" |
Code Readable | true |
let variable = polygonName.description |
draggable Sets or gets whether or not the user can drag a map feature. This feature is accessed by long-pressing and then dragging the Polygon to a new location.
Data type: boolean |
||
Designer Writable | true |
<polygon name="polygonName" draggable="true"> |
Code Writeable | true |
polygonName.draggable = true |
Code Readable | true |
let variable = polygonName.draggable |
enableInfobox Enables or disables the infobox window display when the user taps the Polygon.
Data type: boolean |
||
Designer Writable | true |
<polygon name="polygonName" enableInfobox="true"> |
Code Writeable | true |
polygonName.enableInfobox = true |
Code Readable | true |
let variable = polygonName.enableInfobox |
fillColor Sets or gets the color used to fill in the Polygon.
Data type: color |
||
Designer Writable | true |
<polygon name="polygonName" fillColor="FFad6733"> |
Code Writeable | true |
polygonName.fillColor = "FFad6733" |
Code Readable | true |
let variable = polygonName.fillColor |
fillOpacity Sets or gets the opacity of the color used to fill the Polygon. A value of 0.0 will be completely invisible and a value of 1.0 will be completely opaque.
Data type: number |
||
Designer Writable | true |
<polygon name="polygonName" fillOpacity="1"> |
Code Writeable | true |
polygonName.fillOpacity = 1 |
Code Readable | true |
let variable = polygonName.fillOpacity |
holePoints Specifies the points of any holes in the Polygon. The HolePoints property is a list of lists, with each sublist containing (latitude, longitude) points representing a hole.
Data type: array |
||
Designer Writable | false | |
Code Writeable | true |
polygonName.holePoints = |
Code Readable | true |
let variable = polygonName.holePoints |
holePointsFromString Specifies holes in a Polygonfrom a GeoJSON string. In contrast to HolePoints, the longitude of each point comes before the latitude as stated in the GeoJSON specification.
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" holePointsFromString=""> |
Code Writeable | true |
polygonName.holePointsFromString = "" |
Code Readable | false |
points Specifies the Points used for drawing the Polygon. The Points are specified as a list of lists containing latitude and longitude values, such as [[lat1, long1], [lat2, long2], ...].
Data type: array |
||
Designer Writable | false | |
Code Writeable | true |
polygonName.points = |
Code Readable | true |
let variable = polygonName.points |
pointsFromString Specifies the points for the Polygon from a GeoJSON string. Unlike Points, this property expects that the longitude comes first in the point rather than the latitude.
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" pointsFromString=""> |
Code Writeable | true |
polygonName.pointsFromString = "" |
Code Readable | false |
strokeColor Sets or gets the color used to outline the Polygon.
Data type: color |
||
Designer Writable | true |
<polygon name="polygonName" strokeColor="FF0e7a52"> |
Code Writeable | true |
polygonName.strokeColor = "FF0e7a52" |
Code Readable | true |
let variable = polygonName.strokeColor |
strokeOpacity Sets or gets the opacity of the outline of the Polygon. A value of 0.0 will be invisible and a value of 1.0 will be opaque.
Data type: number |
||
Designer Writable | true |
<polygon name="polygonName" strokeOpacity="1"> |
Code Writeable | true |
polygonName.strokeOpacity = 1 |
Code Readable | true |
let variable = polygonName.strokeOpacity |
strokeWidth Sets or gets the width of the stroke used to outline the Polygon.
Data type: number |
||
Designer Writable | true |
<polygon name="polygonName" strokeWidth="2"> |
Code Writeable | true |
polygonName.strokeWidth = 2 |
Code Readable | true |
let variable = polygonName.strokeWidth |
title Sets or gets the title displayed in the info window that appears when the user clicks on the map feature.
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" title="Test title"> |
Code Writeable | true |
polygonName.title = "Test title" |
Code Readable | true |
let variable = polygonName.title |
type Returns the type of the feature. For polygons, this returns MapFeature.Polygon ("Polygon").
Data type: string |
||
Designer Writable | false | |
Code Writeable | false | |
Code Readable | true |
let variable = polygonName.type |
visible Specifies whether the Polygon should be visible on the screen. Value is true{
Data type: boolean |
||
Designer Writable | true |
<polygon name="polygonName" visible="true"> |
Code Writeable | true |
polygonName.visible = true |
Code Readable | true |
let variable = polygonName.visible |
class The styling class of the the component
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" class="Test class"> |
Code Writeable | false | |
Code Readable | false |
id The styling id of the the component
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" id="Test id"> |
Code Writeable | false | |
Code Readable | false |
name The name of the component that will be used to refer to it in code.
Data type: string |
||
Designer Writable | true |
<polygon name="polygonName" name="testComponent"> |
Code Writeable | false | |
Code Readable | false |
Methods
Method name | Description | Parameters | ||||||
---|---|---|---|---|---|---|---|---|
centroid |
Gets the centroid of the Polygon as a (latitude, longitude) pair. polygonName.centroid() |
|
||||||
distanceToFeature |
Computes the distance between the Polygon and the given mapFeature. If centroids is true, the computation is done between the centroids of the two features. Otherwise, the distance will be computed between the two features based on the closest points. Further, when centroids is false, this method will return 0 if the Polygon intersects or contains the mapFeature. If an error occurs, this method will return -1. polygonName.distanceToFeature(mapFeature, centroids) polygonName.distanceToFeature("componentName", true) |
|
||||||
distanceToPoint |
Computes the distance between the Polygon and the given latitude and longitude. If centroids is true, the distance is computed from the center of the Polygon to the given point. Otherwise, the distance is computed from the closest point on the Polygon to the given point. Further, this method will return 0 if centroids is false and the point is in the Polygon. If an error occurs, -1 will be returned. polygonName.distanceToPoint(latitude, longitude, centroid) polygonName.distanceToPoint(-27, 152, true) |
|
||||||
hideInfobox |
Hides the Polygon's info box if it is visible. Otherwise, no action is taken. polygonName.hideInfobox() |
|
||||||
showInfobox |
Shows the info box for the Polygon if it is not visible. Otherwise, this method has no effect. This method can be used to show the info box even if EnableInfobox is false. polygonName.showInfobox() |
|
||||||
addEventListener |
Method used to create event listeners. See Events below for samples. |
|
Events
Event name | Description | Parameters |
---|---|---|
click | The Click event runs when the user taps on the Polygon.polygonName.addEventListener( "click", function () { //Your code here } ) |
|
drag | The Drag event runs in response to position updates of the Polygon as the user drags it.polygonName.addEventListener( "drag", function () { //Your code here } ) |
|
longClick | The LongClick event runs when the user presses and holds the Polygon and then releases it. This event will only trigger if Draggable is false because it uses the same gesture as StartDrag.polygonName.addEventListener( "longClick", function () { //Your code here } ) |
|
startDrag | The StartDrag event runs when the user presses and holds the Polygon and then proceeds to move their finger on the screen. It will be followed by the Drag and StopDrag events.polygonName.addEventListener( "startDrag", function () { //Your code here } ) |
|
stopDrag | The StopDrag event runs when the user releases the Polygon at the end of a drag.polygonName.addEventListener( "stopDrag", function () { //Your code here } ) |
|