Statistics
| Revision:

root / branches / v2_0_0_prep / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / rendering / legend / styling / ILabelingStrategy.java @ 21200

History | View | Annotate | Download (5.54 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
/* CVS MESSAGES:
43
*
44
* $Id: ILabelingStrategy.java 13913 2007-09-20 09:36:02Z jaume $
45
* $Log$
46
* Revision 1.7  2007-09-20 09:33:15  jaume
47
* Refactored: fixed name of IPersistAnce to IPersistence
48
*
49
* Revision 1.6  2007/09/19 16:25:39  jaume
50
* ReadExpansionFileException removed from this context and removed unnecessary imports
51
*
52
* Revision 1.5  2007/05/17 09:32:06  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.4  2007/03/26 14:40:07  jaume
56
* added print method
57
*
58
* Revision 1.3  2007/03/09 11:20:57  jaume
59
* Advanced symbology (start committing)
60
*
61
* Revision 1.2  2007/03/09 08:33:43  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.1.2.4  2007/02/15 16:23:44  jaume
65
* *** empty log message ***
66
*
67
* Revision 1.1.2.3  2007/02/09 07:47:05  jaume
68
* Isymbol moved
69
*
70
* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
71
* *** empty log message ***
72
*
73
* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
74
* start commiting labeling stuff
75
*
76
*
77
*/
78
package org.gvsig.fmap.mapcontext.rendering.legend.styling;
79

    
80
import java.awt.Graphics2D;
81
import java.awt.image.BufferedImage;
82

    
83
import javax.print.attribute.PrintRequestAttributeSet;
84

    
85
import org.gvsig.data.ReadException;
86
import org.gvsig.fmap.mapcontext.ViewPort;
87
import org.gvsig.fmap.mapcontext.layers.FLayer;
88

    
89
import com.iver.utiles.IPersistence;
90
import com.iver.utiles.swing.threads.Cancellable;
91

    
92
/**
93
 * 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>)
94
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
95
 */
96
public interface ILabelingStrategy extends IPersistence {
97

    
98
        /**
99
         * Returns the labeling method currently in use. The labeling method handles
100
         * a list of LabelClass that allows to handle several definition of labels
101
         * in the layer.
102
         * @return ILabelingMethod, the current one.
103
         * @see ILabelingMethod
104
         */
105
        public ILabelingMethod getLabelingMethod();
106

    
107
        /**
108
         * Sets the labeling method that will be used the next time the the draw is invoked.
109
         * @param   method, the new labeling method
110
         */
111
        public void setLabelingMethod(ILabelingMethod method);
112

    
113

    
114
        /**
115
         * Returns the current placement constraints that determine the position
116
         * where the label is placed.
117
         * @return
118
         */
119
        public IPlacementConstraints getPlacementConstraints();
120

    
121
        /**
122
         * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
123
         * @param  constraints
124
         */
125
        public void setPlacementConstraints(IPlacementConstraints constraints);
126

    
127
        /**
128
         * Returns the current placement constraints that determine the position
129
         * where the label is placed.
130
         * @return
131
         */
132
        public IZoomConstraints getZoomConstraints();
133

    
134
        /**
135
         * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
136
         * @param  constraints
137
         */
138
        public void setZoomConstraints(IZoomConstraints constraints);
139

    
140
        /** Causes the labels to be drawn. The policy of process is determined by
141
         * the LabelingStrategy previously set.
142
         *
143
         * @param mapImage
144
         * @param mapGraphics
145
         * @param viewPort
146
         * @param cancel
147
         * @param dpi TODO
148
         * @param dpi
149
         * @throws DriverException
150
         */
151
        public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort,
152
                        Cancellable cancel, double dpi) throws ReadException;
153

    
154
        /**
155
         * Applies the printer properties to the rendering process to match its attributes.
156
         * The result is manifested in the Graphics2D g which is the object sent to the printer.
157
         * @param g
158
         * @param viewPort
159
         * @param cancel
160
         * @param properties
161
         * @throws ReadDriverException
162
         */
163
        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintRequestAttributeSet properties)
164
        throws ReadException;
165

    
166
        /**
167
         * Returns a non-null String[] containing the names of the fields involved in the
168
         * labeling. If this strategy contains more than one LabelClass the result is an
169
         * array with all the names of the fields used by all the LabelClass, with no duplicates.
170
         * @return
171
         */
172
        public String[] getUsedFields();
173

    
174
        public void setLayer(FLayer layer) throws ReadException;
175

    
176
        public boolean shouldDrawLabels(double scale);
177

    
178
}