Revision 11287 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java
VectorialEditableAdapter.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.69 2007-03-06 17:08:55 caballero |
|
48 |
* Revision 1.70 2007-04-19 17:28:24 azabala |
|
49 |
* changes in ReadableVectorial interface (new iteration modes) |
|
50 |
* |
|
51 |
* Revision 1.69 2007/03/06 17:08:55 caballero |
|
49 | 52 |
* Exceptions |
50 | 53 |
* |
51 | 54 |
* Revision 1.68 2007/02/19 12:36:22 caballero |
... | ... | |
253 | 256 |
import java.io.IOException; |
254 | 257 |
import java.util.List; |
255 | 258 |
|
259 |
import org.cresques.cts.IProjection; |
|
260 |
|
|
256 | 261 |
import com.hardcode.driverManager.Driver; |
257 | 262 |
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException; |
258 |
import com.hardcode.gdbms.driver.exceptions.OpenDriverException; |
|
259 | 263 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
260 | 264 |
import com.hardcode.gdbms.driver.exceptions.ReloadDriverException; |
261 | 265 |
import com.hardcode.gdbms.engine.data.DataSource; |
... | ... | |
266 | 270 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileWriteException; |
267 | 271 |
import com.iver.cit.gvsig.exceptions.expansionfile.OpenExpansionFileException; |
268 | 272 |
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException; |
269 |
import com.iver.cit.gvsig.exceptions.layers.StopEditionLayerException; |
|
270 | 273 |
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException; |
271 | 274 |
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException; |
272 | 275 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
... | ... | |
274 | 277 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
275 | 278 |
import com.iver.cit.gvsig.fmap.core.IRow; |
276 | 279 |
import com.iver.cit.gvsig.fmap.core.v02.FConverter; |
280 |
import com.iver.cit.gvsig.fmap.drivers.AttrQueryFeatureIterator; |
|
277 | 281 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
282 |
import com.iver.cit.gvsig.fmap.drivers.DefaultFeatureIterator; |
|
278 | 283 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
279 | 284 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
285 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
|
286 |
import com.iver.cit.gvsig.fmap.drivers.IndexedSptQueryFeatureIterator; |
|
287 |
import com.iver.cit.gvsig.fmap.drivers.SpatialQueryFeatureIterator; |
|
280 | 288 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
281 | 289 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
282 | 290 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
291 |
import com.iver.cit.gvsig.fmap.spatialindex.ISpatialIndex; |
|
292 |
import com.iver.cit.gvsig.fmap.spatialindex.QuadtreeJts; |
|
283 | 293 |
import com.vividsolutions.jts.geom.Envelope; |
284 | 294 |
import com.vividsolutions.jts.index.SpatialIndex; |
285 | 295 |
import com.vividsolutions.jts.index.quadtree.Quadtree; |
... | ... | |
299 | 309 |
protected Image selectionImage; |
300 | 310 |
|
301 | 311 |
protected BufferedImage handlersImage; |
312 |
|
|
313 |
|
|
314 |
/* |
|
315 |
* azo; ReadableVectorial implementations need a reference to |
|
316 |
* IProjection (of the layer) and to ISpatialIndex (of the layer) |
|
317 |
* to allow iteration with different criteria |
|
318 |
* */ |
|
319 |
protected IProjection projection; |
|
320 |
protected ISpatialIndex fmapSpatialIndex; |
|
321 |
|
|
302 | 322 |
|
303 | 323 |
//private double flatness=0.8; |
304 | 324 |
/* |
... | ... | |
319 | 339 |
* } |
320 | 340 |
*/ |
321 | 341 |
|
342 |
|
|
343 |
|
|
322 | 344 |
public VectorialEditableAdapter() { |
323 | 345 |
super(); |
324 | 346 |
} |
... | ... | |
958 | 980 |
|
959 | 981 |
public void setSpatialIndex(SpatialIndex spatialIndex) { |
960 | 982 |
index = (Quadtree) spatialIndex; |
983 |
QuadtreeJts fmapidx = new QuadtreeJts(index); |
|
984 |
setSpatialIndex(fmapidx); |
|
985 |
|
|
961 | 986 |
} |
962 | 987 |
|
963 | 988 |
public void setFullExtent(Rectangle2D fullExtent2) { |
... | ... | |
991 | 1016 |
this.handlersImage = handlersImage; |
992 | 1017 |
} |
993 | 1018 |
|
1019 |
public IFeatureIterator getFeatureIterator() throws ReadDriverException { |
|
1020 |
return new DefaultFeatureIterator(this, projection, null, null); |
|
1021 |
} |
|
1022 |
|
|
1023 |
|
|
1024 |
public IFeatureIterator getFeatureIterator(String[] fields, IProjection newProjection) |
|
1025 |
throws ReadDriverException{ |
|
1026 |
return new DefaultFeatureIterator(this, projection, newProjection, fields); |
|
1027 |
} |
|
1028 |
|
|
1029 |
/** |
|
1030 |
* Return a feature iterator from a given sql statement. |
|
1031 |
* <br> |
|
1032 |
* In this case, the statement will have the "projection" operator |
|
1033 |
* (select campo1, campo2, ...etc) and the "selection" operator (where ....) |
|
1034 |
* @param sql statement which define a filter |
|
1035 |
* @return feature iterator |
|
1036 |
* */ |
|
1037 |
public IFeatureIterator getFeatureIterator(String sql, |
|
1038 |
IProjection newProjection) throws ReadDriverException{ |
|
1039 |
|
|
1040 |
return new AttrQueryFeatureIterator(this, projection, newProjection, sql); |
|
1041 |
} |
|
1042 |
|
|
1043 |
|
|
1044 |
/** |
|
1045 |
* Makes an spatial query returning a feature iterator over the features which intersects |
|
1046 |
* or are contained in the rectangle query. Applies a restriction to the alphanumeric fields |
|
1047 |
* returned by the iterator. |
|
1048 |
* @param rect |
|
1049 |
* @param fields |
|
1050 |
* @return |
|
1051 |
* @throws ReadDriverException |
|
1052 |
*/ |
|
1053 |
public IFeatureIterator getFeatureIterator(Rectangle2D rect, String[] fields, IProjection newProjection) throws ReadDriverException{ |
|
1054 |
if(fmapSpatialIndex == null){ |
|
1055 |
return new SpatialQueryFeatureIterator(this, projection, newProjection, fields, rect); |
|
1056 |
}else{ |
|
1057 |
return new IndexedSptQueryFeatureIterator(this, projection, newProjection, fields, rect, fmapSpatialIndex); |
|
1058 |
} |
|
1059 |
} |
|
1060 |
|
|
1061 |
public ISpatialIndex getSpatialIndex() { |
|
1062 |
return fmapSpatialIndex; |
|
1063 |
} |
|
1064 |
|
|
1065 |
public void setSpatialIndex(ISpatialIndex spatialIndex) { |
|
1066 |
this.fmapSpatialIndex = spatialIndex; |
|
1067 |
} |
|
1068 |
|
|
1069 |
public void setProjection(IProjection projection) { |
|
1070 |
this.projection = projection; |
|
1071 |
} |
|
1072 |
|
|
1073 |
public IProjection getProjection() { |
|
1074 |
return projection; |
|
1075 |
} |
|
1076 |
|
|
1077 |
|
|
1078 |
|
|
994 | 1079 |
// public double getFlatness() { |
995 | 1080 |
// return flatness; |
996 | 1081 |
// } |
Also available in: Unified diff