public class

BalloonPopup

extends Popup
java.lang.Object
   ↳ com.carto.vectorelements.VectorElement
     ↳ com.carto.vectorelements.Billboard
       ↳ com.carto.vectorelements.Popup
         ↳ com.carto.vectorelements.BalloonPopup

Class Overview

A highly configurable popup implementation that allows the user to specify a title, description, colors, images, font sizes etc.

Summary

Public Constructors
BalloonPopup(Billboard baseBillboard, BalloonPopupStyle style, String title, String desc)
Constructs a BalloonPopup object with the specified style and attaches it to a billboard element.
BalloonPopup(Geometry geometry, BalloonPopupStyle style, String title, String desc)
Constructs a BalloonPopup object from a geometry object and a style.
BalloonPopup(MapPos pos, BalloonPopupStyle style, String title, String desc)
Constructs a BalloonPopup object from a map position and a style.
Public Methods
void addButton(BalloonPopupButton button)
Adds a new button to the balloon popup.
void clearButtons()
Removes all buttons from the balloon popup.
synchronized void delete()
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.
BalloonPopupEventListener getBalloonPopupEventListener()
Returns the balloon popup event listener.
String getDescription()
Returns the description of this balloon popup.
BalloonPopupStyle getStyle()
Returns the style of this balloon popup.
String getTitle()
Returns the title of this balloon popup.
boolean processClick(ClickType clickType, MapPos clickPos, ScreenPos elementClickPos)
Handles the click events for this Popup.
void removeButton(BalloonPopupButton button)
Removes a button from the balloon popup.
void replaceButton(BalloonPopupButton oldButton, BalloonPopupButton newButton)
Replaces an old baloon popup button with a new button.
void setBalloonPopupEventListener(BalloonPopupEventListener eventListener)
Sets the balloon popup event listener.
void setDescription(String desc)
Sets the description this balloon popup will display.
void setStyle(BalloonPopupStyle style)
Sets the style for this balloon popup.
void setTitle(String title)
Sets the title this balloon popup will display.
[Expand]
Inherited Methods
From class com.carto.vectorelements.Popup
From class com.carto.vectorelements.Billboard
From class com.carto.vectorelements.VectorElement
From class java.lang.Object

Public Constructors

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.

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.

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.

Public Methods

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.

public void clearButtons ()

Removes all buttons from the balloon popup.

public synchronized void delete ()

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.

public BalloonPopupEventListener getBalloonPopupEventListener ()

Returns the balloon popup event listener.

Returns
  • The balloon popup event listener.

public String getDescription ()

Returns the description of this balloon popup.

Returns
  • The description of this balloon popup.

public BalloonPopupStyle getStyle ()

Returns the style of this balloon popup.

Returns
  • The style that defines what this balloon popup looks like.

public String getTitle ()

Returns the title of this balloon popup.

Returns
  • The title of this balloon popup.

public boolean processClick (ClickType clickType, MapPos clickPos, ScreenPos elementClickPos)

Handles the click events for this Popup.

Parameters
clickType The type of the click.
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.

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.

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.

public void setBalloonPopupEventListener (BalloonPopupEventListener eventListener)

Sets the balloon popup event listener.

Parameters
eventListener The balloon popup event listener.

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.

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.

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.