HERE Android SDK Developer's Guide

MapObject

The class MapObject is a member of com.here.android.mpa.mapping .

Class Summary

public abstract class MapObject

extends com.here.android.mpa.common.ViewObject, java.lang.Object

Represents a base class for all map-related objects that users can add to a Map.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in MapObject
Nested Classes

public static final enumeration MapObject.Type

Represents values describing the types of MapObject objects that can be added to a Map.

Method Summary

Table 2. Methods in MapObject
Methods

public MapOverlayType getOverlayType ()

Returns the overlay in which this MapObject appears.

public MapContainer getParent ()

Returns the parent of this MapObject .

public MapOverlayType getReserveOverlayType ()

Returns the overlay in which this MapObject reserves screen space.

public Type getType ()

Returns the type of object that this MapObject represents.

public BitSet getVisibleMask ()

Returns the visibility bit mask of this MapObject

public int getZIndex ()

Returns the current z-index (stacking order) of this MapObject .

public boolean isVisible ()

Determines whether the visibility of this MapObject on the map is enabled.

public MapObject resetVisibleMask (boolean set)

Resets the entire visibility bit mask of this MapObject to be either 1s or 0s.

public MapObject setOverlayType (MapOverlayType type)

Sets the display order in which this MapObject appears relating to other layers of the map.

public MapObject setReserveOverlayType (MapOverlayType type)

Currently this method is only supported for MapLabeledMarker objects.

public MapObject setVisible (boolean isVisible)

Sets whether the visibility of the MapObject on the map is enabled.

public MapObject setVisibleMask (int level)

Sets this MapObject to be visible at the specified zoom level.

public MapObject setVisibleMask (int levelStart, int levelEnd)

Sets this MapObject to be visible for the specified range of zoom levels.

public MapObject setZIndex (int index)

Sets a z-index (stacking order) value for this MapObject .

public MapObject unsetVisibleMask (int level)

Sets this MapObject to be invisible at the specified zoom level by unsetting the visibility bit mask.

public MapObject unsetVisibleMask (int levelStart, int levelEnd)

Sets this MapObject to be invisible for the specified range of zoom levels by unsetting the visibility bit mask.

Class Details

Represents a base class for all map-related objects that users can add to a 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 and MapContainer, can be grouped within a MapContainer instance.

For a complete enumeration of available MapObject types, refer to MapObject.Type.

Method Details

public MapOverlayType getOverlayType ()

Returns the overlay in which this MapObject appears.

Returns:

A MapOverlayType specifying the display grouping of the MapObject

public MapContainer getParent ()

Returns the parent of this MapObject .

Returns:

The parent MapContainer. If the current object is the root object, null is returned.

public MapOverlayType getReserveOverlayType ()

Returns the overlay in which this MapObject reserves screen space.

Returns:

A MapOverlayType specifying the display grouping of the MapObject

public Type getType ()

Returns the type of object that this MapObject represents.

Returns:

One of the MapObject.Type values

public BitSet getVisibleMask ()

Returns the visibility bit mask of this MapObject

Returns:

BitSet which defines the visibility bit mask of the MapObject

public int getZIndex ()

Returns the current z-index (stacking order) of this MapObject . A higher z-index indicates that the object is positioned more in front.

Returns:

The current ordinal z-index number

public boolean isVisible ()

Determines whether the visibility of this 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.

Returns:

True if this MapObject is visible, false otherwise

See also:

setVisibleMask(int)

setVisibleMask(int, int)

unsetVisibleMask(int)

unsetVisibleMask(int, int)

getVisibleMask()

public MapObject resetVisibleMask (boolean set)

Resets the entire visibility bit mask of this MapObject to be either 1s or 0s. This method can only be used after the MapObject has been added to the Map.

Note: The MapObject is visible at the specified zoom level only if the visibility of the MapObject is also set to true via setVisible(boolean).

Parameters:

  • set

    True to reset mask to all 1s; false to reset mask to all 0s

Returns:

The updated MapObject itself.

See also:

setVisible(boolean)

public MapObject setOverlayType (MapOverlayType type)

Sets the display order in which this MapObject appears relating to other layers of the map. Note that this API only takes effect if the object is currently not added to a Map. To change the MapOverlayType, the MapObject object must be removed and added from the map again.

Parameters:

  • type

    A MapOverlayType specifying the display grouping of this MapObject

Returns:

The updated MapObject itself.

See also:

addMapObject(MapObject)

removeMapObject(MapObject)

public MapObject setReserveOverlayType (MapOverlayType type)

Currently this method is only supported for MapLabeledMarker objects.

It sets the reserve order in which this MapObject reserves screen space relating to other layers of the map. When applied, the screen space around the label will be reserved for the layer and ensure the label can be rendered without obstruction by other objects.

Note that this API only takes effect if the object is currently not added to a Map. To change the MapOverlayType, the MapObject object must be removed and added from the map again.

Parameters:

  • type

    A MapOverlayType specifying the display grouping of this MapObject

Returns:

The updated MapObject itself.

Throws:

  • IllegalArgumentException

    if the MapObject is not a MapLabeledMarker object.

See also:

addMapObject(MapObject)

removeMapObject(MapObject)

public MapObject setVisible (boolean isVisible)

Sets whether the visibility of the 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 mask. For example, if you call setVisibleMask(0, 6) and then call setVisible(false) , the object will not appear on the map. Calling setVisible(true) will then cause the object to be visible in zoom levels 0 to 6.

Parameters:

  • isVisible

    A boolean variable specifying whether this MapObject is visible

Returns:

The updated MapObject itself.

See also:

setVisibleMask(int)

setVisibleMask(int, int)

unsetVisibleMask(int)

unsetVisibleMask(int, int)

getVisibleMask()

public MapObject setVisibleMask (int level)

Sets this MapObject to be visible at the specified zoom level. The MapObject is only visible at the specified zoom level only if the visibility of the MapObject is set to true via setVisible(boolean).

Setting the bit mask at a particular zoom level does not affect other levels. By default, the visibility bit masks for all zoom levels are set to true.

Parameters:

  • level

    A zoom level

Returns:

The updated MapObject itself.

See also:

setVisible(boolean)

setVisibleMask(int, int)

unsetVisibleMask(int)

unsetVisibleMask(int, int)

getVisibleMask()

public MapObject setVisibleMask (int levelStart, int levelEnd)

Sets this MapObject to be visible for the specified range of zoom levels. The MapObject is only visible for the specified range of zoom levels only if the visibility of the MapObject is set to true via setVisible(boolean).

Setting the bit mask on a range of zoom levels does not affect other levels. By default, the visibility bit masks for all zoom levels are set to true.

Parameters:

  • levelStart

    A starting zoom level of the range

  • levelEnd

    An ending zoom level of the range

Returns:

The updated MapObject itself.

See also:

setVisible(boolean)

setVisibleMask(int)

unsetVisibleMask(int)

unsetVisibleMask(int, int)

getVisibleMask()

public MapObject setZIndex (int index)

Sets a z-index (stacking order) value for this MapObject .

Note that this API is not supported by MapLabeledMarker.

Parameters:

  • index

    A new z-index value for this MapObject, a 16-bit int within the range of [0..65535]

Returns:

The updated MapObject itself.

Throws:

  • IllegalArgumentException

    if index is not within the valid range.

public MapObject unsetVisibleMask (int level)

Sets this MapObject to be invisible at the specified zoom level by unsetting the visibility bit mask.

Setting the bit mask at a particular zoom level does not affect other levels. By default, the visibility bit masks for all zoom levels are set to true.

Parameters:

  • level

    A zoom level

Returns:

The updated MapObject itself.

See also:

setVisible(boolean)

unsetVisibleMask(int, int)

setVisibleMask(int)

setVisibleMask(int, int)

getVisibleMask()

public MapObject unsetVisibleMask (int levelStart, int levelEnd)

Sets this MapObject to be invisible for the specified range of zoom levels by unsetting the visibility bit mask.

Unsetting the bit mask on a range of zoom levels does not affect other levels. By default, the visibility bit masks for all zoom levels are set to true.

Parameters:

  • levelStart

    A starting zoom level of the range

  • levelEnd

    An ending zoom level of the range

Returns:

The updated MapObject itself.

See also:

setVisible(boolean)

unsetVisibleMask(int)

setVisibleMask(int)

setVisibleMask(int, int)

getVisibleMask()