public class SimpleTextSymbol extends AbstractSymbol implements ITextSymbol, ISimpleTextSymbol
Modifier and Type | Class and Description |
---|---|
static class |
SimpleTextSymbol.RegisterPersistence |
static class |
SimpleTextSymbol.RegisterSymbol |
Modifier and Type | Field and Description |
---|---|
static String |
SIMPLE_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME |
SYMBOL_PERSISTENCE_DEFINITION_NAME
SYMBOL_NAME, SYMBOL_STYLE_ALIGNMENT_CENTERED, SYMBOL_STYLE_ALIGNMENT_JUSTIFY, SYMBOL_STYLE_ALIGNMENT_LEFT, SYMBOL_STYLE_ALIGNMENT_RIGHT
SELECTION_COLOR
PAPER, WORLD
Constructor and Description |
---|
SimpleTextSymbol() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates a copy of the object.
|
void |
draw(Graphics2D g,
AffineTransform affineTransform,
Geometry geom,
Feature feature,
Cancellable cancel)
Used when a symbol is going to be drawn.The method to do
it will depend on the derived version of the symbol.
|
void |
drawInsideRectangle(Graphics2D g,
AffineTransform scaleInstance,
Rectangle r,
PrintAttributes properties)
Useful to render the symbol inside the TOC, or inside little
rectangles.
|
Rectangle |
getBounds() |
double |
getCartographicSize(ViewPort viewPort,
double dpi,
Geometry geom)
Gets the size (in pixels) of the cartographic element according
to the current rendering context (output dpi, map scale, map units) and the
symbol cartgraphic settings (unit, size, and unit reference system).
|
String |
getClassName() |
Color |
getColor()
Returns the
Color to use to render the symbol. |
Font |
getFont()
Returns the currently set font.
|
Color |
getHaloColor() |
float |
getHaloWidth() |
int |
getOnePointRgb()
Returns the rgb of the symbol when it is drawn like a point.
|
void |
getPixExtentPlus(Geometry geom,
float[] distances,
ViewPort viewPort,
int dpi)
Returns the distance between the shape's bounding box and the
symbol-that-represents-this-shape's bounding box in a two-length-float
array passed as parameter.
|
double |
getRotation() |
ISymbol |
getSymbolForSelection()
Returns the derived version of the symbol that will be used to draw the
feature when it is selected.
|
int |
getSymbolType()
The use of this method -and its mechanism- is being valorated.
|
String |
getText()
Returns the text contained by this symbol
|
Color |
getTextColor()
Returns the currently color set to be applied to the text
|
Geometry |
getTextWrappingShape(Point p)
Returns an Geometry which represents a rectangle containing the text in
screen units.
|
boolean |
isAutoresizeEnabled() |
boolean |
isDrawWithHalo() |
boolean |
isSuitableFor(Geometry geom)
True if this symbol is ok for the geometry.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
print(Graphics2D g,
AffineTransform at,
Geometry geom,
PrintAttributes properties) |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setAutoresizeEnabled(boolean autoresizeFlag) |
void |
setCartographicSize(double cartographicSize,
Geometry geom)
Sets the size of the cartographic element in pixels.
|
void |
setColor(Color color)
Sets the
Color to use to render the symbol. |
void |
setDrawWithHalo(boolean drawWithHalo) |
void |
setFont(Font font)
Establishes the font that will be used to render this ITextSymbol.
|
void |
setFontSize(double size)
Sets the font size currently set to this symbol
|
void |
setHaloColor(Color co) |
void |
setHaloWidth(float haloWidth) |
void |
setRotation(double rotation)
Defines the angle of rotation for the text that composes the symbol
|
void |
setText(String text)
Sets the text to be rendered by this symbol
|
void |
setTextColor(Color color)
Sets the color of the text
|
double |
toCartographicSize(ViewPort viewPort,
double dpi,
Geometry geom)
Computes and sets the size (in pixels) of the cartographic element according
to the current rendering context (output dpi, map scale, map units) and the
symbol cartgraphic settings (unit, size, and unit reference system).
|
cloneForSelection, equals, getDescription, getID, getReferenceSystem, getUnit, isOneDotOrPixel, isShapeVisible, setDescription, setID, setIsShapeVisible, setReferenceSystem, setUnit
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription, isOneDotOrPixel, isShapeVisible, setDescription
public static final String SIMPLE_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME
public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature feature, Cancellable cancel)
ISymbol
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException
ISymbol
drawInsideRectangle
in interface ISymbol
properties
- TODOSymbolDrawingException
- TODOpublic int getOnePointRgb()
ISymbol
getOnePointRgb
in interface ISymbol
public void getPixExtentPlus(Geometry geom, float[] distances, ViewPort viewPort, int dpi)
ISymbol
Returns the distance between the shape's bounding box and the
symbol-that-represents-this-shape's bounding box in a two-length-float
array passed as parameter.
After this method returns, the float array passed will contain two values
representing the amount of pixels separating each of the X (first element)
and Y (second element) axes.
This distance maybe dependent on:
And in any other case, if the unit of the symbol is pixels or the symbol is not even an instance of CartographicSupport, the returning values are only defined by the symbol and are not calculated.
getPixExtentPlus
in interface ISymbol
public ISymbol getSymbolForSelection()
ISymbol
getSymbolForSelection
in interface ISymbol
public int getSymbolType()
ISymbol
getSymbolType
in interface ISymbol
public boolean isSuitableFor(Geometry geom)
ISymbol
isSuitableFor
in interface ISymbol
public String getClassName()
public void print(Graphics2D g, AffineTransform at, Geometry geom, PrintAttributes properties)
print
in interface IPrintable
public String getText()
ITextSymbol
getText
in interface ITextSymbol
public Font getFont()
ITextSymbol
getFont
in interface ITextSymbol
public Color getTextColor()
ITextSymbol
getTextColor
in interface ITextSymbol
public void setText(String text)
ITextSymbol
setText
in interface ITextSymbol
public void setFont(Font font)
ITextSymbol
setFont
in interface ITextSymbol
public void setTextColor(Color color)
ITextSymbol
setTextColor
in interface ITextSymbol
public Color getColor()
ISymbol
Color
to use to render the symbol.public void setColor(Color color)
ISymbol
Color
to use to render the symbol.public void setFontSize(double size)
ITextSymbol
setFontSize
in interface ITextSymbol
public double getRotation()
getRotation
in interface ISimpleTextSymbol
public void setRotation(double rotation)
setRotation
in interface ISimpleTextSymbol
rotation
- public Geometry getTextWrappingShape(Point p)
getTextWrappingShape
in interface ITextSymbol
p
- target locationpublic Rectangle getBounds()
getBounds
in interface ITextSymbol
public void setCartographicSize(double cartographicSize, Geometry geom)
CartographicSupport
setCartographicSize
in interface CartographicSupport
public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupport
toCartographicSize
in interface CartographicSupport
public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupport
getCartographicSize
in interface CartographicSupport
public boolean isAutoresizeEnabled()
isAutoresizeEnabled
in interface ITextSymbol
public void setAutoresizeEnabled(boolean autoresizeFlag)
setAutoresizeEnabled
in interface ITextSymbol
public Object clone() throws CloneNotSupportedException
Cloneable
clone
in class AbstractSymbol
CloneNotSupportedException
- if the instance of the object cannot
be cloned. As this is extending Cloneable
so
its sure it implements it, so this exception may be used for problems
on specific object instances.Object#clone()}.
public void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
loadFromState
in class AbstractSymbol
PersistenceException
public void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
saveToState
in class AbstractSymbol
PersistenceException
public Color getHaloColor()
getHaloColor
in interface ITextSymbol
public void setHaloColor(Color co)
setHaloColor
in interface ITextSymbol
public float getHaloWidth()
getHaloWidth
in interface ITextSymbol
public void setHaloWidth(float haloWidth)
setHaloWidth
in interface ITextSymbol
public boolean isDrawWithHalo()
isDrawWithHalo
in interface ITextSymbol
public void setDrawWithHalo(boolean drawWithHalo)
setDrawWithHalo
in interface ITextSymbol