public final class MapMarker extends MapObject
MapMarker
objects can be selected by application users.
Modifier and Type | Class and Description |
---|---|
static interface |
MapMarker.OnDragListener
Callback interface for drag events on
MapMarker objects. |
MapObject.Type
Constructor and Description |
---|
MapMarker()
Creates a default
MapMarker . |
MapMarker(float hue)
Creates a default
MapMarker . |
MapMarker(GeoCoordinate coordinate,
Image image)
|
Modifier and Type | Method and Description |
---|---|
android.graphics.PointF |
getAnchorPoint()
Returns the anchor point for this
MapMarker . |
GeoCoordinate |
getCoordinate()
Returns the current map
GeoCoordinate for this MapMarker . |
java.lang.String |
getDescription()
Gets the current description text.
|
Image |
getIcon()
Returns the icon image for this
MapMarker . |
int |
getInfoBubbleHashCode()
Returns non-zero hash code of the info bubble if it is showing.
|
java.lang.String |
getTitle()
Gets the current title to be used by the default info bubble.
|
float |
getTransparency()
Gets the current transparency for the icon
|
MapObject.Type |
getType()
Returns the type of object that this
MapObject represents. |
void |
hideInfoBubble()
Hides the info bubble if it's currently showing.
|
boolean |
isDraggable()
Returns a boolean indicating whether the marker is draggable.
|
boolean |
isInfoBubbleVisible()
Returns a boolean indicating if the info bubble is currently displayed on this marker.
|
MapMarker |
setAnchorPoint(android.graphics.PointF anchor)
Sets an anchor point for this
MapMarker . |
MapMarker |
setCoordinate(GeoCoordinate coordinate)
Sets a map
GeoCoordinate for this MapMarker . |
MapMarker |
setDescription(java.lang.String description)
Sets the description text.
|
MapMarker |
setDraggable(boolean isDraggable)
Sets whether this marker is draggable or not.
|
MapMarker |
setIcon(Image icon)
Sets an icon image for this
MapMarker . |
MapMarker |
setTitle(java.lang.String title)
Sets a title to be used by the default info bubble.
|
boolean |
setTransparency(float alpha)
Sets a transparency level, within the range of [0..1], for the icon.
|
void |
showInfoBubble()
Displays the default info bubble if
setTitle(String) has been set to something
non-null. |
equals, getBaseType, getParent, getVisibleMask, getZIndex, hashCode, isVisible, resetVisibleMask, setVisible, setVisible, setVisible, setVisibleMask, setVisibleMask, setZIndex, unsetVisibleMask, unsetVisibleMask
public MapMarker()
MapMarker
. The marker will contain the default marker image.MapMarker(float)
,
MapMarker(GeoCoordinate, Image)
public MapMarker(float hue)
MapMarker
. The marker will contain a colorization of the default
marker image.hue
- The hue of the marker. Value must be greater or equal to 0 and less than 360.java.lang.IllegalArgumentException
- For hue values outside the acceptable range.MapMarker()
,
MapMarker(GeoCoordinate, Image)
public MapMarker(GeoCoordinate coordinate, Image image)
coordinate
- A GeoCoordinate
representing the
map coordinates of the markerimage
- An Image
used to display the markerMapMarker()
,
MapMarker(float)
public MapMarker setIcon(Image icon)
MapMarker
.icon
- An Image
representing this marker's iconMapMarker
itself.public Image getIcon()
MapMarker
.Image
representing this marker's iconpublic MapMarker setCoordinate(GeoCoordinate coordinate)
GeoCoordinate
for this MapMarker
.coordinate
- Desired GeoCoordinate
location for this markerMapMarker
itself.public GeoCoordinate getCoordinate()
GeoCoordinate
for this MapMarker
.GeoCoordinate
locationpublic MapMarker setAnchorPoint(android.graphics.PointF anchor)
MapMarker
.
The marker is drawn with the specified pixel offset from its getCoordinate()
position. To clear an anchor set previously, pass a PointF
to this method with an
X-coordinate equal to half the width of the marker and a Y-coordinate equal to half the
height of the marker.
By default, there is no offset and the MapMarker
is centered in the center of the
icon image.
anchor
- A PointF
relative to the top-left corner of the MapMarker
.MapMarker
itself.public android.graphics.PointF getAnchorPoint()
MapMarker
.
The marker is drawn with the specified pixel offset from its getCoordinate()
position. To clear an anchor set previously, pass a PointF
to this method with an
X-coordinate equal to half the width of the marker and a Y-coordinate equal to half the
height of the marker.
By default, there is no offset and the MapMarker
is centered in the center of the
icon image.
public boolean isInfoBubbleVisible()
public MapMarker setDraggable(boolean isDraggable)
If any user overridden methods of
MapGesture.OnGestureListener.onLongPressEvent(PointF)
or
MapGesture.OnGestureListener.OnGestureListenerAdapter.onDoubleTapEvent(PointF)
that
is registered with MapGesture
returns true
, the MapMarker
will ignore
any drag events even if the marker is set to enable dragging.
isDraggable
- true
if the marker is draggable, false
otherwise.MapMarker
itself.MapGesture
public boolean isDraggable()
public boolean setTransparency(float alpha)
alpha
- Desired alpha value for the icon, 0 for fully transparent, 1 for fully opaque (the
default value is 1)public float getTransparency()
The transparency level is only precise to two decimal places due to numerical operations performed internally when rendering the map.
public MapMarker setTitle(java.lang.String title)
title
- The title to set.MapMarker
itself.public java.lang.String getTitle()
public MapMarker setDescription(java.lang.String description)
description
- The description to be set.MapMarker
itself.public java.lang.String getDescription()
public void showInfoBubble()
setTitle(String)
has been set to something
non-null. This method should be called only after the MapMarker
is added onto a
Map
, otherwise making this call would make no effects.
As only one info bubble can be displayed on the map at a time, thus when calling
showInfoBubble()
on a different MapMarker
, the current info bubble on
display will automatically be closed before the newly selected one is shown.public void hideInfoBubble()
public int getInfoBubbleHashCode()
Use this hash code to compare against the hash code of the objects returned by
MapGesture.OnGestureListener.onMapObjectsSelected(List)
to determine if object
selected is an info bubble. If so, call hideInfoBubble()
to close the info bubble.
MapGesture.OnGestureListener.onMapObjectsSelected(List)
public MapObject.Type getType()
MapObject
MapObject
represents.getType
in class MapObject
MapObject.Type
values