Class TextLabel

  • All Implemented Interfaces:
    StyleKeys

    public class TextLabel
    extends java.lang.Object
    implements StyleKeys
    Represents the rendering style for a textual label placed somewhere on the map.
    Since:
    3880
    • Constructor Detail

      • TextLabel

        protected TextLabel​(LabelCompositionStrategy strategy,
                            java.awt.Font font,
                            RotationAngle rotationAngle,
                            java.awt.Color color,
                            java.lang.Float haloRadius,
                            java.awt.Color haloColor)
        Creates a new text element
        Parameters:
        strategy - the strategy indicating how the text is composed for a specific OsmPrimitive to be rendered. If null, no label is rendered.
        font - the font to be used. Must not be null.
        rotationAngle - the rotation angle to be used. Must not be null.
        color - the color to be used. Must not be null
        haloRadius - halo radius
        haloColor - halo color
      • TextLabel

        public TextLabel​(TextLabel other)
        Copy constructor
        Parameters:
        other - the other element.
    • Method Detail

      • create

        public static TextLabel create​(Environment env,
                                       java.awt.Color defaultTextColor,
                                       boolean defaultAnnotate)
        Builds a text element from style properties in c and the default text color defaultTextColor
        Parameters:
        env - the environment
        defaultTextColor - the default text color. Must not be null.
        defaultAnnotate - true, if a text label shall be rendered by default, even if the style sheet doesn't include respective style declarations
        Returns:
        the text element or null, if the style properties don't include properties for text rendering
        Throws:
        java.lang.IllegalArgumentException - if defaultTextColor is null
      • getTextOffset

        public static java.awt.geom.Point2D getTextOffset​(Cascade c)
        Gets the text-offset property from a cascade
        Parameters:
        c - The cascade
        Returns:
        The text offset property
      • getString

        public java.lang.String getString​(IPrimitive osm)
        Replies the label to be rendered for the primitive osm.
        Parameters:
        osm - the OSM object
        Returns:
        the label, or null, if osm is null or if no label can be derived for osm
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object