Class SmartTextSymbol

java.lang.Object
org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractCartographicSupport
org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
org.gvsig.labeling.symbol.SmartTextSymbol
All Implemented Interfaces:
Cloneable, org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport, org.gvsig.fmap.mapcontext.rendering.symbols.IPrintable, org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol, org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol_v2, org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol, org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol, org.gvsig.tools.lang.Cloneable, org.gvsig.tools.persistence.Persistent

public class SmartTextSymbol extends org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol implements org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol
Class used to create symbols composed using a text defined by the user.This text can be edited (changing the color, the font of the characters, and the rotation of the text)and has the property that can follow a path.If this path does not exist, the text is treated as a simpletextsymbol (when is drawn).
Author:
jaume dominguez faus - jaume.dominguez@iver.es
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol

    org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol.RegisterPersistence

    Nested classes/interfaces inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport

    org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport.CartographicContext
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol

    LOGGER, SYMBOL_PERSISTENCE_DEFINITION_NAME

    Fields inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport

    PAPER, WORLD

    Fields inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol

    SELECTION_COLOR

    Fields inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol

    SYMBOL_NAME, SYMBOL_STYLE_ALIGNMENT_CENTERED, SYMBOL_STYLE_ALIGNMENT_JUSTIFY, SYMBOL_STYLE_ALIGNMENT_LEFT, SYMBOL_STYLE_ALIGNMENT_RIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SmartTextSymbol(org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol sym, org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints constraints)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    draw(Graphics2D g, AffineTransform affineTransform, org.gvsig.fmap.geom.Geometry geom, org.gvsig.fmap.dal.feature.Feature f, org.gvsig.tools.task.Cancellable cancel)
    Draws the text according.
    void
    draw(Graphics2D g, AffineTransform affineTransform, org.gvsig.fmap.geom.Geometry geom, org.gvsig.fmap.dal.feature.Feature f, org.gvsig.tools.task.Cancellable cancel, Rectangle r)
     
    void
     
     
     
     
     
    float
     
    int
     
    void
    getPixExtentPlus(org.gvsig.fmap.geom.Geometry shp, float[] distances, org.gvsig.fmap.mapcontext.ViewPort viewPort, int dpi)
     
    double
     
    org.gvsig.fmap.geom.Geometry
     
    org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
     
    int
     
     
     
    org.gvsig.fmap.geom.Geometry
    getTextWrappingShape(org.gvsig.fmap.geom.primitive.Point p)
     
    boolean
     
    boolean
     
    boolean
    isOneDotOrPixel(org.gvsig.fmap.geom.Geometry geom, double[] positionOfDotOrPixel, org.gvsig.fmap.mapcontext.ViewPort viewPort, int dpi)
     
    boolean
    isSuitableFor(org.gvsig.fmap.geom.Geometry geom)
     
    void
    loadFromState(org.gvsig.tools.persistence.PersistentState state)
     
    void
    print(Graphics2D g, AffineTransform at, org.gvsig.fmap.geom.Geometry geom, org.gvsig.compat.print.PrintAttributes properties)
     
    static void
     
    void
    saveToState(org.gvsig.tools.persistence.PersistentState state)
     
    void
    setAlignment(int alignment)
     
    void
     
    void
    setCharacterSpacing(double charSpacing)
     
    void
    setColor(Color color)
     
    void
    setDrawWithHalo(boolean h)
     
    void
     
    void
    setFontSize(double d)
     
    void
     
    void
    setHaloWidth(float w)
     
    void
    setKerning(boolean kerning)
     
    void
    setMargin(double margin)
     
    void
    setRightToLeft(boolean rightToLeft)
     
    void
    setRotation(double rot)
     
    void
     
    void
     
    void
    setWordSpacing(double wordSpacing)
     

    Methods inherited from class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol

    cloneForSelection, cloneForSelection, equals, getDescription, getFeature, getID, getRequiredFeatureAttributeNames, getSymbolForSelection, isShapeVisible, setDescription, setFeature, setID, setIsShapeVisible

    Methods inherited from class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractCartographicSupport

    copyCartographicContext, getCartographicContext, getReferenceSystem, getUnit, isInPixels, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setReferenceSystem, setUnit, toCartographicUnits

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport

    copyCartographicContext, getCartographicContext, getReferenceSystem, getUnit, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setReferenceSystem, setUnit, toCartographicUnits

    Methods inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol

    getDescription, getFeature, getID, getSymbolForSelection, isShapeVisible, setDescription, setFeature, setID
  • Field Details

    • SMART_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME

      public static final String SMART_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME
      See Also:
  • Constructor Details

    • SmartTextSymbol

      public SmartTextSymbol(org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol sym, org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints constraints)
    • SmartTextSymbol

      public SmartTextSymbol()
  • Method Details

    • draw

      public void draw(Graphics2D g, AffineTransform affineTransform, org.gvsig.fmap.geom.Geometry geom, org.gvsig.fmap.dal.feature.Feature f, org.gvsig.tools.task.Cancellable cancel)
      Draws the text according. If this symbol has the text path set, then it is used as the text line, otherwise shp must be an FPoint2D indicating the starting point of the text and then the text will be rendered from there and following the rotation previously set.
      Specified by:
      draw in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
      Overrides:
      draw in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
    • draw

      public void draw(Graphics2D g, AffineTransform affineTransform, org.gvsig.fmap.geom.Geometry geom, org.gvsig.fmap.dal.feature.Feature f, org.gvsig.tools.task.Cancellable cancel, Rectangle r)
      Specified by:
      draw in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
    • getPixExtentPlus

      public void getPixExtentPlus(org.gvsig.fmap.geom.Geometry shp, float[] distances, org.gvsig.fmap.mapcontext.ViewPort viewPort, int dpi)
    • getOnePointRgb

      public int getOnePointRgb()
    • getSymbolType

      public int getSymbolType()
      Specified by:
      getSymbolType in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
    • isSuitableFor

      public boolean isSuitableFor(org.gvsig.fmap.geom.Geometry geom)
      Specified by:
      isSuitableFor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
    • getSampleGeometry

      public org.gvsig.fmap.geom.Geometry getSampleGeometry(Rectangle r)
    • drawInsideRectangle

      public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException
      Specified by:
      drawInsideRectangle in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
      Overrides:
      drawInsideRectangle in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
      Throws:
      org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException
    • setText

      public void setText(String txt)
      Specified by:
      setText in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getText

      public String getText()
      Specified by:
      getText in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setCharacterSpacing

      public void setCharacterSpacing(double charSpacing)
    • setWordSpacing

      public void setWordSpacing(double wordSpacing)
    • setAlignment

      public void setAlignment(int alignment)
    • setKerning

      public void setKerning(boolean kerning)
    • setMargin

      public void setMargin(double margin)
    • setRightToLeft

      public void setRightToLeft(boolean rightToLeft)
    • getSymbolForSelection

      public org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol getSymbolForSelection()
      Specified by:
      getSymbolForSelection in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
      Overrides:
      getSymbolForSelection in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
    • isOneDotOrPixel

      public boolean isOneDotOrPixel(org.gvsig.fmap.geom.Geometry geom, double[] positionOfDotOrPixel, org.gvsig.fmap.mapcontext.ViewPort viewPort, int dpi)
    • getColor

      public Color getColor()
      Specified by:
      getColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
    • setColor

      public void setColor(Color color)
      Specified by:
      setColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol
    • print

      public void print(Graphics2D g, AffineTransform at, org.gvsig.fmap.geom.Geometry geom, org.gvsig.compat.print.PrintAttributes properties)
      Specified by:
      print in interface org.gvsig.fmap.mapcontext.rendering.symbols.IPrintable
      Overrides:
      print in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
    • setFont

      public void setFont(Font fnt)
      Specified by:
      setFont in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getFont

      public Font getFont()
      Specified by:
      getFont in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getTextColor

      public Color getTextColor()
      Specified by:
      getTextColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setTextColor

      public void setTextColor(Color color)
      Specified by:
      setTextColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setFontSize

      public void setFontSize(double d)
      Specified by:
      setFontSize in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getTextWrappingShape

      public org.gvsig.fmap.geom.Geometry getTextWrappingShape(org.gvsig.fmap.geom.primitive.Point p)
      Specified by:
      getTextWrappingShape in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getBounds

      public Rectangle getBounds()
      Specified by:
      getBounds in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getRotation

      public double getRotation()
      Specified by:
      getRotation in interface org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol
    • setRotation

      public void setRotation(double rot)
      Specified by:
      setRotation in interface org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol
    • setAutoresizeEnabled

      public void setAutoresizeEnabled(boolean ar)
      Specified by:
      setAutoresizeEnabled in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • isAutoresizeEnabled

      public boolean isAutoresizeEnabled()
      Specified by:
      isAutoresizeEnabled in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getHaloColor

      public Color getHaloColor()
      Specified by:
      getHaloColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setHaloColor

      public void setHaloColor(Color co)
      Specified by:
      setHaloColor in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • getHaloWidth

      public float getHaloWidth()
      Specified by:
      getHaloWidth in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setHaloWidth

      public void setHaloWidth(float w)
      Specified by:
      setHaloWidth in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • isDrawWithHalo

      public boolean isDrawWithHalo()
      Specified by:
      isDrawWithHalo in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • setDrawWithHalo

      public void setDrawWithHalo(boolean h)
      Specified by:
      setDrawWithHalo in interface org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol
    • clone

      public Object clone() throws CloneNotSupportedException
      Specified by:
      clone in interface org.gvsig.tools.lang.Cloneable
      Overrides:
      clone in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
      Throws:
      CloneNotSupportedException
    • registerPersistent

      public static void registerPersistent()
    • loadFromState

      public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      loadFromState in interface org.gvsig.tools.persistence.Persistent
      Overrides:
      loadFromState in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • saveToState

      public void saveToState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveToState in interface org.gvsig.tools.persistence.Persistent
      Overrides:
      saveToState in class org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException