HERE Android SDK Developer's Guide

MapLabeledMarker

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

Class Summary

public final class MapLabeledMarker

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

This class represents a labeled icon on the Map.

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in MapLabeledMarker
Constructors

MapLabeledMarker (GeoCoordinate loc)

Creates a MapLabeledMarker at a specific GeoCoordinate with a default POI icon.

MapLabeledMarker (GeoCoordinate loc, Image icon)

Creates a MapLabeledMarker at a specific GeoCoordinate with the specified Image.

Method Summary

Table 2. Methods in MapLabeledMarker
Methods

public PointF getAnchorPoint ()

Returns the anchor point for this MapLabeledMarker .

public GeoCoordinate getCoordinate ()

Returns the current GeoCoordinate for this MapLabeledMarker .

public float getFontScalingFactor ()

This method get the current font scaling factor applied to draw the fonts.

public String getLabelText (String marcCode)

This method retrieves the localized text of the MapLabeledMarker .

public float getTransparency ()

Gets the current transparency for the icon.

public boolean isDeclutteringEnabled ()

This method queries if the icon decluttering is enabled.

public boolean isFadingAnimationEnabled ()

This method queries whether fading animation is enabled for the label.

public boolean isOverlappingEnabled ()

This method queries if icons can be rendered overlapping the labels in the map if they share a common screen area.

public MapLabeledMarker setAnchorPoint (PointF anchor)

Sets an anchor point for this MapLabeledMarker .

public MapLabeledMarker setCoordinate (GeoCoordinate value)

Sets a GeoCoordinate for this MapLabeledMarker .

public MapLabeledMarker setDeclutteringEnabled (boolean enabled)

This method enables or disables decluttering in tilted view.

public MapLabeledMarker setFadingAnimationEnabled (boolean enabled)

This method enables or disables fading animation for the label.

public MapLabeledMarker setFontScalingFactor (float value)

This method set the new font scaling factor will be applied to draw the fonts.

public MapLabeledMarker setIcon (IconCategory value)

Sets this MapLabeledMarker to use the default places category icon of the specified IconCategory.

public MapLabeledMarker setIcon (Image icon)

Sets an icon image for this MapLabeledMarker .

public MapLabeledMarker setLabelText (String marcCode, String text)

This method sets the localized text of the MapLabeledMarker .

public MapLabeledMarker setOverlappingEnabled (boolean enabled)

This method enables or disables labels rendered later in the map to overlap on the icon if they share a common screen area.

public MapLabeledMarker setTransparency (float value)

Sets a transparency level, within the range of [0..1], for the icon.

Class Details

This class represents a labeled icon on the Map.

Different from MapMarkers, the MapLabeledMarker s avoid overlapping with other user-defined labeled icons as well as built-in icons and texts on the map. It provides the possibility of using built-in POI icons by specifying a IconCategory or using an Image. One can specify multilingual texts to the icon. Depending on the current language and secondary language of Map , different language of text can be displayed.

Constructor Details

MapLabeledMarker (GeoCoordinate loc)

Creates a MapLabeledMarker at a specific GeoCoordinate with a default POI icon.

Parameters:

  • loc

    A GeoCoordinate representing this marker's location.

MapLabeledMarker (GeoCoordinate loc, Image icon)

Creates a MapLabeledMarker at a specific GeoCoordinate with the specified Image.

Parameters:

  • loc

    A GeoCoordinate representing this marker's location.

  • icon

    An Image representing this marker's icon.

Throws:

  • IllegalArgumentException

    if loc or icon is invalid.

Method Details

public PointF getAnchorPoint ()

Returns the anchor point for this MapLabeledMarker .

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 MapLabeledMarker is centered in the center of the icon image.

public GeoCoordinate getCoordinate ()

Returns the current GeoCoordinate for this MapLabeledMarker .

Returns:

The current GeoCoordinate location

public float getFontScalingFactor ()

This method get the current font scaling factor applied to draw the fonts.

Returns:

A float value representing the current font factor. If the value cannot be retrieved, returns -1.

public String getLabelText (String marcCode)

This method retrieves the localized text of the MapLabeledMarker .

For more information about MARC code, see http://www.loc.gov/marc/languages.

Parameters:

  • marcCode

    The international MARC code describing the language of the text. Case-insensitive.

Returns:

The text for the marker corresponds to the language MARC code.

Throws:

  • IllegalArgumentException

    if invalid marcCode provided.

public float getTransparency ()

Gets the current transparency for the icon.

The transparency level is only precise to two decimal places due to numerical operations performed internally when rendering the map.

Returns:

The current transparency of the icon

public boolean isDeclutteringEnabled ()

This method queries if the icon decluttering is enabled.

Returns:

true if the decluttering is enabled. Otherwise returns false.

public boolean isFadingAnimationEnabled ()

This method queries whether fading animation is enabled for the label.

Returns:

true if fading animation is enabled, false otherwise.

public boolean isOverlappingEnabled ()

This method queries if icons can be rendered overlapping the labels in the map if they share a common screen area.

Returns:

true if icon overlapping is enabled, false otherwise.

public MapLabeledMarker setAnchorPoint (PointF anchor)

Sets an anchor point for this MapLabeledMarker .

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 MapLabeledMarker is centered in the center of the icon image.

Parameters:

  • anchor

    A PointF relative to the top-left corner of the MapLabeledMarker.

Returns:

The updated MapLabeledMarker itself.

public MapLabeledMarker setCoordinate (GeoCoordinate value)

Sets a GeoCoordinate for this MapLabeledMarker .

Parameters:

  • value

    Desired GeoCoordinate location for this marker.

Returns:

The updated MapLabeledMarker itself.

Throws:

  • IllegalArgumentException

    if value is invalid.

public MapLabeledMarker setDeclutteringEnabled (boolean enabled)

This method enables or disables decluttering in tilted view. By enabling this, icons will not be shown when they are faraway in tilted view. By default, decluttering is disabled.

Parameters:

  • enabled

    true means enabling icon decluttering.

Returns:

The updated MapLabeledMarker itself.

public MapLabeledMarker setFadingAnimationEnabled (boolean enabled)

This method enables or disables fading animation for the label. However, the fading animation set using setFadingAnimations(boolean) takes priority over this setting. For example, if the fading animation is disabled for the Map, which contains the label, the fading will be also disabled for the label regardless the state set to this label.

Fading animation is enabled by default.

Parameters:

  • enabled

    true to enable fading animation.

Returns:

The updated MapLabeledMarker itself.

public MapLabeledMarker setFontScalingFactor (float value)

This method set the new font scaling factor will be applied to draw the fonts.

Parameters:

  • value

    A floating point value representing the new font factor. Valid values must be between 1.0 and 2.0.

Returns:

The updated MapLabeledMarker itself.

Throws:

  • IllegalArgumentException

    if invalid value provided is out of range.

public MapLabeledMarker setIcon (IconCategory value)

Sets this MapLabeledMarker to use the default places category icon of the specified IconCategory.

If no icon is available for the specified IconCategory , a default icon will be used.

Parameters:

  • value

    An IconCategory of the icon to be used for the marker.

Returns:

The updated MapLabeledMarker itself.

public MapLabeledMarker setIcon (Image icon)

Sets an icon image for this MapLabeledMarker .

Parameters:

  • icon

    An Image representing this marker's icon

Returns:

The updated MapLabeledMarker itself.

Throws:

  • IllegalArgumentException

    if icon is invalid.

public MapLabeledMarker setLabelText (String marcCode, String text)

This method sets the localized text of the MapLabeledMarker . If there is an existing localization for the specified language, the existing one will be replaced. Otherwise, the new localized text will be stored. When text is an empty string, the existing localized text, if any, will be removed.

If the text contains any glyphs, which are currently not supported by the fonts shipped with the library, those glyphs will not be displayed.

The text label may not be displayed in certain Schemes to ensure scheme-specific visual effects are unaffected.

For more information about MARC code, see http://www.loc.gov/marc/languages.

Parameters:

  • marcCode

    The international MARC code describing the language of the text. Case-insensitive.

  • text

    The text for the marker in the language described by the marcCode.

Returns:

The updated MapLabeledMarker itself.

Throws:

  • IllegalArgumentException

    if invalid marcCode provided.

public MapLabeledMarker setOverlappingEnabled (boolean enabled)

This method enables or disables labels rendered later in the map to overlap on the icon if they share a common screen area. By default, overlapping is enabled.

Parameters:

  • enabled

    true to enable icon overlapping, false otherwise.

Returns:

The updated MapLabeledMarker itself.

public MapLabeledMarker setTransparency (float value)

Sets a transparency level, within the range of [0..1], for the icon. By default, transparency level is 1.

Parameters:

  • value

    Desired alpha value for the icon, 0 for fully transparent, 1 for fully opaque.

Returns:

The updated MapLabeledMarker itself.

Throws:

  • IllegalArgumentException

    if value is out of range.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.