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 ILabelingStrategypublic ILabelingMethod getLabelingMethod()
ILabelingStrategygetLabelingMethod in interface ILabelingStrategyILabelingMethodpublic void setLabelingMethod(ILabelingMethod method)
ILabelingStrategysetLabelingMethod in interface ILabelingStrategypublic void draw(BufferedImage mapImage, Graphics2D mapGraphics, double scale, ViewPort viewPort, Cancellable cancel, double dpi) throws ReadException
ILabelingStrategydraw in interface ILabelingStrategydpi - TODOReadExceptionpublic boolean isAllowingOverlap()
public void setAllowOverlapping(boolean allowOverlapping)
public IPlacementConstraints getPlacementConstraints()
ILabelingStrategygetPlacementConstraints in interface ILabelingStrategypublic void setPlacementConstraints(IPlacementConstraints constraints)
ILabelingStrategysetPlacementConstraints in interface ILabelingStrategypublic IZoomConstraints getZoomConstraints()
ILabelingStrategygetZoomConstraints in interface ILabelingStrategypublic void setZoomConstraints(IZoomConstraints constraints)
ILabelingStrategysetZoomConstraints in interface ILabelingStrategypublic void print(Graphics2D g, double scale, ViewPort viewPort, Cancellable cancel, PrintAttributes properties) throws ReadException
ILabelingStrategyprint in interface ILabelingStrategyReadExceptionpublic String[] getUsedFields()
ILabelingStrategygetUsedFields in interface ILabelingStrategypublic boolean shouldDrawLabels(double scale)
shouldDrawLabels in interface ILabelingStrategypublic 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 referenceSystem)
CartographicSupportsetReferenceSystem in interface CartographicSupportpublic static void registerPersistent()
public void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionpublic void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceExceptionpublic double toCartographicSize(ViewPort vp, double dpi, Geometry geom)
CartographicSupporttoCartographicSize in interface CartographicSupportpublic void setCartographicSize(double cartographicSize,
Geometry geom)
CartographicSupportsetCartographicSize in interface CartographicSupportpublic double getCartographicSize(ViewPort vp, double dpi, Geometry geom)
CartographicSupportgetCartographicSize in interface CartographicSupportpublic Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException