Revision 49 org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.api/src/main/java/org/gvsig/proj/cts/DefaultIProjection.java

View differences:

DefaultIProjection.java
35 35
import org.gvsig.proj.CoordinateReferenceSystem;
36 36
import org.gvsig.proj.CoordinateReferenceSystemLocator;
37 37
import org.gvsig.proj.CoordinateReferenceSystemNotFoundException;
38
import org.gvsig.proj.CoordinateTransformation;
38 39

  
39 40
/**
40 41
 * Java Map CoordinateReferenceSystem Library based implementation. It works
......
73 74
    }
74 75

  
75 76
    public IDatum getDatum() {
76
        throw new UnsupportedOperationException("Not implemented");
77
        return new IDatum() {
78

  
79
            public double getEIFlattening() {
80
                return 297.0d;
81
            }
82

  
83
            public double getESemiMajorAxis() {
84
                return 6378388.0d;
85
            }
86

  
87
        };
77 88
    }
78 89

  
79 90
    public Point2D createPoint(double x, double y) {
......
105 116
    }
106 117

  
107 118
    public Point2D toGeo(Point2D pt) {
108
        // DefaultProjection geographic = projection.
119
        CoordinateReferenceSystem geographic = crs.createGeographic();
109 120

  
110
        throw new UnsupportedOperationException("Not implemented");
111
        // double[] coords = new double[] { pt.getX(), pt.getY() };
112
        // getProjection().inverseTransform(coords);
113
        // return new Point2D.Double(coords[0], coords[1]);
121
        CoordinateTransformation transfToGeo =
122
            crs.getTransformation(geographic);
123

  
124
        // throw new UnsupportedOperationException("Not implemented");
125
        double[] coords = new double[] { pt.getX(), pt.getY() };
126
        transfToGeo.convert(coords);
127
        return new Point2D.Double(coords[0], coords[1]);
114 128
    }
115 129

  
116 130
    public Point2D fromGeo(Point2D gPt, Point2D mPt) {
117
        throw new UnsupportedOperationException("Not implemented");
118
        // double[] coords = new double[] { gPt.getX(), gPt.getY() };
119
        // getProjection().inverseTransform(coords);
120
        // mPt.setLocation(coords[0], coords[1]);
121
        // return mPt;
131
        CoordinateReferenceSystem geographic = crs.createGeographic();
132

  
133
        CoordinateTransformation transfFromGeo =
134
            geographic.getTransformation(crs);
135

  
136
        double[] coords = new double[] { gPt.getX(), gPt.getY() };
137
        transfFromGeo.convert(coords);
138
        mPt.setLocation(coords[0], coords[1]);
139
        return mPt;
122 140
    }
123 141

  
124 142
    public double getScale(double minX, double maxX, double width, double dpi) {

Also available in: Unified diff