Package com.jbstrap.jbmap.layers.layer
Class Rectangle
- All Implemented Interfaces:
com.jbstrap.core.event.handlers.BrowserEventHandler
,PopupDrawnEventHandler
,PopupHideEventHandler
,LayerStyleLayer<Rectangle>
,TooltipLayer<Rectangle>
,MultiCoordinatesLayer
public class Rectangle
extends BaseLayer<Rectangle>
implements PopupDrawnEventHandler, PopupHideEventHandler, TooltipLayer<Rectangle>, LayerStyleLayer<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:
-
Field Summary
Fields inherited from class com.jbstrap.jbmap.layers.BaseLayer
COORDINATES, layerStyle, NAME, POINT, POINT_TYPE, popup, POPUP_CONTENT, POPUP_ENABLED, POPUP_OPENED, TYPE
Fields inherited from class com.jbstrap.jbmap.layers.Layer
componentContent, params, parent
Fields inherited from interface com.jbstrap.jbmap.layers.LayerStyleLayer
STYLE
Fields inherited from interface com.jbstrap.jbmap.layers.TooltipLayer
TOOLTIP_CONTENT, TOOLTIP_ENABLED, TOOLTIP_OPENED
-
Constructor Summary
ConstructorDescriptionRectangle
(String name, Coordinates diagonalFirst, Coordinates diagonalSecond) Creates a rectangle with the layer's unique name and by specifying the coordinates of two corners.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. -
Method Summary
Modifier and TypeMethodDescriptionGets the first diagonal coordinate of the rectangle.Gets the second diagonal coordinate of the rectangle.void
onPopupDrawn
(PopupDrawnEvent event) Registering the events for the popup draw event in the popup component.void
onPopupHide
(PopupHideEvent event) Registering the events for the popup hide event in the popup component.setDiagonalCoordinates
(Coordinates diagonalFirst, Coordinates diagonalSecond) Sets the the coordinates of two diagonal corners in the rectangle.Methods inherited from class com.jbstrap.jbmap.layers.BaseLayer
addClickHandler, addCustomParam, addMouseOutHandler, addMouseOverHandler, closePopup, getClickHandlers, getCustomParams, getGeometry, getMouseOutHandlers, getMouseOverHandlers, getName, getParams, getParent, getPopup, getPopupContent, getProperties, getTitle, hide, isPopupEnabled, isShown, openPopup, removeClickHandler, removeCustomParam, removeMouseOutHandler, removeMouseOverHandler, runJSLayer, runJSLayerGroup, setCoordinates, setCustomParams, setParent, setPopupContent, setPopupEnabled, setTitle, show
Methods inherited from class com.jbstrap.jbmap.layers.Layer
getContent, runAfterDrawOnLayer, runOnHideOnLayer, runOnShowOnLayer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.jbmap.layers.LayerStyleLayer
getLayerStyle, setLayerStyle
Methods inherited from interface com.jbstrap.jbmap.layers.TooltipLayer
closeTooltip, getTooltipContent, isTooltipEnabled, isTooltipOpened, openTooltip, setTooltipContent, setTooltipEnabled
-
Constructor Details
-
Rectangle
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 thename
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 thename
ordiagonalFirst
ordiagonalSecond
parameters isnull
-
Rectangle
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 thename
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 thename
orcoords
parameters isnull
-
-
Method Details
-
getDiagonalFirst
Gets the first diagonal coordinate of the rectangle.- Returns:
- First diagonal coordinate
-
getDiagonalSecond
Gets the second diagonal coordinate of the rectangle.- Returns:
- Second diagonal coordinate
-
setDiagonalCoordinates
Sets the the coordinates of two diagonal corners in the rectangle.- Parameters:
diagonalFirst
- The first diagonal coordinatediagonalSecond
- The second diagonal coordinate- Returns:
- Rectangle class instance
-
onPopupDrawn
Registering the events for the popup draw event in the popup component.- Specified by:
onPopupDrawn
in interfacePopupDrawnEventHandler
- Parameters:
event
- The popup drawn event component
-
onPopupHide
Registering the events for the popup hide event in the popup component.- Specified by:
onPopupHide
in interfacePopupHideEventHandler
- Parameters:
event
- The popup hide event component
-