Class MapMarker.TextStyle
Class MapMarker.TextStyle
- java.lang.Object
-
- com.here.NativeBase
-
- com.here.sdk.mapview.MapMarker.TextStyle
-
- Enclosing class:
- MapMarker
public static final class MapMarker.TextStyle extends NativeBase
Styling options for the text of a
MapMarker.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapMarker.TextStyle.InstantiationErrorCodeDescribes a reason for failing to create aMapMarker.TextStyle.static classMapMarker.TextStyle.InstantiationExceptionThrown when a problem occurs while trying to create aMapMarker.TextStyleinstance.static classMapMarker.TextStyle.PlacementRepresents text placement with respect to the icon of aMapMarker.
-
Constructor Summary
Constructors Constructor Description TextStyle()Creates a default set of styling options for the text of aMapMarkerthat consists of the following values: Text size: 18 pixels Text color: opaque white Text outline size: 0 pixels Text outline color: opaque black Text placement:MapMarker.TextStyle.Placement.BOTTOMTextStyle(double textSize, Color textColor, double textOutlineSize, Color textOutlineColor, java.util.List<MapMarker.TextStyle.Placement> placements)Creates a set of styling options for the text of aMapMarker.TextStyle(double textSize, Color textColor, double textOutlineSize, Color textOutlineColor, java.util.List<MapMarker.TextStyle.Placement> placements, java.lang.String fontName)Creates a set of styling options for the text of aMapMarker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFontName()Gets the font name.java.util.List<MapMarker.TextStyle.Placement>getPlacements()Gets the possible text placements relative to the icon of aMapMarker.ColorgetTextColor()Gets the text color.ColorgetTextOutlineColor()Gets the text outline color.doublegetTextOutlineSize()Gets the text outline size in pixels.doublegetTextSize()Gets the text size in pixels.
-
-
-
Constructor Detail
-
TextStyle
public TextStyle()
Creates a default set of styling options for the text of a
MapMarkerthat consists of the following values:- Text size: 18 pixels
- Text color: opaque white
- Text outline size: 0 pixels
- Text outline color: opaque black
- Text placement:
MapMarker.TextStyle.Placement.BOTTOM
Once the resulting
TextStyleis applied to aMapMarker, its text will be centered over its image. The font will be 18 pixels wide, colored opaque white and will have no visible outline.
-
TextStyle
public TextStyle(double textSize, @NonNull Color textColor, double textOutlineSize, @NonNull Color textOutlineColor, @NonNull java.util.List<MapMarker.TextStyle.Placement> placements) throws MapMarker.TextStyle.InstantiationExceptionCreates a set of styling options for the text of a
MapMarker.List of placements is used to specify allowed placement of text relative to the icon. When marker overlapping is allowed as set by
MapMarker.setOverlapAllowed(boolean), only first placement element is considered. Otherwise the placement value is chosen so that the text does not overlap with otherMapMarkerinstances.Placement values are prioritized according to the order in which they appear in the list. Lists with duplicate entries as well as empty lists are not supported.
- Parameters:
textSize-The size of the text in pixels. Only positive values are supported.
textColor-The text color.
textOutlineSize-The size of the text outline in pixels. Only non-negative values are supported.
textOutlineColor-The color of the text outline.
placements-List of allowed placements of the text relative to the icon of a
MapMarker.- Throws:
MapMarker.TextStyle.InstantiationException-In case of invalid input parameters.
-
TextStyle
public TextStyle(double textSize, @NonNull Color textColor, double textOutlineSize, @NonNull Color textOutlineColor, @NonNull java.util.List<MapMarker.TextStyle.Placement> placements, @NonNull java.lang.String fontName) throws MapMarker.TextStyle.InstantiationExceptionCreates a set of styling options for the text of a
MapMarker.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.
List of placements is used to specify allowed placement of text relative to the icon. When marker overlapping is allowed as set by
MapMarker.setOverlapAllowed(boolean), only first placement element is considered. Otherwise the placement value is chosen so that the text does not overlap with otherMapMarkerinstances.Placement values are prioritized according to the order in which they appear in the list. Lists with duplicate entries as well as empty lists are not supported.
- Parameters:
textSize-The size of the text in pixels. Only positive values are supported.
textColor-The text color.
textOutlineSize-The size of the text outline in pixels. Only non-negative values are supported.
textOutlineColor-The color of the text outline.
placements-List of allowed placements of the text relative to the icon of a
MapMarker.fontName-Font name, registered with
AssetsManager.registerFont. If empty string is provided, a default font will be used.- Throws:
MapMarker.TextStyle.InstantiationException-In case of invalid input parameters.
-
-
Method Detail
-
getFontName
@NonNull public java.lang.String getFontName()
Gets the font name.
- Returns:
The font used in the text style.
-
getTextSize
public double getTextSize()
Gets the text size in pixels.
- Returns:
The text size in pixels.
-
getTextColor
@NonNull public Color getTextColor()
Gets the text color.
- Returns:
The text color.
-
getTextOutlineSize
public double getTextOutlineSize()
Gets the text outline size in pixels.
- Returns:
The text outline size in pixels.
-
getTextOutlineColor
@NonNull public Color getTextOutlineColor()
Gets the text outline color.
- Returns:
The text outline color.
-
getPlacements
@NonNull public java.util.List<MapMarker.TextStyle.Placement> getPlacements()
Gets the possible text placements relative to the icon of a
MapMarker.- Returns:
List of possible text placements relative to the icon of a
MapMarker.
-
-