Package com.massifmaps.vectorelements
Class BalloonPopup
java.lang.Object
com.massifmaps.vectorelements.VectorElement
com.massifmaps.vectorelements.Billboard
com.massifmaps.vectorelements.Popup
com.massifmaps.vectorelements.BalloonPopup
A highly configurable popup implementation that allows the user to specify a title, description, colors, images, font sizes etc.
-
Constructor Summary
ConstructorsConstructorDescriptionBalloonPopup(MapPos pos, BalloonPopupStyle style, String title, String desc) Constructs a BalloonPopup object from a map position and a style.
If an empty string is passed for the title, it will not be drawn.BalloonPopup(Geometry geometry, BalloonPopupStyle style, String title, String desc) Constructs a BalloonPopup object from a geometry object and a style.
If an empty string is passed for the title, it will not be drawn.BalloonPopup(Billboard baseBillboard, BalloonPopupStyle style, String title, String desc) Constructs a BalloonPopup object with the specified style and attaches it to a billboard element.
If an empty string is passed for the title, it will not be drawn. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddButton(BalloonPopupButton button) Adds a new button to the balloon popup.
If the button is already added, the call is ignored.voidRemoves all buttons from the balloon popup.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.Returns the balloon popup event listener.Returns the description of this balloon popup.getStyle()Returns the style of this balloon popup.getTitle()Returns the title of this balloon popup.booleanprocessClick(ClickInfo clickInfo, MapPos clickPos, ScreenPos elementClickPos) Handles the click events for this Popup.voidremoveButton(BalloonPopupButton button) Removes a button from the balloon popup.
If the button is not present, the call is ignored.voidreplaceButton(BalloonPopupButton oldButton, BalloonPopupButton newButton) Replaces an old baloon popup button with a new button.voidsetBalloonPopupEventListener(BalloonPopupEventListener eventListener) Sets the balloon popup event listener.voidsetDescription(String desc) Sets the description this balloon popup will display.voidsetStyle(BalloonPopupStyle style) Sets the style for this balloon popup.voidSets the title this balloon popup will display.Methods inherited from class com.massifmaps.vectorelements.Popup
getAnchorPointX, getAnchorPointY, setAnchorPoint, setAnchorPointX, setAnchorPointY, setStyleMethods 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
-
Constructor Details
-
BalloonPopup
Constructs a BalloonPopup object with the specified style and attaches it to a billboard element.
If an empty string is passed for the title, it will not be drawn. The same applies to the description.- Parameters:
baseBillboard- The billboard this balloon popup will be attached to.style- The style that defines what this balloon popup looks like.title- The text this balloon popup will display.desc- The description this balloon popup will display.
-
BalloonPopup
Constructs a BalloonPopup object from a geometry object and a style.
If an empty string is passed for the title, it will not be drawn. The same applies to the description.- Parameters:
geometry- The geometry object that defines the location of this balloon popup.style- The style that defines what this balloon popup looks like.title- The text this balloon popup will display.desc- The description this balloon popup will display.
-
BalloonPopup
Constructs a BalloonPopup object from a map position and a style.
If an empty string is passed for the title, it will not be drawn. The same applies to the description.- Parameters:
pos- The map position that defines the location of this balloon popup.style- The style that defines what this balloon popup looks like.title- The text this balloon popup will display.desc- The description this balloon popup will display.
-
-
Method Details
-
getTitle
Returns the title of this balloon popup.- Returns:
- The title of this balloon popup.
-
setTitle
Sets the title this balloon popup will display. If an empty string is passed
the title will not be drawn.- Parameters:
title- The new title this balloon popup will display.
-
getDescription
Returns the description of this balloon popup.- Returns:
- The description of this balloon popup.
-
setDescription
Sets the description this balloon popup will display. If an empty string is passed
the description will not be drawn.- Parameters:
desc- The new description this balloon popup will display.
-
getStyle
Returns the style of this balloon popup. -
setStyle
Sets the style for this balloon popup.- Parameters:
style- The new style that defines what this balloon popup looks like.
-
clearButtons
public void clearButtons()Removes all buttons from the balloon popup. -
addButton
Adds a new button to the balloon popup.
If the button is already added, the call is ignored.- Parameters:
button- The button object to add.
-
replaceButton
Replaces an old baloon popup button with a new button.- Parameters:
oldButton- The old button to replace.newButton- The new button.
-
removeButton
Removes a button from the balloon popup.
If the button is not present, the call is ignored.- Parameters:
button- The button object to remove.
-
getBalloonPopupEventListener
Returns the balloon popup event listener.- Returns:
- The balloon popup event listener.
-
setBalloonPopupEventListener
Sets the balloon popup event listener.- Parameters:
eventListener- The balloon popup event listener.
-
processClick
Description copied from class:PopupHandles the click events for this Popup.- Overrides:
processClickin classPopup- 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) Description copied from class:PopupDraws 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.- Overrides:
drawBitmapin classPopup- 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.
-