Revision 20920 trunk/libraries/libFMap_dataDB/src/org/gvsig/data/datastores/vectorial/db/jdbc/postgresql/PostGIS2Geometry.java
PostGIS2Geometry.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.sql.SQLException; |
4 | 4 |
|
5 |
import org.gvsig.fmap.geom.GeometryFactory; |
|
6 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
5 | 7 |
import org.postgis.Geometry; |
6 | 8 |
import org.postgis.LineString; |
7 | 9 |
import org.postgis.LinearRing; |
... | ... | |
11 | 13 |
import org.postgis.Point; |
12 | 14 |
import org.postgis.Polygon; |
13 | 15 |
|
14 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
15 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
16 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
17 |
|
|
18 | 16 |
/** |
19 | 17 |
* Codigo recogido (en parte) de la lista de desarrollo de gvSIG |
20 | 18 |
* Enviado por: MAU ingmau00 en gmail.com |
... | ... | |
28 | 26 |
public class PostGIS2Geometry { |
29 | 27 |
|
30 | 28 |
|
31 |
public static IGeometry getGeneralPath(PGgeometry geom) throws
|
|
29 |
public static org.gvsig.fmap.geom.Geometry getGeneralPath(PGgeometry geom) throws
|
|
32 | 30 |
SQLException{ |
33 | 31 |
|
34 | 32 |
|
35 | 33 |
|
36 | 34 |
GeneralPathX gp = new GeneralPathX(); |
37 |
IGeometry resultGeom = null;
|
|
35 |
org.gvsig.fmap.geom.Geometry resultGeom = null;
|
|
38 | 36 |
if (geom.getGeoType() == Geometry.POINT) { |
39 | 37 |
Point p = (Point) geom.getGeometry(); |
40 |
resultGeom = ShapeFactory.createPoint2D(p.x, p.y);
|
|
38 |
resultGeom = GeometryFactory.createPoint2D(p.x, p.y);
|
|
41 | 39 |
|
42 | 40 |
} else if ( geom.getGeoType() == Geometry.LINESTRING) { |
43 | 41 |
gp = lineString2GP((LineString) geom.getGeometry()); |
... | ... | |
47 | 45 |
for (int j = 0; j < mls.numLines(); j++) { |
48 | 46 |
gp.append(lineString2GP(mls.getLine(j)), false); |
49 | 47 |
} |
50 |
resultGeom = ShapeFactory.createPolyline2D(gp);
|
|
48 |
resultGeom = GeometryFactory.createPolyline2D(gp);
|
|
51 | 49 |
} else if (geom.getGeoType() == Geometry.POLYGON ) { |
52 | 50 |
gp = polygon2GP((Polygon) geom.getGeometry()); |
53 |
resultGeom = ShapeFactory.createPolygon2D(gp);
|
|
51 |
resultGeom = GeometryFactory.createPolygon2D(gp);
|
|
54 | 52 |
} else if (geom.getGeoType() == Geometry.MULTIPOLYGON) { |
55 | 53 |
MultiPolygon mp = (MultiPolygon) geom.getGeometry(); |
56 | 54 |
|
57 | 55 |
for (int i = 0; i < mp.numPolygons(); i++) { |
58 | 56 |
gp.append(polygon2GP(mp.getPolygon(i)), false); |
59 | 57 |
} |
60 |
resultGeom = ShapeFactory.createPolygon2D(gp);
|
|
58 |
resultGeom = GeometryFactory.createPolygon2D(gp);
|
|
61 | 59 |
} else if (geom.getGeoType() == Geometry.GEOMETRYCOLLECTION) { |
62 | 60 |
//FIXME: Falta Implementar!!! |
63 | 61 |
throw new RuntimeException("geometryCollections not supported by this driver"); |
Also available in: Unified diff