public class SmartTextSymbolLabelClass extends Object implements ILabelClass
SmartTextSymbolLabelClass.java
This is a wrapper to be able to use a SmartTextSymbol as a
LabelClass. A SmartTextSymbol uses a line instead of a point.
Being in fact a Line and not a Marker, it does not make any sense
to have label styles since the label styles are well-defined rectangle
areas where texts are placed in fields backgrounded by an image. In this
contexts, the area is defined dinamically for each line, and there is no
sense to have texts fields. They will be rendered as a single string
along a line.
The label itself is the SmartTextSymbol,
the geometry (the line), the label expression,
and the text applied to the symbol.
Most of the operations performed by this LabelClass are in fact
delegated to the symbol.
| Modifier and Type | Field and Description |
|---|---|
static String |
SMART_LABEL_CLASS_PERSISTENCE_DEFINITION_NAME |
PAPER, WORLD| Constructor and Description |
|---|
SmartTextSymbolLabelClass() |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a copy of the object.
|
void |
draw(Graphics2D graphics,
ILabelLocationMetrics llm,
Geometry geo)
LabelLocationMetrics, contains the anchor point, rotation, and some
other geometric calculations computed by the PlacementManager.
|
void |
drawInsideRectangle(Graphics2D graphics,
Rectangle bounds)
Useful to render a Label with size 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() |
String[] |
getLabelExpressions()
Returns the expression that defines the text which will be showed in
the label
|
ILabelStyle |
getLabelStyle()
Returns the style of the label
|
String |
getName()
Returns the name of the label
|
int |
getPriority() |
int |
getReferenceSystem()
Returns the Reference System used to draw the elements of the image.
|
Geometry |
getShape(ILabelLocationMetrics llm) |
String |
getSQLQuery() |
String |
getStringLabelExpression()
Returns the expression that defines the text which will be showed in
the label ready to be used for the label parser
|
String[] |
getTexts()
Return the text for the label
|
ITextSymbol |
getTextSymbol()
Returns the text symbol that is being used for the text(the font,
size,style,aligment)
|
int |
getUnit()
Returns the unit used to express measures.
|
boolean |
isUseSqlQuery() |
boolean |
isVisible()
Returns true if the label will be showed in the map
|
boolean |
isVisible(double scale)
Returns true if the label will be showed in the map
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
static void |
registerPersistent() |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setCartographicSize(double cartographicSize,
Geometry geom)
Sets the size of the cartographic element in pixels.
|
void |
setLabelExpressions(String[] lbl_exps)
Sets the expression that defines the text which will be showed in
the label
|
void |
setLabelStyle(ILabelStyle labelStyle)
Stablishes the style for the label.
|
void |
setName(String name)
Stablishes the name of the label
|
void |
setPriority(int priority) |
void |
setReferenceSystem(int referenceSystem)
Sets the Reference System that defines how this units have to be
handled.
|
void |
setSQLQuery(String sqlQuery) |
void |
setTexts(String[] texts)
Sets the text for the label
|
void |
setTextSymbol(ITextSymbol textSymbol)
Stablishes the text symbol that is going to be used for the text(the
font,size,style,aligment)
|
void |
setUnit(int unitIndex)
Defines the unit used to express measures.
|
void |
setUseSqlQuery(boolean use_sql) |
void |
setVisible(boolean isVisible)
Sets the visibility of the label in the map.
|
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).
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoStringpublic static final String SMART_LABEL_CLASS_PERSISTENCE_DEFINITION_NAME
public void draw(Graphics2D graphics, ILabelLocationMetrics llm, Geometry geo)
ILabelClassLabelLocationMetrics, contains the anchor point, rotation, and some other geometric calculations computed by the PlacementManager.
The shp argument is passed as an accessory for subclasses of this class in case they need futher geometric calculations
draw in interface ILabelClasspublic void drawInsideRectangle(Graphics2D graphics, Rectangle bounds) throws SymbolDrawingException
ILabelClassdrawInsideRectangle in interface ILabelClassgraphics - Graphics2Dbounds - RectangleSymbolDrawingExceptionpublic String getClassName()
getClassName in interface ILabelClasspublic ILabelStyle getLabelStyle()
ILabelClassgetLabelStyle in interface ILabelClasspublic ITextSymbol getTextSymbol()
ILabelClassgetTextSymbol in interface ILabelClasspublic void setLabelStyle(ILabelStyle labelStyle)
ILabelClasssetLabelStyle in interface ILabelClasslabelStyle - ILabelStylepublic void setTextSymbol(ITextSymbol textSymbol)
ILabelClasssetTextSymbol in interface ILabelClasstextSymbol - ITextSymbolpublic void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionpublic void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceExceptionpublic static void registerPersistent()
public boolean isVisible()
ILabelClassisVisible in interface ILabelClasspublic boolean isVisible(double scale)
ILabelClassisVisible in interface ILabelClasspublic void setVisible(boolean isVisible)
ILabelClasssetVisible in interface ILabelClassisVisible - booleanpublic String getName()
ILabelClassgetName in interface ILabelClasspublic void setName(String name)
ILabelClasssetName in interface ILabelClasspublic void setTexts(String[] texts)
ILabelClasssetTexts in interface ILabelClasstexts - String[]public String[] getTexts()
ILabelClassgetTexts in interface ILabelClasspublic int getPriority()
getPriority in interface ILabelClasspublic void setPriority(int priority)
setPriority in interface ILabelClasspublic Geometry getShape(ILabelLocationMetrics llm) throws CreateGeometryException
getShape in interface ILabelClassCreateGeometryExceptionpublic double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupportgetCartographicSize in interface ILabelClassgetCartographicSize 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 ILabelClassgetReferenceSystem in interface CartographicSupportpublic int getUnit()
CartographicSupportgetUnit in interface ILabelClassgetUnit in interface CartographicSupportpublic void setCartographicSize(double cartographicSize,
Geometry geom)
CartographicSupportsetCartographicSize in interface ILabelClasssetCartographicSize in interface CartographicSupportpublic void setReferenceSystem(int referenceSystem)
CartographicSupportsetReferenceSystem in interface ILabelClasssetReferenceSystem in interface CartographicSupportpublic void setUnit(int unitIndex)
CartographicSupportsetUnit in interface ILabelClasssetUnit in interface CartographicSupportpublic double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupporttoCartographicSize in interface ILabelClasstoCartographicSize in interface CartographicSupportpublic Rectangle getBounds()
getBounds in interface ILabelClasspublic String getSQLQuery()
getSQLQuery in interface ILabelClasspublic void setSQLQuery(String sqlQuery)
setSQLQuery in interface ILabelClasspublic String[] getLabelExpressions()
ILabelClassgetLabelExpressions in interface ILabelClasspublic void setLabelExpressions(String[] lbl_exps)
ILabelClasssetLabelExpressions in interface ILabelClasspublic void setUseSqlQuery(boolean use_sql)
setUseSqlQuery in interface ILabelClasspublic boolean isUseSqlQuery()
isUseSqlQuery in interface ILabelClasspublic String getStringLabelExpression()
ILabelClassgetStringLabelExpression in interface ILabelClasspublic 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()}.