Class TextStyle2D

  • All Implemented Interfaces:
    Cloneable

    public class TextStyle2D
    extends Style2D
    DJB:

    This class was fundamentally wrong - it tried to convert into . Not only was it doing a really crappy job, but its fundamentally the wrong place to do it.

    The SLD spec defines a as:

    and as:

    its annotated as: A "PerpendicularOffset" gives the perpendicular distance away from a line to draw a label. which is a bit vague, but there's a little more details here:

    The PerpendicularOffset element of a LinePlacement gives the perpendicular distance away from a line to draw a label. ... The distance is in pixels and is positive to the left-hand.

    Left hand/right hand for perpendicularOffset is just crap - I'm assuming them mean +ive --> "up" and -ive --> "down". See the actual label code for how it deals with this.

    I've removed all the absoluteLineDisplacement stuff and replaced it with isPointPlacement() (true) --> render normally (PointPlacement Attributes) isPointPlacement() (false) --> render LinePlacement

    This replaces the old behavior which converted a LinePlacement -> pointplacement and set the absoluteLineDisplacement flag!

    • Constructor Detail

      • TextStyle2D

        public TextStyle2D()
    • Method Detail

      • getAnchorX

        public double getAnchorX()
      • getAnchorY

        public double getAnchorY()
      • getFont

        public Font getFont()
      • getHaloComposite

        public Composite getHaloComposite()
      • getHaloFill

        public Paint getHaloFill()
      • getHaloRadius

        public float getHaloRadius()
      • getRotation

        public double getRotation()
      • getTextGlyphVector

        public GlyphVector getTextGlyphVector​(Graphics2D graphics)
        Gets the glyph vector for the main font
      • getHaloShape

        public Shape getHaloShape​(Graphics2D graphics)
      • setAnchorX

        public void setAnchorX​(double f)
        Parameters:
        f -
      • setAnchorY

        public void setAnchorY​(double f)
        Parameters:
        f -
      • setFont

        public void setFont​(Font font)
        Parameters:
        font -
      • setHaloComposite

        public void setHaloComposite​(Composite composite)
        Parameters:
        composite -
      • setHaloFill

        public void setHaloFill​(Paint paint)
        Parameters:
        paint -
      • setHaloRadius

        public void setHaloRadius​(float f)
        Parameters:
        f -
      • setRotation

        public void setRotation​(double f)
        Parameters:
        f -
      • getLabel

        public String getLabel()
        Returns:
        Returns the label.
      • setLabel

        public void setLabel​(String label)
        Parameters:
        label - The label to set.
      • isPointPlacement

        public boolean isPointPlacement()
        Returns:
        Returns the pointPlacement (true => point placement, false => line placement)
      • setPointPlacement

        public void setPointPlacement​(boolean pointPlacement)
        Parameters:
        pointPlacement - (true => point placement, false => line placement.)
      • getDisplacementX

        public double getDisplacementX()
        Returns:
        Returns the displacementX.
      • setDisplacementX

        public void setDisplacementX​(double displacementX)
        Parameters:
        displacementX - The displacementX to set.
      • getDisplacementY

        public double getDisplacementY()
        Returns:
        Returns the displacementY.
      • setDisplacementY

        public void setDisplacementY​(double displacementY)
        Parameters:
        displacementY - The displacementY to set.
      • getFill

        public Paint getFill()
        Getter for property fill.
        Returns:
        Value of property fill.
      • setFill

        public void setFill​(Paint fill)
        Setter for property fill.
        Parameters:
        fill - New value of property fill.
      • setPerpendicularOffset

        public void setPerpendicularOffset​(int displace)
        only valid for a isPointPlacement=false (ie. a lineplacement)
        Parameters:
        displace - in pixels
      • getPerpendicularOffset

        public int getPerpendicularOffset()
        only valid for a isPointPlacement=false (ie. a lineplacement)
        Returns:
        displacement in pixels
      • getComposite

        public Composite getComposite()
        Getter for property composite.
        Returns:
        Value of property composite.
      • setComposite

        public void setComposite​(Composite composite)
        Setter for property composite.
        Parameters:
        composite - New value of property composite.
      • toString

        public String toString()
        Returns a string representation of this style.
        Overrides:
        toString in class Object
      • setGraphic

        public void setGraphic​(Style2D s)
        Sets the style2D to be drawn underneath this text
      • getGraphic

        public Style2D getGraphic()
        gets the Style2D to be drawn underneath this text
      • getGraphicDimensions

        public Rectangle getGraphicDimensions()
      • getFonts

        public Font[] getFonts()
        Returns:
        the fonts
      • setFonts

        public void setFonts​(Font[] fonts)
        Parameters:
        fonts - the fonts to set