Statistics
| Revision:

root / branches / piloto3d / libraries / libFMap / src / com / iver / cit / gvsig / fmap / operations / strategies / Strategy.java @ 9524

History | View | Annotate | Download (7.09 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 com.iver.cit.gvsig.fmap.DriverException;
50
import com.iver.cit.gvsig.fmap.ViewPort;
51
import com.iver.cit.gvsig.fmap.core.IGeometry;
52
import com.iver.cit.gvsig.fmap.layers.FBitSet;
53
import com.iver.utiles.swing.threads.Cancellable;
54
import com.iver.utiles.swing.threads.CancellableMonitorable;
55

    
56

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

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

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

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

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

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

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

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

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

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