Polygon

  • Description

      Polygon

      The Polygon component encloses a two-dimensional area arbitrary on a map. Polygons can be used to draw a perimeter, such as a campus, a city or a country. The polygons start as basic triangles and you can create new vertices by dragging the midpoint of a polygon away from the edge.

      Clicking on a vertex will remove the vertex, but there must be a minimum of 3 vertices at all times.

  • Events

    • On click
    • Event that is executed when the Polygon is clicked.
    • Drag
    • Event that is executed when dragging actions in the Polygon.
    • On long click
    • Event that is executed when a long click is made on the Polygon but without triggering a drag. Therefore for this procedure to run the 'Draggable' property must be false.
    • Start drag
    • Event that is executed before a drag operation begins. For example you can use this event to save the current position of the Polygon.
    • Stop drag
    • Event that is executed after the drag operation has been completed. For example you can use this event to save the new position of the Polygon.
  • Procedures

    • Centroid
    • This method returns the centroid of the polygon as a list with format. The values ​​will be Latitude and Longitude.
    • Distance to feature
    • This method calculates the distance between the Polygon and the characteristic of given map. If 'centroids' is true, the calculation is made between the centroids of the two characteristics. Otherwise, the distance will be calculated between the two characteristics depending on the closest points.
      If 'centroids' is false, this method will return 0 if the Polygon intersects or is contained in the introduced character. If it happens an error, this method will return -1.
    • Distance to point
    • This method calculates the distance between the Polygon and the latitude and longitude given If 'centroids' is true, the distance is calculated from the center of the Polygon until the given point. Otherwise, the distance is calculated from the nearest point in the Polygon up to the given point.
      If 'centroids' is false and the point is in the Polygon, this method will return 0. If an error occurs, -1 will be returned.
    • Show information box
    • This method shows the information box for the Polygon if it is not visible. Otherwise, this method has no effect. This method can be used to show the information box though the 'Enable Information Box' property is false.
    • Hide information box
    • This method hides the information box of the Polygon if it is visible. Otherwise, no action is taken.
  • Properties

    • Description (text)
    • It allows to establish or obtain the description that is shown in the window of information. The information window appears when the user touches the Polygon.
    • Draggable (boolean)
    • Allows you to set or obtiener if the user can or can not drag the Polygon by pressing and dragging it to a new location.
    • Enable Information Box (boolean)
    • This property enables or disables the display of the window of the information box when the user touches the Polygon.
    • Hole points (list)
    • This property establishes or obtains lists of points that comprise the holes of the polygon. Points are given as (Latitude and Longitude) in pairs and should be given counter-clock wise.
    • Hole points from string (text)
    • This property sets the list of hole points of a string in GeoJSON format.
    • Points (list)
    • This property establishes or obtains the list of points that make up the polygon. The points are given in (Latitude and Longitude) in pairs and must be given in the sense of clock hands.
    • Points from string (text)
    • This property sets the list of points of a string in GeoJSON format.
    • Fill color (color)
    • This property sets or obtains the color used to complete the Polygon.
    • Stroke color(color)
    • This property sets or obtains the color used to delineate the Polygon.
    • Stroke width (number)
    • This property sets or obtains the width of the stroke used to delineate the Polygon.
    • Title (text)
    • This property establishes or obtains the title that is displayed in the box of information that appears when the user clicks on the Polygon.
    • Type (text)
    • Gets the type of the feature. For Polygon, the type will always be "Polygon".
    • Visible
    • This property establishes or obtains if the component should be visible in the screen. The value is true if the component is displayed and false if it is hidden.