Statistics
| Revision:

root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.lib / org.gvsig.proj.lib.api / src / main / java / org / gvsig / proj / CoordinateReferenceSystem.java @ 817

History | View | Annotate | Download (4.32 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2012 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.proj;
24

    
25
import javax.measure.Unit;
26
import javax.measure.quantity.Length;
27

    
28
import org.gvsig.proj.catalog.CRSDefinition;
29
import org.gvsig.proj.catalog.exception.CoordinateReferenceSystemNotFoundException;
30
import org.gvsig.tools.lang.Cloneable;
31

    
32
/**
33
 * Coordinate Reference System (CRS). A CRS defines how a set of coordinates relate
34
 * to real positions (on earth, on other planet or in the space). Some CRSs include
35
 * a projection, which defines a mathematical model to approximate the surface of an
36
 * area of the earth using a planar surface.
37
 * 
38
 * Note that a set of coordinates is meaningless if their CRS is not defined, as these
39
 * values can refer to different locations on the Earth depending on the CRS being used.
40
 * 
41
 * @see http://en.wikipedia.org/wiki/Coordinate_reference_system
42
 * @see http://en.wikipedia.org/wiki/Map_projection
43
 * @author gvSIG Team
44
 */
45
public interface CoordinateReferenceSystem extends Cloneable {    
46
    /**
47
     * Gets the definition of the coordinate reference system. The CRSDefinition
48
     * fully defines the CRS
49
     * 
50
     * @return
51
     * @throws UnsupportedOperationException 
52
     * @throws CoordinateReferenceSystemNotFoundException 
53
     */
54
    CRSDefinition getDefinition() throws CoordinateReferenceSystemNotFoundException, UnsupportedOperationException;
55
    
56
    /**
57
     * Calculates the distance between 2 points on the surface of the Earth.
58
     * 
59
     * The distances are calculated based on the characteristics of CRSDefinition,
60
     * using geodetic distances when possible. Geodetic distances offer highly
61
     * accurate measurements and are based on the exact shape of the ellipsoid.
62
     * 
63
     * If this CRSDefinition is projected, then the geodetic calculations are done
64
     * using its base (geographic) CRS. If this CRSDefinition is not geodetic nor
65
     * projected, then Euclidean distances are calculated.
66
     * 
67
     * The provided points are considered to be 2D points
68
     * (additional dimensions are ignored).
69
     * 
70
     * @param point1
71
     * @param point2
72
     * @param the unit in which the distance should be measure
73
     * 
74
     * @return The distance between point1 and point2 measured in the units
75
     * provided by the unit parameter.
76
     */
77
    double getDistance(double[] point1, double[] point2, Unit<Length> unit);
78

    
79
    /**
80
     * Calculates the distance between 2 points on the surface of the Earth.
81
     *  
82
     * If this CRS is projected and useBaseCRS is <code>false</code>, then
83
     * the Euclidean distance is calculated. If the CRS is projected and
84
     * <code>useBaseCRS</code> is <code>true<code>, then the
85
     * geodetic distance is calculated, using its base (geographic) CRS.
86
     * 
87
     * If the CRS is geodetic, then the geodetic distance is calculated.
88
     * If the CRS is not projected nor geometric, then the Euclidean distance
89
     * is calculated.
90
     * 
91
     * Geodetic distances offer highly accurate measurements and are based on
92
     * the exact shape of the ellipsoid.
93
     * 
94
     * The provided points are considered to be 2D points
95
     * (additional dimensions are ignored).
96
     * 
97
     * @param point1
98
     * @param point2
99
     * @param the unit in which the distance should be measure
100
     * 
101
     * @return The distance between point1 and point2 measured in the units
102
     * provided by the unit parameter.
103
     */
104
    double getDistance(double[] point1, double[] point2, boolean useBaseCRS, Unit<Length> unit);
105
}