src/main/java/ucar/geoapi/NetcdfProjection.java
@Override
    public DirectPosition transform(final DirectPosition ptSrc, DirectPosition ptDst)
            throws MismatchedDimensionException, TransformException
    {
        ensureTwoDimensional(ptSrc);
        ensureTwoDimensional(ptDst);
        double x = ptSrc.getOrdinate(0);
        double y = ptSrc.getOrdinate(1);
        if (isInverse) {
            final LatLonPoint pt = projection.projToLatLon(ProjectionPoint.create(x, y));
            x = pt.getLongitude();
            y = pt.getLatitude();
        } else {
            final ProjectionPoint pt = projection.latLonToProj(LatLonPoint.create(y, x));
            x = pt.getX();
            y = pt.getY();
        }
        if (ptDst == null) {
            ptDst = new SimpleDirectPosition(2);
        }
        ptDst.setOrdinate(0, x);
        ptDst.setOrdinate(1, y);
        return ptDst;
    }
/**
     * Transforms the specified {@code ptSrc} and stores the result in {@code ptDst}.
     * If {@code ptDst} is {@code null}, a new {@link DirectPosition} object is allocated and
     * the result of the transformation is stored in this object. In either case, {@code ptDst},
     * which contains the transformed point, is returned for convenience. If {@code ptSrc} and
     * {@code ptDst} are the same object, the input point is correctly overwritten with the
     * transformed point.
     *
     * <p>This method delegates to one of the following methods:</p>
     * <ul>
     *   <li>{@link Projection#latLonToProj(LatLonPoint)}
     *       for the forward projection.</li>
     *   <li>{@link Projection#projToLatLon(ProjectionPoint)}
     *       for the inverse projection.</li>
     * </ul>
     *
     * @param  ptSrc  the specified coordinate point to be transformed.
     * @param  ptDst  the specified coordinate point that stores the result of transforming {@code ptSrc}, or {@code null}.
     * @return the coordinate point after transforming {@code ptSrc} and storing the result in {@code ptDst},
     *         or a newly created point if {@code ptDst} was null.
     * @throws MismatchedDimensionException if {@code ptSrc} or {@code ptDst} does not have the expected dimension.
     * @throws TransformException if the point can not be transformed.
     */
Transforms the specified  ptSrc and stores the result in  ptDst.
If  ptDst is  null, a new  DirectPosition object is allocated and
the result of the transformation is stored in this object. In either case,  ptDst,
which contains the transformed point, is returned for convenience. If  ptSrc and
ptDst are the same object, the input point is correctly overwritten with the
transformed point.

This method delegates to one of the following methods:

 Projection#latLonToProj(LatLonPoint)
for the forward projection.
 Projection#projToLatLon(ProjectionPoint)
for the inverse projection.


@param  ptSrc  the specified coordinate point to be transformed.
@param  ptDst  the specified coordinate point that stores the result of transforming  ptSrc, or  null.
@return the coordinate point after transforming  ptSrc and storing the result in  ptDst,
or a newly created point if  ptDst was null.
@throws MismatchedDimensionException if  ptSrc or  ptDst does not have the expected dimension.
@throws TransformException if the point can not be transformed.
Transforms the specified ptSrc and stores the result in ptDst . If ptDst is null a new DirectPosition object is allocated and the result of the transformation is stored in this object . In either case ptDst which contains the transformed point is returned for convenience . If ptSrc and ptDst are the same object the input point is correctly overwritten with the transformed point . This method delegates to one of the following methods : Projection#latLonToProj ( LatLonPoint ) for the forward projection . Projection#projToLatLon ( ProjectionPoint ) for the inverse projection . @param ptSrc the specified coordinate point to be transformed . @param ptDst the specified coordinate point that stores the result of transforming ptSrc or null . @return the coordinate point after transforming ptSrc and storing the result in ptDst or a newly created point if ptDst was null . @throws MismatchedDimensionException if ptSrc or ptDst does not have the expected dimension . @throws TransformException if the point can not be transformed .
@Override
    public DirectPosition transform(final DirectPosition ptSrc, DirectPosition ptDst)
            throws MismatchedDimensionException, TransformException
    {
        ensureTwoDimensional(ptSrc);
        ensureTwoDimensional(ptDst);
        double x = ptSrc.getOrdinate(0);
        double y = ptSrc.getOrdinate(1);
        if (isInverse) {
            final LatLonPoint pt = projection.projToLatLon(ProjectionPoint.create(x, y));
            x = pt.getLongitude();
            y = pt.getLatitude();
        } else {
            final ProjectionPoint pt = projection.latLonToProj(LatLonPoint.create(y, x));
            x = pt.getX();
            y = pt.getY();
        }
        if (ptDst == null) {
            ptDst = new SimpleDirectPosition(2);
        }
        ptDst.setOrdinate(0, x);
        ptDst.setOrdinate(1, y);
        return ptDst;
    }
@ Override public DirectPosition transform ( final DirectPosition ptSrc , DirectPosition ptDst ) throws MismatchedDimensionException , TransformException { ensureTwoDimensional ( ptSrc ) ; ensureTwoDimensional ( ptDst ) ; double x = ptSrc . getOrdinate ( 0 ) ; double y = ptSrc . getOrdinate ( 1 ) ; if ( isInverse ) { final LatLonPoint pt = projection . projToLatLon ( ProjectionPoint . create ( x , y ) ) ; x = pt . getLongitude ( ) ; y = pt . getLatitude ( ) ; } else { final ProjectionPoint pt = projection . latLonToProj ( LatLonPoint . create ( y , x ) ) ; x = pt . getX ( ) ; y = pt . getY ( ) ; } if ( ptDst == null ) { ptDst = new SimpleDirectPosition ( 2 ) ; } ptDst . setOrdinate ( 0 , x ) ; ptDst . setOrdinate ( 1 , y ) ; return ptDst ; }
Transforms the specified {@code ptSrc} and stores the result in {@code ptDst}.
Transforms the specified { @code ptSrc } and stores the result in { @code ptDst } .