Statistics
| Revision:

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 @ 40559

History | View | Annotate | Download (5.24 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
/* CVS MESSAGES:
25
*
26
* $Id: ILabelingStrategy.java 13913 2007-09-20 09:36:02Z jaume $
27
* $Log$
28
* Revision 1.7  2007-09-20 09:33:15  jaume
29
* Refactored: fixed name of IPersistAnce to IPersistence
30
*
31
* Revision 1.6  2007/09/19 16:25:39  jaume
32
* ReadExpansionFileException removed from this context and removed unnecessary imports
33
*
34
* Revision 1.5  2007/05/17 09:32:06  jaume
35
* *** empty log message ***
36
*
37
* Revision 1.4  2007/03/26 14:40:07  jaume
38
* added print method
39
*
40
* Revision 1.3  2007/03/09 11:20:57  jaume
41
* Advanced symbology (start committing)
42
*
43
* Revision 1.2  2007/03/09 08:33:43  jaume
44
* *** empty log message ***
45
*
46
* Revision 1.1.2.4  2007/02/15 16:23:44  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1.2.3  2007/02/09 07:47:05  jaume
50
* Isymbol moved
51
*
52
* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
56
* start commiting labeling stuff
57
*
58
*
59
*/
60
package org.gvsig.fmap.mapcontext.rendering.legend.styling;
61

    
62
import java.awt.Graphics2D;
63
import java.awt.image.BufferedImage;
64

    
65
import org.gvsig.compat.print.PrintAttributes;
66
import org.gvsig.fmap.dal.exception.ReadException;
67
import org.gvsig.fmap.mapcontext.ViewPort;
68
import org.gvsig.fmap.mapcontext.layers.FLayer;
69
import org.gvsig.tools.persistence.Persistent;
70
import org.gvsig.tools.task.Cancellable;
71

    
72

    
73

    
74
/**
75
 * 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>)
76
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
77
 */
78
public interface ILabelingStrategy extends Persistent {
79

    
80
        /**
81
         * Returns the labeling method currently in use. The labeling method handles
82
         * a list of LabelClass that allows to handle several definition of labels
83
         * in the layer.
84
         * @return ILabelingMethod, the current one.
85
         * @see ILabelingMethod
86
         */
87
        public ILabelingMethod getLabelingMethod();
88

    
89
        /**
90
         * Sets the labeling method that will be used the next time the the draw is invoked.
91
         * @param   method, the new labeling method
92
         */
93
        public void setLabelingMethod(ILabelingMethod method);
94

    
95

    
96
        /**
97
         * Returns the current placement constraints that determine the position
98
         * where the label is placed.
99
         * @return
100
         */
101
        public IPlacementConstraints getPlacementConstraints();
102

    
103
        /**
104
         * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
105
         * @param  constraints
106
         */
107
        public void setPlacementConstraints(IPlacementConstraints constraints);
108

    
109
        /**
110
         * Returns the current placement constraints that determine the position
111
         * where the label is placed.
112
         * @return
113
         */
114
        public IZoomConstraints getZoomConstraints();
115

    
116
        /**
117
         * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
118
         * @param  constraints
119
         */
120
        public void setZoomConstraints(IZoomConstraints constraints);
121

    
122
        /** Causes the labels to be drawn. The policy of process is determined by
123
         * the LabelingStrategy previously set.
124
         *
125
         * @param mapImage
126
         * @param mapGraphics
127
         * @param viewPort
128
         * @param cancel
129
         * @param dpi TODO
130
         * @throws ReadException
131
         */
132
        public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort,
133
                        Cancellable cancel, double dpi) throws ReadException;
134

    
135
        /**
136
         * Applies the printer properties to the rendering process to match its attributes.
137
         * The result is manifested in the Graphics2D g which is the object sent to the printer.
138
         * @param g
139
         * @param viewPort
140
         * @param cancel
141
         * @param properties
142
         * @throws ReadException
143
         */
144
        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintAttributes properties)
145
        throws ReadException;
146

    
147
        /**
148
         * Returns a non-null String[] containing the names of the fields involved in the
149
         * labeling. If this strategy contains more than one LabelClass the result is an
150
         * array with all the names of the fields used by all the LabelClass, with no duplicates.
151
         * @return
152
         */
153
        public String[] getUsedFields();
154

    
155
        public void setLayer(FLayer layer) ;
156

    
157
        public boolean shouldDrawLabels(double scale);
158

    
159
}