public abstract class MapObject extends ViewObject
Map.
This abstract class serves as a base for several more specified map object types, bundling their common properties. The types of map objects that you can add to a map include:
Objects extending this class, with the exception of MapRoute but including
MapContainer, can be grouped within a MapContainer instance.
For a complete enumeration of available MapObject types, refer to MapObject.Type.
| Modifier and Type | Class and Description |
|---|---|
static class |
MapObject.Type
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
ViewObject.Type |
getBaseType()
Returns the real implementation type of the
ViewObject. |
MapContainer |
getParent()
Returns the parent of this
MapObject. |
abstract MapObject.Type |
getType()
Returns the type of object that this
MapObject represents. |
java.util.BitSet |
getVisibleMask()
Returns the visibility bit mask of this
MapObject |
int |
getZIndex()
Returns the current z-index (stacking order) of this
MapObject. |
int |
hashCode() |
boolean |
isVisible()
Determines whether this
MapObject is visible on the map. |
MapObject |
resetVisibleMask(boolean set)
Resets this
MapObject to be either visible or invisible at all zoom levels. |
MapObject |
setVisible(boolean isVisible)
Sets whether the visibility of the
MapObject on the map is enabled. |
MapObject |
setVisible(int level,
boolean isVisible)
Sets whether this
MapObject is visible for the specified zoom level, if enabled. |
MapObject |
setVisible(int levelStart,
int levelEnd,
boolean isVisible)
Sets whether this
MapObject is visible for the specified range of zoom levels. |
MapObject |
setVisibleMask(int level)
Sets this
MapObject to be visible at the specified zoom level. |
MapObject |
setVisibleMask(int levelStart,
int levelEnd)
Sets this
MapObject to be visible at the specified range of zoom levels. |
MapObject |
setZIndex(int index)
Sets a z-index (stacking order) value for this
MapObject. |
MapObject |
unsetVisibleMask(int level)
Sets this
MapObject to be invisible at the specified zoom level. |
MapObject |
unsetVisibleMask(int levelStart,
int levelEnd)
Sets this
MapObject to be invisible at the specified range of zoom levels. |
public abstract MapObject.Type getType()
MapObject represents.MapObject.Type valuespublic MapContainer getParent()
MapObject.MapContainer. If the current object is the root object,
null is returned.public boolean isVisible()
MapObject is visible on the map.MapObject is visible, false otherwisepublic MapObject setVisible(boolean isVisible)
MapObject on the map is enabled. Whether the
MapObject is actually visible depends on whether the visible mask is set for the
desired zoom level.
This setting is independent but takes priority over the per-zoom level settings. For example,
you can call setVisible(0, 6, true) and then call setVisible(false), and the
object will not appear on the map. Calling setVisible(false) will then cause the
object to be visible in zoom levels 0 to 6.
isVisible - A boolean variable specifying whether this MapObject is visibleMapObject itself.setVisible(int, boolean),
setVisible(int, int, boolean)public MapObject setVisible(int level, boolean isVisible)
MapObject is visible for the specified zoom level, if enabled. This
method can only be used after the MapObject has been added to the Map. By
default, the visibility bit masks for all zoom levels are set to true.
The MapObject is visible/invisible at the specified zoom level only if the
setVisible(boolean) is also set to true.
level - A zoom levelisVisible - A boolean variable specifying whether this MapObject is visibleMapObject itself.setVisible(boolean),
setVisible(int, int, boolean)public MapObject setVisible(int levelStart, int levelEnd, boolean isVisible)
MapObject is visible for the specified range of zoom levels. This
method can only be used after the MapObject has been added to the Map. By
default, the visibility bit masks for all zoom levels are set to true.
The MapObject is visible/invisible at the specified zoom levels only if the
setVisible(boolean) is also set to true.
levelStart - A starting zoom level of the range to show or hide, inclusivelevelEnd - An ending zoom level of the range to show or hide, inclusiveisVisible - A boolean variable specifying whether this MapObject is visibleMapObject itself.setVisible(boolean),
setVisible(int, boolean)public java.util.BitSet getVisibleMask()
MapObjectMapObjectpublic MapObject setVisibleMask(int levelStart, int levelEnd)
MapObject to be visible at the specified range of zoom levels. This method
is equivalent to setVisible(levelStart, levelEnd, true). It can only be used after
the MapObject has been added to the Map. By default, the visibility bit masks
for all zoom levels are set to true.
The MapObject is visible at the specified zoom level only if the visibility of the
MapObject is also set to true via setVisible(boolean).
levelStart - A starting zoom level of the rangelevelEnd - An ending zoom level of the rangeMapObject itself.setVisible(boolean),
setVisibleMask(int, int),
unsetVisibleMask(int),
unsetVisibleMask(int, int),
getVisibleMask()public MapObject unsetVisibleMask(int levelStart, int levelEnd)
MapObject to be invisible at the specified range of zoom levels. This
method is equivalent to setVisible(levelStart, levelEnd, false). It can only be used
after the MapObject has been added to the Map. By default, the visibility bit
masks for all zoom levels are set to true.levelStart - A starting zoom level of the rangelevelEnd - An ending zoom level of the rangeMapObject itself.setVisible(boolean),
unsetVisibleMask(int),
setVisibleMask(int),
setVisibleMask(int, int),
getVisibleMask()public MapObject setVisibleMask(int level)
MapObject to be visible at the specified zoom level. This method is
equivalent to setVisible(level, true). It can only be used after the
MapObject has been added to the Map. By default, the visibility bit masks for
all zoom levels are set to true.
The MapObject is visible at the specified zoom level only if the visibility of the
MapObject is also set to true via setVisible(boolean).
level - A zoom levelMapObject itself.setVisible(boolean),
setVisibleMask(int, int),
unsetVisibleMask(int),
unsetVisibleMask(int, int),
getVisibleMask()public MapObject unsetVisibleMask(int level)
MapObject to be invisible at the specified zoom level. This method is
equivalent to setVisible(level, false). It can only be used after the
MapObject has been added to the Map. By default, the visibility bit masks for
all zoom levels are set to true.level - A zoom levelMapObject itself.setVisible(boolean),
unsetVisibleMask(int, int),
setVisibleMask(int),
setVisibleMask(int, int),
getVisibleMask()public MapObject resetVisibleMask(boolean set)
MapObject to be either visible or invisible at all zoom levels. This
method is equivalent to setVisible(minimumZoom, maximumZoom, false). It can only be
used after the MapObject has been added to the Map. By default, the
visibility bit masks for all zoom levels are set to true.
This MapObject visibility mask is only applicable if
setVisible(boolean) is also set to true.
set - True to set map object as visible; false otherwise.MapObject itself.setVisible(boolean)public int getZIndex()
MapObject. A higher z-index
indicates that the object is positioned more in front.public MapObject setZIndex(int index)
MapObject.index - A new z-index value for this MapObject, a 16-bit int within the
range of [0..65535]MapObject itself.java.lang.IllegalArgumentException - If index is not within the valid range.public ViewObject.Type getBaseType()
ViewObjectViewObject.getBaseType in class ViewObjectViewObject.Type ViewObjectType, either a
USER_OBJECT or a
UNKNOWN_OBJECT.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object