Package com.massifmaps.vectorelements
Class Popup
java.lang.Object
com.massifmaps.vectorelements.VectorElement
com.massifmaps.vectorelements.Billboard
com.massifmaps.vectorelements.Popup
- Direct Known Subclasses:
BalloonPopup,CustomPopup
An abstract billboard element that can be displayed on the map. It
always faces the camera and has a dynamically drawn bitmap.
always faces the camera and has a dynamically drawn bitmap.
-
Method Summary
Modifier and TypeMethodDescriptiondrawBitmap(ScreenPos anchorScreenPos, float screenWidth, float screenHeight, float dpToPX) Draws a custom bitmap for this Popup that will be used for drawing the Popup on the map.
The method is called each time the Popup gets reloaded internally.floatReturns the horizontal anchor point of this popup.floatReturns the vertical anchor point of this popup.getStyle()Returns the style of this Popup.booleanprocessClick(ClickInfo clickInfo, MapPos clickPos, ScreenPos elementClickPos) Handles the click events for this Popup.voidsetAnchorPoint(float anchorPointX, float anchorPointY) Sets the anchor point for the popup.voidsetAnchorPointX(float anchorPointX) Sets the horizontal anchor point for the popup.voidsetAnchorPointY(float anchorPointY) Sets the vertical anchor point for the popup.voidsetStyle(PopupStyle style) Sets the style for this Popup.Methods inherited from class com.massifmaps.vectorelements.Billboard
getBaseBillboard, getBounds, getGeometry, getRootGeometry, getRotation, setBaseBillboard, setGeometry, setPos, setRotationMethods inherited from class com.massifmaps.vectorelements.VectorElement
containsMetaDataKey, equals, getId, getMetaData, getMetaDataElement, hashCode, isVisible, notifyElementChanged, setId, setMetaData, setMetaDataElement, setVisible
-
Method Details
-
getAnchorPointX
public float getAnchorPointX()Returns the horizontal anchor point of this popup.- Returns:
- The horizontal anchor point of this popup.
-
setAnchorPointX
public void setAnchorPointX(float anchorPointX) Sets the horizontal anchor point for the popup. It should only be called from
Popup::drawBitmap method, to match the anchor point to the drawn bitmap.- Parameters:
anchorPointX- The new horizontal anchor point for the popup. -1 means the left side,
0 the center and 1 the right side of the popup. The default is 0.
-
getAnchorPointY
public float getAnchorPointY()Returns the vertical anchor point of this popup.- Returns:
- The vertical anchor point of this popup.
-
setAnchorPointY
public void setAnchorPointY(float anchorPointY) Sets the vertical anchor point for the popup. It should only be called from
Popup::drawBitmap method, to match the anchor point to the drawn bitmap.- Parameters:
anchorPointY- The vertical anchor point for the popup. -1 means the bottom,
0 the center and 1 the top of the popup. The default is -1.
-
setAnchorPoint
public void setAnchorPoint(float anchorPointX, float anchorPointY) Sets the anchor point for the popup. It should only be called from
Popup::drawBitmap method, to match the anchor point to the drawn bitmap.
Values will be clamped to [-1, 1] range.- Parameters:
anchorPointX- The new horizontal anchor point for the popup. -1 means the left side,
0 the center and 1 the right side of the popup. The default is 0.anchorPointY- The vertical anchor point for the popup. -1 means the bottom,
0 the center and 1 the top of the popup. The default is -1.
-
getStyle
Returns the style of this Popup.- Returns:
- The style that defines what this Popup looks like.
-
setStyle
Sets the style for this Popup.- Parameters:
style- The new style that defines what this popup looks like.
-
processClick
Handles the click events for this Popup.- Parameters:
clickInfo- The click attributes.clickPos- The position of the click.elementClickPos- The 2D position of the click on the popup.- Returns:
- True if the click was handled. False otherwise.
-
drawBitmap
public Bitmap drawBitmap(ScreenPos anchorScreenPos, float screenWidth, float screenHeight, float dpToPX) Draws a custom bitmap for this Popup that will be used for drawing the Popup on the map.
The method is called each time the Popup gets reloaded internally.- Parameters:
anchorScreenPos- The screen position of the anchor point of this popup in pixels.screenWidth- The current screen width in pixels.screenHeight- The current screen height in pixels.dpToPX- The value used for converting display independent pixels (dp) to pixels (px).- Returns:
- The custom Popup bitmap.
-