Rectangle

  • Description

      Rectangle

      The Rectangle component is a polygon with latitude and longitude fixed for the north, south, east and west boundaries. Move a vertex of rectangle updates the appropriate edges accordingly.

  • Events

    • On click
    • Event that is executed when the rectangle is clicked.
    • Drag
    • Event that is executed when dragging actions in the rectangle.
    • On long click
    • Event that is executed when a long click is made on the rectangle 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 rectangle.
    • 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 rectangle.
  • Procedures

    • Bounds
    • This method returns the bounding box of the rectangle in the format ((North West) (South East)).
    • Center
    • This method returns the center of the Rectangle as a list of the form (Latitude Longitude).
    • Distance to feature
    • This method calculates the distance between the rectangle and the feature of given map. If 'centroids' is true, the calculation is made between the centroids of the two features. Otherwise, the distance will be calculated between the two features depending on the closest points.
      If 'centroids' is false, this method will return 0 if the rectangle crosses or contains the introduced character. If it happens an error, this method will return -1.
    • Distance to point
    • This method calculates the distance between the rectangle and the latitude and longitude given if 'centroids' is true, the distance is calculated from the center of the rectangle until the given point. Otherwise, the distance is calculated from the nearest point in the rectangle to the given point.
      If 'centroids' is false and the point is in the rectangle, this method will return 0. If an error occurs, -1 will be returned.
    • Show information box
    • This method shows the information box for the rectangle if not is 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 rectangle information box if it is visible. Otherwise, no action is taken.
    • Set center
    • This method moves the rectangle so that it focuses on the given Longitude and Latitude, trying to maintain the width and height of the rectangle measured from the center to the edges.
  • Properties

    • Description (text)
    • It allows to establish or obtain the description that is shown in the box of information. The information box appears when the user touches the rectangle.
    • Draggable (boolean)
    • Allows you to set or obtiener if the user can or can not drag the rectangle when you press and drag 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 rectangle.
    • East longitude
    • This property sets or obtains the longitude that delimits the rectangle in the east. Range: [-180, 180].
    • West longitude
    • This property sets or obtains the longitude, in degrees, by embedding the rectangle in the west. Range: [-180, 180].
    • North Latitude
    • This property establishes or obtains the latitude, in degrees, that delimits the rectangle in the north. Range: [-90, 90].
    • South Latitude
    • This property establishes or obtains the latitude, in degrees, that delimits the rectangle in the south. Range: [-90, 90].
    • Fill color (color)
    • This property sets or obtains the color used to complete the rectangle.
    • Stroke color (color)
    • This property sets or obtains the color used to delineate the rectangle.
    • Stroke width (number)
    • This property sets or obtains the width of the stroke used to delineate the rectangle.
    • Title (text)
    • This property establishes or obtains the title that is displayed in the window of information that appears when the user clicks on the rectangle.
    • Type (text)
    • Gets the type of the characteristic. For Rectangle, the type will always be "Rectangle"
    • 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.