Statistics
| Revision:

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

History | View | Annotate | Download (6.85 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
        
163
        /**
164
         * Realiza una query por punto en coordenadas del mundo real de la capa
165
         * vectorial asociada a la estrategia
166
         *
167
         * @param p
168
         * @param tolerance
169
         *
170
         * @return BitSet con los ?ndices de los registros de la repuesta a la
171
         *                    consulta.
172
         *
173
         * @throws DriverException
174
         */
175
        FBitSet queryByPoint(Point2D p, double tolerance) throws DriverException;
176
        
177
        /**
178
         * Similar to previous method, but allowing cancelations.
179
         * @param p
180
         * @param tolerance
181
         * @param cancel
182
         * @return
183
         * @throws DriverException
184
         */
185
        FBitSet queryByPoint(Point2D p, double tolerance, CancellableMonitorable cancel) throws DriverException;
186

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

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

    
236
        /**
237
         * Obtiene el rect?ngulo m?nimo que contiene todas las features
238
         * seleccionadas o null si no hay ninguna seleccionada
239
         *
240
         * @return Devuelve el extent de la consulta.
241
         */
242
        Rectangle2D getSelectionBounds();
243

    
244
        /**
245
         * Crea un ?ndice sobre la capa vectorial de la estrategia
246
         */
247
        void createIndex();
248
        
249
        
250
}