Class Rectangle

All Implemented Interfaces:
com.jbstrap.core.event.handlers.BrowserEventHandler, PopupDrawnEventHandler, PopupHideEventHandler, LayerStyleLayer<Rectangle>, TooltipLayer<Rectangle>, MultiCoordinatesLayer

This class represents a rectangle shape on the map. You can add a tooltip to the rectangle. Read more about tooltip configuration in the TooltipLayer class. You can add a layer style to the rectangle. Read more about layer style configuration in the LayerStyleLayer class.
Since:
4.0
See Also:
  • Constructor Details

    • Rectangle

      public Rectangle(String name, Coordinates diagonalFirst, Coordinates diagonalSecond)
      Creates a rectangle with the layer's unique name and by specifying the coordinates of two corners.
      Parameters:
      name - Unique name of the rectangle Use the name parameter to get the layer from a layer group. LayerGroup
      diagonalFirst - First diagonal coordinate of the rectangle (coordinates of a corner of the rectangle)
      diagonalSecond - Second diagonal coordinate of the rectangle (coordinates of a corner of the rectangle)
      Throws:
      NullPointerException - Thrown if the value of the name or diagonalFirst or diagonalSecond parameters is null
    • Rectangle

      public Rectangle(String name, List<Coordinates> coords)
      Creates a rectangle with the layer's unique name and by specifying the coordinates of two corners in a list.
      Parameters:
      name - Unique name of the rectangle Use the name parameter to get the layer from a layer group. LayerGroup
      coords - A list of the coordinates of two corners in the rectangle
      Throws:
      NullPointerException - Thrown if the value of the name or coords parameters is null
  • Method Details

    • getDiagonalFirst

      public Coordinates getDiagonalFirst()
      Gets the first diagonal coordinate of the rectangle.
      Returns:
      First diagonal coordinate
    • getDiagonalSecond

      public Coordinates getDiagonalSecond()
      Gets the second diagonal coordinate of the rectangle.
      Returns:
      Second diagonal coordinate
    • setDiagonalCoordinates

      public Rectangle setDiagonalCoordinates(Coordinates diagonalFirst, Coordinates diagonalSecond)
      Sets the the coordinates of two diagonal corners in the rectangle.
      Parameters:
      diagonalFirst - The first diagonal coordinate
      diagonalSecond - The second diagonal coordinate
      Returns:
      Rectangle class instance
    • onPopupDrawn

      public void onPopupDrawn(PopupDrawnEvent event)
      Registering the events for the popup draw event in the popup component.
      Specified by:
      onPopupDrawn in interface PopupDrawnEventHandler
      Parameters:
      event - The popup drawn event component
    • onPopupHide

      public void onPopupHide(PopupHideEvent event)
      Registering the events for the popup hide event in the popup component.
      Specified by:
      onPopupHide in interface PopupHideEventHandler
      Parameters:
      event - The popup hide event component