public class GeneralLabelingStrategy extends Object implements ILabelingStrategy, Cloneable, CartographicSupport
Modifier and Type | Field and Description |
---|---|
static LinePlacementConstraints |
DefaultLinePlacementConstraints |
static PointPlacementConstraints |
DefaultPointPlacementConstraints |
static PolygonPlacementConstraints |
DefaultPolygonPlacementConstraints |
static String |
GENERAL_LABEL_STRATEGY_PERSISTENCE_NAME |
protected FLyrVect |
layer |
PAPER, WORLD
Constructor and Description |
---|
GeneralLabelingStrategy() |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
draw(BufferedImage mapImage,
Graphics2D mapGraphics,
double scale,
ViewPort viewPort,
Cancellable cancel,
double dpi)
Causes the labels to be drawn.
|
double |
getCartographicSize(ViewPort vp,
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).
|
ILabelingMethod |
getLabelingMethod()
Returns the labeling method currently in use.
|
IPlacementConstraints |
getPlacementConstraints()
Returns the current placement constraints that determine the position
where the label is placed.
|
int |
getReferenceSystem()
Returns the Reference System used to draw the elements of the image.
|
int |
getUnit()
Returns the unit used to express measures.
|
String[] |
getUsedFields()
Returns a non-null String[] containing the names of the fields involved in the
labeling.
|
IZoomConstraints |
getZoomConstraints()
Returns the current placement constraints that determine the position
where the label is placed.
|
boolean |
isAllowingOverlap() |
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
print(Graphics2D g,
double scale,
ViewPort viewPort,
Cancellable cancel,
PrintAttributes properties)
Applies the printer properties to the rendering process to match its attributes.
|
static void |
registerPersistent() |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setAllowOverlapping(boolean allowOverlapping) |
void |
setCartographicSize(double cartographicSize,
Geometry geom)
Sets the size of the cartographic element in pixels.
|
void |
setLabelingMethod(ILabelingMethod method)
Sets the labeling method that will be used the next time the the draw is invoked.
|
void |
setLayer(FLayer layer) |
void |
setPlacementConstraints(IPlacementConstraints constraints)
Sets the PlacementConstraints that will determine where to place the labels.
|
void |
setReferenceSystem(int referenceSystem)
Sets the Reference System that defines how this units have to be
handled.
|
void |
setUnit(int unitIndex)
Defines the unit used to express measures.
|
void |
setZoomConstraints(IZoomConstraints constraints)
Sets the PlacementConstraints that will determine where to place the labels.
|
boolean |
shouldDrawLabels(double scale) |
double |
toCartographicSize(ViewPort vp,
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 GENERAL_LABEL_STRATEGY_PERSISTENCE_NAME
public static PointPlacementConstraints DefaultPointPlacementConstraints
public static LinePlacementConstraints DefaultLinePlacementConstraints
public static PolygonPlacementConstraints DefaultPolygonPlacementConstraints
protected FLyrVect layer
public void setLayer(FLayer layer)
setLayer
in interface ILabelingStrategy
public ILabelingMethod getLabelingMethod()
ILabelingStrategy
getLabelingMethod
in interface ILabelingStrategy
ILabelingMethod
public void setLabelingMethod(ILabelingMethod method)
ILabelingStrategy
setLabelingMethod
in interface ILabelingStrategy
public void draw(BufferedImage mapImage, Graphics2D mapGraphics, double scale, ViewPort viewPort, Cancellable cancel, double dpi) throws ReadException
ILabelingStrategy
draw
in interface ILabelingStrategy
dpi
- TODOReadException
public boolean isAllowingOverlap()
public void setAllowOverlapping(boolean allowOverlapping)
public IPlacementConstraints getPlacementConstraints()
ILabelingStrategy
getPlacementConstraints
in interface ILabelingStrategy
public void setPlacementConstraints(IPlacementConstraints constraints)
ILabelingStrategy
setPlacementConstraints
in interface ILabelingStrategy
public IZoomConstraints getZoomConstraints()
ILabelingStrategy
getZoomConstraints
in interface ILabelingStrategy
public void setZoomConstraints(IZoomConstraints constraints)
ILabelingStrategy
setZoomConstraints
in interface ILabelingStrategy
public void print(Graphics2D g, double scale, ViewPort viewPort, Cancellable cancel, PrintAttributes properties) throws ReadException
ILabelingStrategy
print
in interface ILabelingStrategy
ReadException
public String[] getUsedFields()
ILabelingStrategy
getUsedFields
in interface ILabelingStrategy
public boolean shouldDrawLabels(double scale)
shouldDrawLabels
in interface ILabelingStrategy
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 static void registerPersistent()
public 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 double toCartographicSize(ViewPort vp, 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 vp, double dpi, Geometry geom)
CartographicSupport
getCartographicSize
in interface CartographicSupport
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException