Class MapMarker.TextStyle

    • Constructor Detail

      • TextStyle

        public TextStyle()

        Creates a default set of styling options for the text of a MapMarker that consists of the following values:

        Once the resulting TextStyle is applied to a MapMarker, 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.InstantiationException

        Creates 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 other MapMarker instances.

        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.InstantiationException

        Creates 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 other MapMarker instances.

        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.