svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / rendering / legend / styling / ILabelingStrategy.java @ 40768
History | View | Annotate | Download (4.34 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.fmap.mapcontext.rendering.legend.styling; |
25 |
|
26 |
import java.awt.Graphics2D; |
27 |
import java.awt.image.BufferedImage; |
28 |
|
29 |
import org.gvsig.compat.print.PrintAttributes; |
30 |
import org.gvsig.fmap.dal.exception.ReadException; |
31 |
import org.gvsig.fmap.mapcontext.ViewPort; |
32 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
33 |
import org.gvsig.tools.persistence.Persistent; |
34 |
import org.gvsig.tools.task.Cancellable; |
35 |
|
36 |
|
37 |
|
38 |
/**
|
39 |
* 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 <b>ILabelingMethod</b>), the placement of such labels (see <b>IPlacementConstraints</b>), and the zoom properties (see <b>ZoomConstraints</b>)
|
40 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
41 |
*/
|
42 |
public interface ILabelingStrategy extends Persistent { |
43 |
|
44 |
/**
|
45 |
* Returns the labeling method currently in use. The labeling method handles
|
46 |
* a list of LabelClass that allows to handle several definition of labels
|
47 |
* in the layer.
|
48 |
* @return ILabelingMethod, the current one.
|
49 |
* @see ILabelingMethod
|
50 |
*/
|
51 |
public ILabelingMethod getLabelingMethod();
|
52 |
|
53 |
/**
|
54 |
* Sets the labeling method that will be used the next time the the draw is invoked.
|
55 |
* @param method, the new labeling method
|
56 |
*/
|
57 |
public void setLabelingMethod(ILabelingMethod method); |
58 |
|
59 |
|
60 |
/**
|
61 |
* Returns the current placement constraints that determine the position
|
62 |
* where the label is placed.
|
63 |
* @return
|
64 |
*/
|
65 |
public IPlacementConstraints getPlacementConstraints();
|
66 |
|
67 |
/**
|
68 |
* Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
|
69 |
* @param constraints
|
70 |
*/
|
71 |
public void setPlacementConstraints(IPlacementConstraints constraints); |
72 |
|
73 |
/**
|
74 |
* Returns the current placement constraints that determine the position
|
75 |
* where the label is placed.
|
76 |
* @return
|
77 |
*/
|
78 |
public IZoomConstraints getZoomConstraints();
|
79 |
|
80 |
/**
|
81 |
* Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
|
82 |
* @param constraints
|
83 |
*/
|
84 |
public void setZoomConstraints(IZoomConstraints constraints); |
85 |
|
86 |
/** Causes the labels to be drawn. The policy of process is determined by
|
87 |
* the LabelingStrategy previously set.
|
88 |
*
|
89 |
* @param mapImage
|
90 |
* @param mapGraphics
|
91 |
* @param viewPort
|
92 |
* @param cancel
|
93 |
* @param dpi TODO
|
94 |
* @throws ReadException
|
95 |
*/
|
96 |
public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort, |
97 |
Cancellable cancel, double dpi) throws ReadException; |
98 |
|
99 |
/**
|
100 |
* Applies the printer properties to the rendering process to match its attributes.
|
101 |
* The result is manifested in the Graphics2D g which is the object sent to the printer.
|
102 |
* @param g
|
103 |
* @param viewPort
|
104 |
* @param cancel
|
105 |
* @param properties
|
106 |
* @throws ReadException
|
107 |
*/
|
108 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintAttributes properties) |
109 |
throws ReadException;
|
110 |
|
111 |
/**
|
112 |
* Returns a non-null String[] containing the names of the fields involved in the
|
113 |
* labeling. If this strategy contains more than one LabelClass the result is an
|
114 |
* array with all the names of the fields used by all the LabelClass, with no duplicates.
|
115 |
* @return
|
116 |
*/
|
117 |
public String[] getUsedFields(); |
118 |
|
119 |
public void setLayer(FLayer layer) ; |
120 |
|
121 |
public boolean shouldDrawLabels(double scale); |
122 |
|
123 |
} |