public class SimpleLineStyle extends AbstractStyle implements CartographicSupport, ISimpleLineStyle
http://www.oreilly.com/catalog/java2d/chapter/ch04.html
Modifier and Type | Class and Description |
---|---|
static class |
SimpleLineStyle.RegisterPersistence |
Modifier and Type | Field and Description |
---|---|
static String |
SIMPLE_LINE_STYLE_PERSISTENCE_DEFINITION_NAME |
STYLE_PERSISTENCE_DEFINITION_NAME
PAPER, WORLD
Constructor and Description |
---|
SimpleLineStyle()
Constructor method
|
SimpleLineStyle(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
Constructor method
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates a copy of the object.
|
void |
drawInsideRectangle(Graphics2D g,
Rectangle r)
Useful to render the symbol inside the TOC, or inside little
rectangles.
|
void |
drawOutline(Graphics2D g,
Rectangle r)
Used to show an outline of the style to graphically show its properties.
|
IArrowDecoratorStyle |
getArrowDecorator()
Gets the arrow decorator style that has the line
|
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() |
float |
getLineWidth()
Returns the width of the line
|
double |
getOffset()
Returns the offset of the line
|
int |
getReferenceSystem()
Returns the Reference System used to draw the elements of the image.
|
Stroke |
getStroke()
Returns the stroke of the line
|
int |
getUnit()
Returns the unit used to express measures.
|
boolean |
isSuitableFor(ISymbol symbol)
True if this symbol is ok for the style or class.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setArrowDecorator(IArrowDecoratorStyle arrowDecoratorStyle)
Sets the arrow decorator style of the line
|
void |
setCartographicSize(double cartographicSize,
Geometry geom)
Sets the size of the cartographic element in pixels.
|
void |
setLineWidth(float width)
Establishes the width of the line
|
void |
setOffset(double offset)
Establishes the offset of the line
|
void |
setReferenceSystem(int referenceSystem)
Sets the Reference System that defines how this units have to be
handled.
|
void |
setStroke(Stroke stroke)
Sets the stroke of the line
|
void |
setUnit(int unitIndex)
Defines the unit used to express measures.
|
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).
|
getDescription, setDescription
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription, setDescription
public static final String SIMPLE_LINE_STYLE_PERSISTENCE_DEFINITION_NAME
public SimpleLineStyle()
public SimpleLineStyle(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase)
width
- cap
- join
- miterlimit
- dash
- dash_phase
- public void drawInsideRectangle(Graphics2D g, Rectangle r)
IStyle
drawInsideRectangle
in interface IStyle
g
- Graphics2Dr
- Rectanglepublic String getClassName()
public Stroke getStroke()
ILineStyle
getStroke
in interface ILineStyle
public float getLineWidth()
ILineStyle
getLineWidth
in interface ILineStyle
public void setLineWidth(float width)
ILineStyle
setLineWidth
in interface ILineStyle
width
- of the linepublic boolean isSuitableFor(ISymbol symbol)
IStyle
isSuitableFor
in interface IStyle
symbol
- ISymbolpublic void setStroke(Stroke stroke)
ILineStyle
setStroke
in interface ILineStyle
public void drawOutline(Graphics2D g, Rectangle r)
IStyle
drawOutline
in interface IStyle
public double getOffset()
ILineStyle
getOffset
in interface ILineStyle
public void setOffset(double offset)
ILineStyle
setOffset
in interface ILineStyle
public IArrowDecoratorStyle getArrowDecorator()
ILineStyle
getArrowDecorator
in interface ILineStyle
public void setArrowDecorator(IArrowDecoratorStyle arrowDecoratorStyle)
ILineStyle
setArrowDecorator
in interface ILineStyle
public void setUnit(int unitIndex)
CartographicSupport
setUnit
in interface CartographicSupport
public int getUnit()
CartographicSupport
getUnit
in interface CartographicSupport
public 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 CartographicSupport
public void setReferenceSystem(int referenceSystem)
CartographicSupport
setReferenceSystem
in interface CartographicSupport
public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupport
toCartographicSize
in interface CartographicSupport
public void setCartographicSize(double cartographicSize, Geometry geom)
CartographicSupport
setCartographicSize
in interface CartographicSupport
public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom)
CartographicSupport
getCartographicSize
in interface CartographicSupport
public Object clone() throws CloneNotSupportedException
Cloneable
clone
in class AbstractStyle
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 AbstractStyle
PersistenceException
public void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
saveToState
in class AbstractStyle
PersistenceException