001    /*
002     *    GeoAPI - Java interfaces for OGC/ISO standards
003     *    http://www.geoapi.org
004     *
005     *    Copyright (C) 2005-2012 Open Geospatial Consortium, Inc.
006     *    All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007     *
008     *    Permission to use, copy, and modify this software and its documentation, with
009     *    or without modification, for any purpose and without fee or royalty is hereby
010     *    granted, provided that you include the following on ALL copies of the software
011     *    and documentation or portions thereof, including modifications, that you make:
012     *
013     *    1. The full text of this NOTICE in a location viewable to users of the
014     *       redistributed or derivative work.
015     *    2. Notice of any changes or modifications to the OGC files, including the
016     *       date changes were made.
017     *
018     *    THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019     *    NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020     *    TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021     *    THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022     *    PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023     *
024     *    COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025     *    CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026     *
027     *    The name and trademarks of copyright holders may NOT be used in advertising or
028     *    publicity pertaining to the software without specific, written prior permission.
029     *    Title to copyright in this software and any associated documentation will at all
030     *    times remain with copyright holders.
031     */
032    package org.opengis.coverage.grid;
033    
034    import org.opengis.referencing.crs.CoordinateReferenceSystem;
035    import org.opengis.geometry.DirectPosition;
036    import org.opengis.annotation.UML;
037    
038    import static org.opengis.annotation.Obligation.*;
039    import static org.opengis.annotation.Specification.*;
040    
041    
042    /**
043     * A grid whose relation with an external {@linkplain CoordinateReferenceSystem coordinate reference
044     * system} is specified in another way than in terms of origin, orientation and spacing in that
045     * coordinate system. The transformation between grid and external coordinate system can be some
046     * analytical or non-analytical form.
047     *
048     * @version ISO 19123:2004
049     * @author  Wim Koolhoven
050     * @author  Martin Schouwenburg
051     * @author  Martin Desruisseaux (IRD)
052     * @since   GeoAPI 2.1
053     *
054     * @todo Comment (Wim): there seems to be no way to check whether two ReferenceableGrids are equal,
055     *       i.e. exactly fitting on all GridPoints.<br>
056     *       Martin: a possible approach is to import the "gridToCRS" attribute from the legacy OGC
057     *       specification, exactly as proposed for {@link RectifiedGrid}. Two ReferenceableGrids with
058     *       the same grid geometry and the same "gridToCRS" math transform are exactly fitting on all
059     *       GridPoints.
060     */
061    @UML(identifier="CV_ReferenceableGrid", specification=ISO_19123)
062    public interface ReferenceableGrid extends Grid {
063        /**
064         * Returns the coordinate reference system to which this grid is referenceable.
065         *
066         * @return The coordinate reference system.
067         */
068        @UML(identifier="CoordinateReferenceSystem", obligation=MANDATORY, specification=ISO_19123)
069        CoordinateReferenceSystem getCoordinateReferenceSystem();
070    
071        /**
072         * Transforms a grid coordinates to a direct position.
073         *
074         * @param  g The grid coordinates to transform.
075         * @return The "real world" coordinates.
076         */
077        @UML(identifier="coordTransform", obligation=MANDATORY, specification=ISO_19123)
078        DirectPosition transformCoordinates(GridCoordinates g);
079    
080        /**
081         * Transforms from a direct position to the grid coordinates of the nearest grid point.
082         *
083         * @param p The "real world" coordinates to transform.
084         * @return The grid coordinates.
085         *
086         * @todo Question (Wim): GridCoordinates are always integers, how to get
087         *       the not rounded results?<br>
088         *       Martin: The legacy OGC specification defined a "gridToCRS" math transform for
089         *       that. We may consider to import this element in the proposed set of interfaces.
090         */
091        @UML(identifier="invCoordTransform", obligation=MANDATORY, specification=ISO_19123)
092        GridCoordinates inverseTransformCoordinates(DirectPosition p);
093    }