svn-gvsig-desktop / tags / J2ME_compat_v1_2_Build_1209 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / ReadableVectorial.java @ 19509
History | View | Annotate | Download (8.07 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.layers; |
42 |
|
43 |
import java.awt.geom.Rectangle2D; |
44 |
|
45 |
import org.cresques.cts.IProjection; |
46 |
|
47 |
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException; |
48 |
import com.hardcode.gdbms.driver.exceptions.OpenDriverException; |
49 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
50 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
51 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
52 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
53 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
54 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
55 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
56 |
import com.iver.cit.gvsig.fmap.spatialindex.ISpatialIndex; |
57 |
|
58 |
|
59 |
/**
|
60 |
* Interfaz usada internamente para acceder a fuentes de datos vectoriales en
|
61 |
* modo lectura
|
62 |
*/
|
63 |
public interface ReadableVectorial { |
64 |
/**
|
65 |
* Indica que se va a comenzar a hacer una serie de operaciones sobre el
|
66 |
* origen de datos con la finalidad de que dicho origen de datos se
|
67 |
* prepare (abra el fichero, comience una transacci?n, conecte al
|
68 |
* servidor, ...). Abre el fichero de ?ndices en caso de que exista.
|
69 |
* @throws ReadDriverException TODO
|
70 |
* @throws OpenDriverException
|
71 |
* @throws InitializeDriverException
|
72 |
*/
|
73 |
void start() throws ReadDriverException, InitializeDriverException; |
74 |
|
75 |
/**
|
76 |
* Hace que se cierre el soporte f?sico de la capa. Cierra el fichero de
|
77 |
* ?ndices en caso de que exista.
|
78 |
* @throws ReadDriverException TODO
|
79 |
*/
|
80 |
void stop() throws ReadDriverException; |
81 |
|
82 |
/**
|
83 |
* Devuelve la geometr?a a partir de un ?ndice.
|
84 |
*
|
85 |
* @param index ?ndice.
|
86 |
*
|
87 |
* @return Geometr?a.
|
88 |
* @throws ReadDriverException TODO
|
89 |
* @throws ExpansionFileReadException
|
90 |
*/
|
91 |
IGeometry getShape(int index) throws ReadDriverException, ExpansionFileReadException; |
92 |
|
93 |
/**
|
94 |
* Devuelve el n?mero de Shape.
|
95 |
*
|
96 |
* @return N?mero de Shape.
|
97 |
* @throws ReadDriverException TODO
|
98 |
*/
|
99 |
int getShapeCount() throws ReadDriverException; |
100 |
|
101 |
/**
|
102 |
* Devuelve la extensi?n total de la capa.
|
103 |
*
|
104 |
* @return Extensi?n total.
|
105 |
* @throws ReadDriverException TODO
|
106 |
* @throws ExpansionFileReadException
|
107 |
*/
|
108 |
Rectangle2D getFullExtent() throws ReadDriverException, ExpansionFileReadException; |
109 |
|
110 |
/**
|
111 |
* Obtiene el tipo de las geometr?as almacenadas en esta fuente de datos
|
112 |
*
|
113 |
* @return Obtiene el tipo de la capa. Es un bit-oring de los tipos
|
114 |
* definidos en FShape POINT, LINE, POLYGON o TEXT;
|
115 |
* @throws ReadDriverException TODO
|
116 |
*/
|
117 |
int getShapeType() throws ReadDriverException; |
118 |
/**
|
119 |
* Obtiene una referencia al objeto que implementa la interfaz vectorial
|
120 |
* con el fin de que las Strategy puedan optimizar en funci?n del driver.
|
121 |
*
|
122 |
* @return VectorialDriver
|
123 |
*/
|
124 |
public VectorialDriver getDriver();
|
125 |
/**
|
126 |
* Establece el driver sobre el que act?a el adaptador
|
127 |
*
|
128 |
* @param driver
|
129 |
*/
|
130 |
public void setDriver(VectorialDriver driver); |
131 |
/*
|
132 |
* (non-Javadoc)
|
133 |
*
|
134 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset()
|
135 |
*/
|
136 |
public SelectableDataSource getRecordset() throws ReadDriverException; |
137 |
public DriverAttributes getDriverAttributes();
|
138 |
|
139 |
/**
|
140 |
* En la implementaci?n por defecto podemos hacer que cada
|
141 |
* feature tenga ID = numero de registro.
|
142 |
* En el DBAdapter podr?amos "overrride" este m?todo y poner
|
143 |
* como ID de la Feature el campo ?nico escogido en
|
144 |
* la base de datos. B?sicamente es por comodidad.
|
145 |
* @param numReg
|
146 |
* @return
|
147 |
* @throws ReadDriverException TODO
|
148 |
* @throws ExpansionFileReadException
|
149 |
*/
|
150 |
public IFeature getFeature(int numReg) throws ReadDriverException, ExpansionFileReadException; |
151 |
|
152 |
/* public IFeatureIterator getFeatureIterator(String strEPSG) throws DriverException;
|
153 |
public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException; */
|
154 |
|
155 |
//void setRecordset(SelectableDataSource sds);
|
156 |
|
157 |
|
158 |
|
159 |
/**
|
160 |
* Returns an iterator over all the features of the vectorial data source.
|
161 |
* It applies a relational algebra "projection" operator (selects the specified fields).
|
162 |
*
|
163 |
* It the param newProjection is not null, it reprojects all the returned features
|
164 |
* to this projection
|
165 |
*
|
166 |
* @param fields fields we are intested in of the data source
|
167 |
* @return feature iterator whose features has as attributes the specified fields
|
168 |
*/
|
169 |
public IFeatureIterator getFeatureIterator(String[] fields, IProjection newProjection) |
170 |
throws ReadDriverException;
|
171 |
|
172 |
/**
|
173 |
* Return a feature iterator from a given sql statement.
|
174 |
* <br>
|
175 |
* In this case, the statement will have the "projection" operator
|
176 |
* (select campo1, campo2, ...etc) and the "selection" operator (where ....)
|
177 |
*
|
178 |
* @param sql statement which define a filter. SQL sintax is very extrict, and must
|
179 |
* be suported by GDBMS
|
180 |
*
|
181 |
* @param newProjection new projection for the returned features (if not null)
|
182 |
* @return feature iterator
|
183 |
* */
|
184 |
public IFeatureIterator getFeatureIterator(String sql, IProjection newProjection) throws ReadDriverException; |
185 |
|
186 |
|
187 |
/**
|
188 |
* Makes an spatial query returning a feature iterator over the features which intersects
|
189 |
* or are contained in the rectangle query. Applies a restriction to the alphanumeric fields
|
190 |
* returned by the iterator, and a reprojection.
|
191 |
* <br>
|
192 |
* Details:
|
193 |
* <ul>
|
194 |
* <li>
|
195 |
* If newProjection is null, rect Rectangle2D is consideered in the same projection that the source data.
|
196 |
* </li>
|
197 |
* <li>
|
198 |
* If newProjection is not null, Rectangle2D is consideered in this projection (newProjection).
|
199 |
* So the source driver must reproject this rectangle before to make the query, and after that
|
200 |
* reproject all the returned features' geometry
|
201 |
* </li>
|
202 |
*
|
203 |
* </ul>
|
204 |
* @param rect
|
205 |
* @param fields
|
206 |
* @return
|
207 |
*/
|
208 |
public IFeatureIterator getFeatureIterator(Rectangle2D rect, String[] fields, |
209 |
IProjection newProjection, boolean fastResult) throws ReadDriverException; |
210 |
|
211 |
|
212 |
public IFeatureIterator getFeatureIterator() throws ReadDriverException; |
213 |
/**
|
214 |
* Return the spatial index of the adapter.
|
215 |
* Responsability of create spatial index instances is of the FLyrVect class, but
|
216 |
* adapters need these index to build spatial query iterators.
|
217 |
* */
|
218 |
public ISpatialIndex getSpatialIndex();
|
219 |
|
220 |
/**
|
221 |
* Sets spatial index of the data source behind the adapter
|
222 |
*
|
223 |
* @param spatialIndex
|
224 |
*/
|
225 |
public void setSpatialIndex(ISpatialIndex spatialIndex); |
226 |
|
227 |
/**
|
228 |
* Sets the projection of the data readed by the associated driver
|
229 |
* @param projection
|
230 |
*/
|
231 |
public void setProjection(IProjection projection); |
232 |
|
233 |
public IProjection getProjection();
|
234 |
} |