Revision 20920 trunk/libraries/libFMap_dataDB/src/org/gvsig/data/datastores/vectorial/db/jdbc/h2/H2FeaturesWriter.java
H2FeaturesWriter.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.db.jdbc.h2; |
2 | 2 |
|
3 |
import java.sql.Connection; |
|
4 | 3 |
import java.sql.DatabaseMetaData; |
5 | 4 |
import java.sql.PreparedStatement; |
6 | 5 |
import java.sql.ResultSet; |
... | ... | |
9 | 8 |
import java.util.Iterator; |
10 | 9 |
|
11 | 10 |
import org.gvsig.data.IDataStoreParameters; |
12 |
import org.gvsig.data.datastores.vectorial.ISelectiveWriter; |
|
13 | 11 |
import org.gvsig.data.datastores.vectorial.db.DBAttributeDescriptor; |
14 | 12 |
import org.gvsig.data.datastores.vectorial.db.DBFeatureType; |
15 | 13 |
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCFeature; |
16 | 14 |
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCFeaturesWriter; |
17 | 15 |
import org.gvsig.data.datastores.vectorial.db.jdbc.JDBCTypes; |
18 |
import org.gvsig.data.exception.InitializeException; |
|
19 | 16 |
import org.gvsig.data.exception.InitializeWriterException; |
20 | 17 |
import org.gvsig.data.exception.ReadException; |
21 | 18 |
import org.gvsig.data.exception.WriteException; |
... | ... | |
24 | 21 |
import org.gvsig.data.vectorial.IFeatureStore; |
25 | 22 |
import org.gvsig.data.vectorial.IFeatureType; |
26 | 23 |
import org.gvsig.data.vectorial.INewFeatureStoreParameters; |
24 |
import org.gvsig.fmap.geom.Geometry; |
|
27 | 25 |
|
28 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
29 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
30 | 26 |
import com.vividsolutions.jts.io.WKBWriter; |
31 | 27 |
|
32 | 28 |
class H2FeaturesWriter extends JDBCFeaturesWriter{ |
... | ... | |
242 | 238 |
} |
243 | 239 |
|
244 | 240 |
|
245 |
public boolean canWriteGeometry(int gvSIGgeometryType) { |
|
246 |
switch (gvSIGgeometryType) { |
|
247 |
case FShape.POINT: |
|
248 |
return true; |
|
249 |
case FShape.LINE: |
|
250 |
return true; |
|
251 |
case FShape.POLYGON: |
|
252 |
return true; |
|
253 |
case FShape.ARC: |
|
254 |
return false; |
|
255 |
case FShape.ELLIPSE: |
|
256 |
return false; |
|
257 |
case FShape.MULTIPOINT: |
|
258 |
return true; |
|
259 |
case FShape.TEXT: |
|
260 |
return false; |
|
261 |
} |
|
262 |
return false; |
|
263 |
} |
|
241 |
// public boolean canWriteGeometry(int gvSIGgeometryType) {
|
|
242 |
// switch (gvSIGgeometryType) {
|
|
243 |
// case FShape.POINT:
|
|
244 |
// return true;
|
|
245 |
// case FShape.LINE:
|
|
246 |
// return true;
|
|
247 |
// case FShape.POLYGON:
|
|
248 |
// return true;
|
|
249 |
// case FShape.ARC:
|
|
250 |
// return false;
|
|
251 |
// case FShape.ELLIPSE:
|
|
252 |
// return false;
|
|
253 |
// case FShape.MULTIPOINT:
|
|
254 |
// return true;
|
|
255 |
// case FShape.TEXT:
|
|
256 |
// return false;
|
|
257 |
// }
|
|
258 |
// return false;
|
|
259 |
// }
|
|
264 | 260 |
|
265 | 261 |
|
266 | 262 |
private PreparedStatement getUpdateFeatureStatement(DBFeatureType dbFeatureType) throws SQLException{ |
... | ... | |
318 | 314 |
} |
319 | 315 |
|
320 | 316 |
if (attr.getDataType() == IFeatureAttributeDescriptor.TYPE_GEOMETRY){ |
321 |
IGeometry geom =(IGeometry)feature.get(attr.ordinal());
|
|
317 |
Geometry geom =(Geometry)feature.get(attr.ordinal());
|
|
322 | 318 |
ps.setBytes( |
323 | 319 |
paramIndex, wkbWriter.write(geom.toJTSGeometry()) |
324 | 320 |
); |
Also available in: Unified diff