public class SmartTextSymbol extends Object implements ISimpleTextSymbol, CartographicSupport
| Modifier and Type | Field and Description |
|---|---|
static String |
SMART_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME |
SYMBOL_NAME, SYMBOL_STYLE_ALIGNMENT_CENTERED, SYMBOL_STYLE_ALIGNMENT_JUSTIFY, SYMBOL_STYLE_ALIGNMENT_LEFT, SYMBOL_STYLE_ALIGNMENT_RIGHTSELECTION_COLORPAPER, WORLD| Constructor and Description |
|---|
SmartTextSymbol() |
SmartTextSymbol(ITextSymbol sym,
IPlacementConstraints constraints) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a copy of the object.
|
void |
draw(Graphics2D g,
AffineTransform affineTransform,
Geometry geom,
Feature f,
Cancellable cancel)
Draws the text according.
|
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).
|
Color |
getColor()
Returns the
Color to use to render the symbol. |
String |
getDescription()
The description is a human-readable text used to label it when show in a symbol menu or something like that.
|
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 shp,
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.
|
int |
getReferenceSystem()
Returns the Reference System used to draw the elements of the image.
|
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)
Computes a Geometry wrapping the text to be applied
|
int |
getUnit()
Returns the unit used to express measures.
|
boolean |
isAutoresizeEnabled() |
boolean |
isDrawWithHalo() |
boolean |
isOneDotOrPixel(Geometry geom,
double[] positionOfDotOrPixel,
ViewPort viewPort,
int dpi)
Informs that the geometry will be represented with that symbol in just one pixel or dot
|
boolean |
isShapeVisible()
Tells whether the shape of the symbol will be drawn or not.
|
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) |
static void |
registerPersistent() |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setAlignment(int alignment) |
void |
setAutoresizeEnabled(boolean ar) |
void |
setCartographicSize(double cartographicSize,
Geometry geom)
Sets the size of the cartographic element in pixels.
|
void |
setCharacterSpacing(double charSpacing) |
void |
setColor(Color color)
Sets the
Color to use to render the symbol. |
void |
setDescription(String d)
Sets the description of this symbol
|
void |
setDrawWithHalo(boolean h) |
void |
setFont(Font fnt)
Establishes the font that will be used to render this ITextSymbol.
|
void |
setFontSize(double d)
Sets the font size currently set to this symbol
|
void |
setHaloColor(Color co) |
void |
setHaloWidth(float w) |
void |
setIsShapeVisible(boolean v) |
void |
setKerning(boolean kerning) |
void |
setMargin(double margin) |
void |
setReferenceSystem(int rs)
Sets the Reference System that defines how this units have to be
handled.
|
void |
setRightToLeft(boolean rightToLeft) |
void |
setRotation(double rot)
Defines the angle of rotation for the text that composes the symbol
|
void |
setText(String txt)
Sets the text to be rendered by this symbol
|
void |
setTextColor(Color color)
Sets the color of the text
|
void |
setUnit(int unitIndex)
Defines the unit used to express measures.
|
void |
setWordSpacing(double wordSpacing) |
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).
|
public static final String SMART_TEXT_SYMBOL_PERSISTENCE_DEFINITION_NAME
public SmartTextSymbol(ITextSymbol sym, IPlacementConstraints constraints)
public SmartTextSymbol()
public void setIsShapeVisible(boolean v)
public boolean isShapeVisible()
ISymbolisShapeVisible in interface ISymbolpublic void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel)
public void getPixExtentPlus(Geometry shp, 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 ISymbolpublic int getOnePointRgb()
ISymbolgetOnePointRgb in interface ISymbolpublic int getSymbolType()
ISymbolgetSymbolType in interface ISymbolpublic boolean isSuitableFor(Geometry geom)
ISymbolisSuitableFor in interface ISymbolpublic void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException
ISymboldrawInsideRectangle in interface ISymbolproperties - TODOSymbolDrawingException - TODOpublic void setText(String txt)
ITextSymbolsetText in interface ITextSymbolpublic String getText()
ITextSymbolgetText in interface ITextSymbolpublic void setCharacterSpacing(double charSpacing)
public void setWordSpacing(double wordSpacing)
public void setAlignment(int alignment)
public void setKerning(boolean kerning)
public void setMargin(double margin)
public void setRightToLeft(boolean rightToLeft)
public ISymbol getSymbolForSelection()
ISymbolgetSymbolForSelection in interface ISymbolpublic boolean isOneDotOrPixel(Geometry geom, double[] positionOfDotOrPixel, ViewPort viewPort, int dpi)
ISymbolisOneDotOrPixel in interface ISymbolpositionOfDotOrPixel - (out) filled with pixel or dot locationpublic String getDescription()
ISymbolgetDescription in interface ISymbolpublic void setDescription(String d)
ISymbolsetDescription in interface ISymbolISymbol.getDescription();public Color getColor()
ISymbolColor to use to render the symbol.public void setColor(Color color)
ISymbolColor to use to render the symbol.public void print(Graphics2D g, AffineTransform at, Geometry geom, PrintAttributes properties)
print in interface IPrintablepublic void setFont(Font fnt)
ITextSymbolsetFont in interface ITextSymbolpublic Font getFont()
ITextSymbolgetFont in interface ITextSymbolpublic Color getTextColor()
ITextSymbolgetTextColor in interface ITextSymbolpublic void setTextColor(Color color)
ITextSymbolsetTextColor in interface ITextSymbolpublic void setFontSize(double d)
ITextSymbolsetFontSize in interface ITextSymbolpublic Geometry getTextWrappingShape(Point p)
ITextSymbolgetTextWrappingShape in interface ITextSymbolp - target locationpublic Rectangle getBounds()
getBounds in interface ITextSymbolpublic double getRotation()
getRotation in interface ISimpleTextSymbolpublic void setRotation(double rot)
ISimpleTextSymbolsetRotation in interface ISimpleTextSymbolpublic void setAutoresizeEnabled(boolean ar)
setAutoresizeEnabled in interface ITextSymbolpublic boolean isAutoresizeEnabled()
isAutoresizeEnabled in interface ITextSymbolpublic Color getHaloColor()
getHaloColor in interface ITextSymbolpublic void setHaloColor(Color co)
setHaloColor in interface ITextSymbolpublic float getHaloWidth()
getHaloWidth in interface ITextSymbolpublic void setHaloWidth(float w)
setHaloWidth in interface ITextSymbolpublic boolean isDrawWithHalo()
isDrawWithHalo in interface ITextSymbolpublic void setDrawWithHalo(boolean h)
setDrawWithHalo in interface ITextSymbolpublic void setUnit(int unitIndex)
CartographicSupportsetUnit in interface CartographicSupportpublic int getUnit()
CartographicSupportgetUnit in interface CartographicSupportpublic int getReferenceSystem()
CartographicSupport
The elements have to be scaled to pixel when the image is bein drawn in
order to compose the map. The elements of the map may define its size in
other units than pixel.
CartographicSupport enables the elements to define the size in
measure units but these units may refer to different reference system. Two
kinds of Reference Systems are allowed in this context: CartographicSupport.WORLD,
and CartographicSupport.PAPER.
Depending on which Reference System is used the unit used by this element
refers to distances in the real world (then they are map's CRS-dependant)
or screen or printer output (then they are output DPI-dependant)
In case the unit used is pixel then the reference system does not
have any effect since the source unit is the same than the target unit.
getReferenceSystem in interface CartographicSupportpublic void setReferenceSystem(int rs)
CartographicSupportsetReferenceSystem in interface CartographicSupportpublic void setCartographicSize(double cartographicSize,
Geometry geom)
CartographicSupportsetCartographicSize in interface CartographicSupportpublic double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupporttoCartographicSize in interface CartographicSupportpublic double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupportgetCartographicSize in interface CartographicSupportpublic Object clone() throws CloneNotSupportedException
Cloneableclone in class ObjectCloneNotSupportedException - 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 static void registerPersistent()
public void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionpublic void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceException