Revision 20920 trunk/libraries/libFMap_dataDB/src-test/org/gvsig/data/datastores/vectorial/db/jdbc/h2/SHP2H2FeaturesVisitor.java
SHP2H2FeaturesVisitor.java | ||
---|---|---|
9 | 9 |
import java.sql.Statement; |
10 | 10 |
import java.util.Iterator; |
11 | 11 |
|
12 |
import org.gvsig.data.datastores.vectorial.db.jdbc.WKBParser2; |
|
12 | 13 |
import org.gvsig.data.datastores.vectorial.db.jdbc.h2.H2StoreParameters; |
13 | 14 |
import org.gvsig.data.vectorial.IFeature; |
14 | 15 |
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor; |
15 | 16 |
import org.gvsig.data.vectorial.IFeatureType; |
16 | 17 |
import org.gvsig.data.vectorial.visitor.FeaturesVisitor; |
17 | 18 |
import org.gvsig.exceptions.BaseException; |
19 |
import org.gvsig.fmap.geom.Geometry; |
|
18 | 20 |
|
19 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
20 |
import com.iver.cit.gvsig.fmap.drivers.WKBParser2; |
|
21 |
import com.vividsolutions.jts.io.WKBWriter; |
|
21 | 22 |
|
23 |
|
|
22 | 24 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
23 | 25 |
* |
24 | 26 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
142 | 144 |
} else if (type.equals(IFeatureAttributeDescriptor.TYPE_STRING)) { |
143 | 145 |
pst.setString(i+2, feature.getString(i)); |
144 | 146 |
} else if (type.equals(IFeatureAttributeDescriptor.TYPE_GEOMETRY)) { |
145 |
IGeometry geom =(IGeometry)feature.getGeometry(i);
|
|
147 |
Geometry geom =(Geometry)feature.getGeometry(i);
|
|
146 | 148 |
if (geom != null){ |
147 |
pst.setBytes( i+2, geom.toWKB());
|
|
149 |
pst.setBytes( i+2, new WKBWriter().write(geom.toJTSGeometry()));
|
|
148 | 150 |
}else{ |
149 | 151 |
System.out.print("Geometry null!!!"); |
150 | 152 |
pst.setObject(i+2, null); |
... | ... | |
158 | 160 |
} |
159 | 161 |
catch(SQLException except){ |
160 | 162 |
throw new RuntimeException(except); |
161 |
|
|
162 |
}catch(IOException except){ |
|
163 |
throw new RuntimeException(except); |
|
164 |
|
|
165 | 163 |
} |
166 | 164 |
} |
167 | 165 |
|
Also available in: Unified diff