Interface ILabelingStrategy
- All Superinterfaces:
org.gvsig.tools.persistence.Persistent
public interface ILabelingStrategy
extends org.gvsig.tools.persistence.Persistent
A LabelingStrategy is a way to define how the labels are painted in a map, or potentially other object implementing ILabelable. It contains methods for allowing the definition of labeling classes through the labeling method (see ILabelingMethod), the placement of such labels (see IPlacementConstraints), and the zoom properties (see ZoomConstraints)
- Author:
- jaume dominguez faus - jaume.dominguez@iver.es
-
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(BufferedImage mapImage, Graphics2D mapGraphics, double scale, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double dpi) Causes the labels to be drawn.Returns the labeling method currently in use.Returns the current placement constraints that determine the position where the label is placed.String[]Returns a non-null String[] containing the names of the fields involved in the labeling.Returns the current placement constraints that determine the position where the label is placed.voidprint(Graphics2D g, double scale, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, org.gvsig.compat.print.PrintAttributes properties) Applies the printer properties to the rendering process to match its attributes.voidsetLabelingMethod(ILabelingMethod method) Sets the labeling method that will be used the next time the the draw is invoked.voidvoidsetPlacementConstraints(IPlacementConstraints constraints) Sets the PlacementConstraints that will determine where to place the labels.voidsetZoomConstraints(IZoomConstraints constraints) Sets the PlacementConstraints that will determine where to place the labels.booleanshouldDrawLabels(double scale) Methods inherited from interface org.gvsig.tools.persistence.Persistent
loadFromState, saveToState
-
Method Details
-
getLabelingMethod
ILabelingMethod getLabelingMethod()Returns the labeling method currently in use. The labeling method handles a list of LabelClass that allows to handle several definition of labels in the layer.- Returns:
- ILabelingMethod, the current one.
- See Also:
-
setLabelingMethod
Sets the labeling method that will be used the next time the the draw is invoked.- Parameters:
method- , the new labeling method
-
getPlacementConstraints
IPlacementConstraints getPlacementConstraints()Returns the current placement constraints that determine the position where the label is placed.- Returns:
-
setPlacementConstraints
Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.- Parameters:
constraints-
-
getZoomConstraints
IZoomConstraints getZoomConstraints()Returns the current placement constraints that determine the position where the label is placed.- Returns:
-
setZoomConstraints
Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.- Parameters:
constraints-
-
draw
void draw(BufferedImage mapImage, Graphics2D mapGraphics, double scale, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double dpi) throws org.gvsig.fmap.dal.exception.ReadException Causes the labels to be drawn. The policy of process is determined by the LabelingStrategy previously set.- Parameters:
mapImage-mapGraphics-viewPort-cancel-dpi- TODO- Throws:
org.gvsig.fmap.dal.exception.ReadException
-
print
void print(Graphics2D g, double scale, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, org.gvsig.compat.print.PrintAttributes properties) throws org.gvsig.fmap.dal.exception.ReadException Applies the printer properties to the rendering process to match its attributes. The result is manifested in the Graphics2D g which is the object sent to the printer.- Parameters:
g-viewPort-cancel-properties-- Throws:
org.gvsig.fmap.dal.exception.ReadException
-
getUsedFields
String[] getUsedFields()Returns a non-null String[] containing the names of the fields involved in the labeling. If this strategy contains more than one LabelClass the result is an array with all the names of the fields used by all the LabelClass, with no duplicates.- Returns:
-
setLayer
-
shouldDrawLabels
boolean shouldDrawLabels(double scale)
-