/** * Creates the inverse CoordinateOperation. */ @Override public CoordinateOperation inverse() throws NonInvertibleOperationException { return new Geocentric2Geographic(ellipsoid, epsilon); }
/** * Returns true if o is equals to * <code>this</code>. Tests equality between the ellipsoid used by the * transformation. * * @param o The object to compare this Geocentric2Geographic against */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof Geocentric2Geographic) { Geocentric2Geographic gc2gg = (Geocentric2Geographic) o; return getEllipsoid().equals(gc2gg.getEllipsoid()); } return false; }
/** * Return a String representation of this Geographic/Geocentric converter. */ @Override public String toString() { return getName() + " (" + ellipsoid.getName() + ")"; }
@Override public double[] transform(double[] coord) throws IllegalCoordinateException { // Creates a temp coord to find the final translation parameters double[] coordi = coord.clone(); // Find a rough position on GRS 80 coordi = GEOC2GEOG.transform(coordi); // Get decimal degree coordinates for grid interpolation coordi = RAD2DD.transform(coordi); // Definitive translation parameters are initialized with mean // translation parameters double tx = -168.0; double ty = -60.0; double tz = 320.0; // Get the definitive translation parameters from the grids try { double[] t = GRID3D.bilinearInterpolation(coordi[0], coordi[1]); tx = t[0]; ty = t[1]; tz = t[2]; } catch (OutOfExtentException e) { throw new IllegalCoordinateException(e.getMessage()); } // Apply definitive translation coord[0] = -tx + coord[0]; coord[1] = -ty + coord[1]; coord[2] = -tz + coord[2]; return coord; }
/** * @return * @throws org.cts.op.NonInvertibleOperationException * @see GeodeticCRS#toGeographicCoordinateConverter() */ @Override public CoordinateOperation toGeographicCoordinateConverter() throws NonInvertibleOperationException { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); ops.add(new Geocentric2Geographic(getDatum().getEllipsoid())); if (!getDatum().getPrimeMeridian().equals(PrimeMeridian.GREENWICH)) { ops.add(LongitudeRotation.getLongitudeRotationTo(getDatum().getPrimeMeridian())); } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
new Geographic2Geocentric(ellipsoid), coordOp, new Geocentric2Geographic(targetDatum.getEllipsoid()), new LongitudeRotation(targetDatum.getPrimeMeridian().getLongitudeFromGreenwichInRadians()).inverse());
new Geographic2Geocentric(source.getDatum().getEllipsoid()), datumTransformation, new Geocentric2Geographic(target.getDatum().getEllipsoid()), new LongitudeRotation(target.getDatum().getPrimeMeridian().getLongitudeFromGreenwichInRadians()).inverse(), target.fromGeographicCoordinateConverter());