public class SmartTextSymbolLabelClass extends AbstractCartographicSupport 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.
CartographicSupport.CartographicContext
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SMART_LABEL_CLASS_PERSISTENCE_DEFINITION_NAME |
PAPER, WORLD
Constructor and Description |
---|
SmartTextSymbolLabelClass() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a copy of the object.
|
void |
draw(java.awt.Graphics2D graphics,
ILabelLocationMetrics llm,
Geometry geo)
LabelLocationMetrics, contains the anchor point, rotation, and some
other geometric calculations computed by the PlacementManager.
|
void |
drawInsideRectangle(java.awt.Graphics2D graphics,
java.awt.Rectangle bounds)
Useful to render a Label with size inside little rectangles.
|
java.awt.Rectangle |
getBounds() |
java.lang.String |
getClassName() |
java.lang.String[] |
getLabelExpressions()
Returns the expression that defines the text which will be showed in
the label
|
ILabelStyle |
getLabelStyle()
Returns the style of the label
|
java.lang.String |
getName()
Returns the name of the label
|
int |
getPriority() |
Geometry |
getShape(ILabelLocationMetrics llm) |
java.lang.String |
getSQLQuery() |
java.lang.String |
getStringLabelExpression()
Returns the expression that defines the text which will be showed in
the label ready to be used for the label parser
|
java.lang.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)
|
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 |
setCartographicContext(CartographicSupport.CartographicContext ctx) |
void |
setLabelExpressions(java.lang.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(java.lang.String name)
Stablishes the name of the label
|
void |
setPriority(int priority) |
void |
setSQLQuery(java.lang.String sqlQuery) |
void |
setTexts(java.lang.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 |
setUseSqlQuery(boolean use_sql) |
void |
setVisible(boolean isVisible)
Sets the visibility of the label in the map.
|
copyCartographicContext, getCartographicContext, getReferenceSystem, getUnit, isInPixels, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setReferenceSystem, setUnit, toCartographicUnits
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
cloneQuietly, cloneQuietly
copyCartographicContext, copyCartographicContext, getCartographicContext, getReferenceSystem, getUnit, setCartographicContext, setCartographicContext, setCartographicContext, setCartographicContext, setReferenceSystem, setUnit, toCartographicUnits
public static final java.lang.String SMART_LABEL_CLASS_PERSISTENCE_DEFINITION_NAME
public void draw(java.awt.Graphics2D graphics, ILabelLocationMetrics llm, Geometry geo)
ILabelClass
LabelLocationMetrics, 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 ILabelClass
public void drawInsideRectangle(java.awt.Graphics2D graphics, java.awt.Rectangle bounds) throws SymbolDrawingException
ILabelClass
drawInsideRectangle
in interface ILabelClass
graphics
- Graphics2Dbounds
- RectangleSymbolDrawingException
public java.lang.String getClassName()
getClassName
in interface ILabelClass
public ILabelStyle getLabelStyle()
ILabelClass
getLabelStyle
in interface ILabelClass
public ITextSymbol getTextSymbol()
ILabelClass
getTextSymbol
in interface ILabelClass
public void setLabelStyle(ILabelStyle labelStyle)
ILabelClass
setLabelStyle
in interface ILabelClass
labelStyle
- ILabelStylepublic void setTextSymbol(ITextSymbol textSymbol)
ILabelClass
setTextSymbol
in interface ILabelClass
textSymbol
- ITextSymbolpublic void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
PersistenceException
public void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
PersistenceException
public static void registerPersistent()
public boolean isVisible()
ILabelClass
isVisible
in interface ILabelClass
public boolean isVisible(double scale)
ILabelClass
isVisible
in interface ILabelClass
public void setVisible(boolean isVisible)
ILabelClass
setVisible
in interface ILabelClass
isVisible
- booleanpublic java.lang.String getName()
ILabelClass
getName
in interface ILabelClass
public void setName(java.lang.String name)
ILabelClass
setName
in interface ILabelClass
public void setTexts(java.lang.String[] texts)
ILabelClass
setTexts
in interface ILabelClass
texts
- String[]public java.lang.String[] getTexts()
ILabelClass
getTexts
in interface ILabelClass
public int getPriority()
getPriority
in interface ILabelClass
public void setPriority(int priority)
setPriority
in interface ILabelClass
public Geometry getShape(ILabelLocationMetrics llm) throws CreateGeometryException
getShape
in interface ILabelClass
CreateGeometryException
public void setCartographicContext(CartographicSupport.CartographicContext ctx)
setCartographicContext
in interface CartographicSupport
setCartographicContext
in class AbstractCartographicSupport
public java.awt.Rectangle getBounds()
getBounds
in interface ILabelClass
public java.lang.String getSQLQuery()
getSQLQuery
in interface ILabelClass
public void setSQLQuery(java.lang.String sqlQuery)
setSQLQuery
in interface ILabelClass
public java.lang.String[] getLabelExpressions()
ILabelClass
getLabelExpressions
in interface ILabelClass
public void setLabelExpressions(java.lang.String[] lbl_exps)
ILabelClass
setLabelExpressions
in interface ILabelClass
public void setUseSqlQuery(boolean use_sql)
setUseSqlQuery
in interface ILabelClass
public boolean isUseSqlQuery()
isUseSqlQuery
in interface ILabelClass
public java.lang.String getStringLabelExpression()
ILabelClass
getStringLabelExpression
in interface ILabelClass
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Cloneable
clone
in class java.lang.Object
java.lang.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()}.