Revision 29097 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/util/Converter.java
Converter.java | ||
---|---|---|
61 | 61 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
62 | 62 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
63 | 63 |
import org.gvsig.fmap.geom.primitive.Surface; |
64 |
import org.gvsig.fmap.geom.primitive.impl.Point2D; |
|
64 | 65 |
import org.slf4j.Logger; |
65 | 66 |
import org.slf4j.LoggerFactory; |
66 | 67 |
|
... | ... | |
134 | 135 |
* @param jtsGeometry jts Geometry |
135 | 136 |
* @return IGeometry of FMap |
136 | 137 |
* @author azabala |
138 |
* @throws CreateGeometryException |
|
137 | 139 |
*/ |
138 |
public static Geometry jtsToGeometry(com.vividsolutions.jts.geom.Geometry geo){ |
|
140 |
public static Geometry jtsToGeometry(com.vividsolutions.jts.geom.Geometry geo) throws CreateGeometryException{
|
|
139 | 141 |
Geometry shpNew = null; |
140 | 142 |
|
141 | 143 |
try { |
142 | 144 |
if (geo instanceof Point) { |
143 |
shpNew = new org.gvsig.fmap.geom.primitive.impl.Point2D(null, null, ((Point) geo).getX(), ((Point) geo).getY());
|
|
145 |
shpNew = geomManager.createPoint(((Point) geo).getX(),((Point) geo).getY(), SUBTYPES.GEOM2D);
|
|
144 | 146 |
} |
145 | 147 |
|
146 | 148 |
if (geo.isEmpty()) { |
... | ... | |
790 | 792 |
} |
791 | 793 |
|
792 | 794 |
return viewCoordinates; |
793 |
} */ |
|
795 |
} |
|
796 |
* @throws CreateGeometryException */ |
|
794 | 797 |
|
795 | 798 |
/* private Shape toShape(GeometryCollection gc) |
796 | 799 |
throws NoninvertibleTransformException { |
... | ... | |
802 | 805 |
return shape; |
803 | 806 |
} */ |
804 | 807 |
private static GeneralPathX toShape(MultiLineString mls) |
805 |
throws NoninvertibleTransformException { |
|
808 |
throws NoninvertibleTransformException, CreateGeometryException {
|
|
806 | 809 |
GeneralPathX path = new GeneralPathX(); |
807 | 810 |
|
808 | 811 |
for (int i = 0; i < mls.getNumGeometries(); i++) { |
... | ... | |
823 | 826 |
* @return DOCUMENT ME! |
824 | 827 |
* |
825 | 828 |
* @throws NoninvertibleTransformException DOCUMENT ME! |
829 |
* @throws CreateGeometryException |
|
826 | 830 |
*/ |
827 | 831 |
private static GeneralPathX toShape(LineString lineString) |
828 |
throws NoninvertibleTransformException { |
|
832 |
throws NoninvertibleTransformException, CreateGeometryException {
|
|
829 | 833 |
GeneralPathX shape = new GeneralPathX(); |
830 |
org.gvsig.fmap.geom.primitive.impl.Point2D viewPoint = coordinate2FPoint2D(lineString.getCoordinateN(0));
|
|
834 |
org.gvsig.fmap.geom.primitive.Point viewPoint = coordinate2FPoint2D(lineString.getCoordinateN(0));
|
|
831 | 835 |
shape.moveTo(viewPoint.getX(), viewPoint.getY()); |
832 | 836 |
|
833 | 837 |
for (int i = 1; i < lineString.getNumPoints(); i++) { |
... | ... | |
879 | 883 |
* @param coord DOCUMENT ME! |
880 | 884 |
* |
881 | 885 |
* @return DOCUMENT ME! |
886 |
* @throws CreateGeometryException |
|
882 | 887 |
*/ |
883 |
public static org.gvsig.fmap.geom.primitive.impl.Point2D coordinate2FPoint2D(Coordinate coord) {
|
|
884 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(null, null, coord.x, coord.y); //,coord.z);
|
|
888 |
public static org.gvsig.fmap.geom.primitive.Point coordinate2FPoint2D(Coordinate coord) throws CreateGeometryException {
|
|
889 |
return geomManager.createPoint(coord.x, coord.y, SUBTYPES.GEOM2D); //,coord.z);
|
|
885 | 890 |
} |
886 | 891 |
|
887 | 892 |
/** |
... | ... | |
892 | 897 |
* @return GeneralPathX. |
893 | 898 |
* |
894 | 899 |
* @throws NoninvertibleTransformException |
900 |
* @throws CreateGeometryException |
|
895 | 901 |
* @throws IllegalArgumentException |
896 | 902 |
*/ |
897 | 903 |
public static GeneralPathX toShape(com.vividsolutions.jts.geom.Geometry geometry) |
898 |
throws NoninvertibleTransformException { |
|
904 |
throws NoninvertibleTransformException, CreateGeometryException {
|
|
899 | 905 |
if (geometry.isEmpty()) { |
900 | 906 |
return new GeneralPathX(); |
901 | 907 |
} |
... | ... | |
986 | 992 |
|
987 | 993 |
return newGp; |
988 | 994 |
} |
989 |
public static Geometry transformToInts(Geometry gp, AffineTransform at) { |
|
995 |
public static Geometry transformToInts(Geometry gp, AffineTransform at) throws CreateGeometryException {
|
|
990 | 996 |
GeneralPathX newGp = new GeneralPathX(); |
991 | 997 |
double[] theData = new double[6]; |
992 | 998 |
double[] aux = new double[6]; |
... | ... | |
1062 | 1068 |
switch (gp.getType()) |
1063 | 1069 |
{ |
1064 | 1070 |
case Geometry.TYPES.POINT: |
1065 |
shp = new org.gvsig.fmap.geom.primitive.impl.Point2D(null, null, ptDst.getX(), ptDst.getY());
|
|
1071 |
shp = geomManager.createPoint(ptDst.getX(), ptDst.getY(), SUBTYPES.GEOM2D);
|
|
1066 | 1072 |
break; |
1067 | 1073 |
|
1068 | 1074 |
case Geometry.TYPES.CURVE: |
Also available in: Unified diff