Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1000 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / operations / strategies / Strategy.java @ 11885

History | View | Annotate | Download (7.19 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
package com.iver.cit.gvsig.fmap.operations.strategies;
42

    
43
import java.awt.Graphics2D;
44
import java.awt.geom.Point2D;
45
import java.awt.geom.Rectangle2D;
46
import java.awt.image.BufferedImage;
47
import java.util.BitSet;
48

    
49
import javax.print.attribute.PrintRequestAttributeSet;
50

    
51
import com.iver.cit.gvsig.fmap.DriverException;
52
import com.iver.cit.gvsig.fmap.ViewPort;
53
import com.iver.cit.gvsig.fmap.core.IGeometry;
54
import com.iver.cit.gvsig.fmap.layers.FBitSet;
55
import com.iver.utiles.swing.threads.Cancellable;
56
import com.iver.utiles.swing.threads.CancellableMonitorable;
57

    
58

    
59
/**
60
 * Interfaz estrategia.
61
 */
62
public interface Strategy {
63
        /**
64
         * Dibuja la capa vectorial asociada al Strategy en la imagen que se pasa
65
         * como par?metro.
66
         *
67
         * @param image
68
         * @param g
69
         * @param viewPort
70
         * @param cancel
71
         *
72
         * @throws DriverException
73
         */
74
        void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
75
                Cancellable cancel) throws DriverException;
76

    
77
        /**
78
         * Dibujar? esta Shape en el Graphics con el s?mbolo que se pasa como
79
         * par?metro y despues de aplicarle la transformaci?n que se pasa tambi?n
80
         * como par?metro. Dibujar? la geometria en caso de que la IGeometry
81
         * intersecte o est? contenida en el rect?ngulo que se pasa como par?metro
82
         *
83
         * @param g
84
         * @param viewPort
85
         * @param cancel
86
         *
87
         * @throws DriverException
88
         */
89
        void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintRequestAttributeSet properties)
90
                throws DriverException;
91

    
92

    
93
        /**
94
         * Similar to next one, but allows cancelations.
95
         * @param visitor
96
         * @param subset
97
         * @param cancel
98
         * @throws DriverException
99
         * @throws VisitException
100
         */
101
        void process(FeatureVisitor visitor, BitSet subset, CancellableMonitorable cancel)
102
        throws DriverException, VisitException;
103
        /**
104
         * Recorre las features de la capa vectorial invocando el m?todo visit del
105
         * visitador que se pasa como par?metro, que es el que realizar? la
106
         * operaci?n relacionada con la geometry
107
         *
108
         * @param visitor
109
         * @param subset
110
         *
111
         * @throws DriverException
112
         * @throws VisitException Si el visitor lanza una excepci?n al procesar una
113
         *                    geometr?a de la capa
114
         */
115
        void process(FeatureVisitor visitor, BitSet subset)
116
                throws DriverException, VisitException;
117

    
118
        /**
119
         * Similar to process(FeatureVisitor) but allows cancelations.
120
         * @param visitor
121
         * @param cancel
122
         * @throws DriverException
123
         * @throws VisitException
124
         */
125
        void process(FeatureVisitor visitor, CancellableMonitorable cancel) throws DriverException, VisitException;
126
        /**
127
         * Recorre las features de la capa vectorial invocando el m?todo visit del
128
         * visitador que se pasa como par?metro, que es el que realizar? la
129
         * operaci?n relacionada con la geometry
130
         *
131
         * @param visitor
132
         *
133
         * @throws DriverException
134
         * @throws VisitException Si el visitor lanza una excepci?n al procesar una
135
         *                    geometr?a de la capa
136
         */
137
        void process(FeatureVisitor visitor) throws DriverException, VisitException;
138

    
139
        
140
        /**
141
         * Similar to process(FeatureVisitor, Rectangle2D) allowing cancelations.
142
         * @param visitor
143
         * @param rectangle
144
         * @param cancel
145
         * @throws DriverException
146
         * @throws VisitException
147
         */
148
        void process(FeatureVisitor visitor, 
149
                        Rectangle2D rectangle, CancellableMonitorable cancel) throws DriverException, VisitException;
150
        /**
151
         * Iterates features of a vectorial layer whose geometry would be within
152
         * Rectangle2D specified, and it calls visit method of visitor.
153
         * @param visitor
154
         * @param rectangle
155
         * @throws DriverException
156
         * @throws VisitException
157
         */
158
        void process(FeatureVisitor visitor, 
159
                        Rectangle2D rectangle) throws DriverException, VisitException;
160
        
161
        /**
162
         * Similar to process, but calls visitWithSymbol in FeatureVisitor.
163
         * @param visitor
164
         * @param rectangle
165
         * @param cancel
166
         * @throws DriverException
167
         * @throws VisitException
168
         */
169
        void processWithSymbols(ExtendsFeatureVisitor visitor, 
170
                        Rectangle2D rectangle, CancellableMonitorable cancel) throws DriverException, VisitException;
171

    
172
        /**
173
         * Realiza una query por punto en coordenadas del mundo real de la capa
174
         * vectorial asociada a la estrategia
175
         *
176
         * @param p
177
         * @param tolerance
178
         *
179
         * @return BitSet con los ?ndices de los registros de la repuesta a la
180
         *                    consulta.
181
         *
182
         * @throws DriverException
183
         */
184
        FBitSet queryByPoint(Point2D p, double tolerance) throws DriverException;
185
        
186
        /**
187
         * Similar to previous method, but allowing cancelations.
188
         * @param p
189
         * @param tolerance
190
         * @param cancel
191
         * @return
192
         * @throws DriverException
193
         */
194
        FBitSet queryByPoint(Point2D p, double tolerance, CancellableMonitorable cancel) throws DriverException;
195

    
196
        /**
197
         * Realiza una query por rect?ngulo en coordenadas del mundo real de la
198
         * capa vectorial asociada a la estrategia
199
         *
200
         * @param rect Rect?ngulo sobre el que hacer la consulta.
201
         *
202
         * @return BitSet con los ?ndices de los registros.
203
         *
204
         * @throws DriverException
205
         */
206
        FBitSet queryByRect(Rectangle2D rect) throws DriverException;
207
        
208
        /**
209
         * Allowing cancelations.
210
         * @param rect
211
         * @param cancel
212
         * @return
213
         * @throws DriverException
214
         */
215
        FBitSet queryByRect(Rectangle2D rect, CancellableMonitorable cancel) 
216
                throws DriverException;
217

    
218
        /**
219
         * Realiza una query por IGeometry en coordenadas del mundo real de la capa
220
         * vectorial asociada a la estrategia
221
         *
222
         * @param g
223
         * @param relationship
224
         *
225
         * @return BitSet con los ?ndices de los registros.
226
         *
227
         * @throws DriverException
228
         * @throws VisitException
229
         */
230
        FBitSet queryByShape(IGeometry g, int relationship)
231
                throws DriverException, VisitException;
232
        
233
        /**
234
         * Allowing cancelations
235
         * @param g
236
         * @param relationship
237
         * @param cancel
238
         * @return
239
         * @throws DriverException
240
         * @throws VisitException
241
         */
242
        FBitSet queryByShape(IGeometry g, int relationship, CancellableMonitorable cancel)
243
        throws DriverException, VisitException;
244

    
245
        /**
246
         * Obtiene el rect?ngulo m?nimo que contiene todas las features
247
         * seleccionadas o null si no hay ninguna seleccionada
248
         *
249
         * @return Devuelve el extent de la consulta.
250
         */
251
        Rectangle2D getSelectionBounds();
252

    
253
        /**
254
         * Crea un ?ndice sobre la capa vectorial de la estrategia
255
         */
256
        void createIndex();
257
        
258
}