Class BalloonPopup


public class BalloonPopup extends Popup
A highly configurable popup implementation that allows the user to specify a title, description, colors, images, font sizes etc.
  • Constructor Details

    • BalloonPopup

      public 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. 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

      public 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. 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

      public BalloonPopup(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. 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

      public String getTitle()
      Returns the title of this balloon popup.
      Returns:
      The title of this balloon popup.
    • setTitle

      public void setTitle(String title)
      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

      public String getDescription()
      Returns the description of this balloon popup.
      Returns:
      The description of this balloon popup.
    • setDescription

      public void setDescription(String desc)
      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

      public BalloonPopupStyle getStyle()
      Returns the style of this balloon popup.
      Overrides:
      getStyle in class Popup
      Returns:
      The style that defines what this balloon popup looks like.
    • setStyle

      public void setStyle(BalloonPopupStyle style)
      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

      public void addButton(BalloonPopupButton button)
      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

      public void replaceButton(BalloonPopupButton oldButton, BalloonPopupButton newButton)
      Replaces an old baloon popup button with a new button.
      Parameters:
      oldButton - The old button to replace.
      newButton - The new button.
    • removeButton

      public void removeButton(BalloonPopupButton button)
      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

      public BalloonPopupEventListener getBalloonPopupEventListener()
      Returns the balloon popup event listener.
      Returns:
      The balloon popup event listener.
    • setBalloonPopupEventListener

      public void setBalloonPopupEventListener(BalloonPopupEventListener eventListener)
      Sets the balloon popup event listener.
      Parameters:
      eventListener - The balloon popup event listener.
    • processClick

      public boolean processClick(ClickInfo clickInfo, MapPos clickPos, ScreenPos elementClickPos)
      Description copied from class: Popup
      Handles the click events for this Popup.
      Overrides:
      processClick in class 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)
      Description copied from class: Popup
      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.
      Overrides:
      drawBitmap in class Popup
      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.