public class

CustomPopup

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

Class Overview

A popup with user defined handler. The handler is responsible
for drawing the bitmap for the popup and can also respond to
touch event.

Summary

Public Constructors
CustomPopup(Billboard baseBillboard, PopupStyle style, CustomPopupHandler popupHandler)
Constructs a CustomPopup object with the specified style and attaches it to a billboard element.
CustomPopup(Geometry geometry, PopupStyle style, CustomPopupHandler popupHandler)
Constructs a CustomPopup object from a geometry object and a style.
CustomPopup(MapPos pos, PopupStyle style, CustomPopupHandler popupHandler)
Constructs a CustomPopup object from a map position and a style.
Public Methods
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.
CustomPopupHandler getPopupHandler()
Returns the handler used for the popup.
boolean processClick(ClickType clickType, MapPos clickPos, ScreenPos elementClickPos)
Handles the click events for this Popup.
[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 CustomPopup (Billboard baseBillboard, PopupStyle style, CustomPopupHandler popupHandler)

Constructs a CustomPopup object with the specified style and attaches it to a billboard element.

Parameters
baseBillboard The billboard this popup will be attached to.
style The style that defines what this popup looks like.
popupHandler The handler to use for the popup.

public CustomPopup (Geometry geometry, PopupStyle style, CustomPopupHandler popupHandler)

Constructs a CustomPopup object from a geometry object and a style.

Parameters
geometry The geometry object that defines the location of this popup.
style The style that defines what this popup looks like.
popupHandler The handler to use for the popup.

public CustomPopup (MapPos pos, PopupStyle style, CustomPopupHandler popupHandler)

Constructs a CustomPopup object from a map position and a style.

Parameters
pos The map position that defines the location of this popup.
style The style that defines what this popup looks like.
popupHandler The handler to use for the popup.

Public Methods

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 CustomPopupHandler getPopupHandler ()

Returns the handler used for the popup.

Returns
  • The popup handler responsible for drawing the popup and handling click events.

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.