root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.catalog / org.gvsig.proj.catalog.api / src / main / java / org / gvsig / proj / catalogue / CRSDefinition.java @ 799
History | View | Annotate | Download (9.25 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2018 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.proj.catalogue; |
25 |
|
26 |
import java.util.List; |
27 |
import java.util.Set; |
28 |
|
29 |
import org.gvsig.proj.catalogue.datum.Datum; |
30 |
import org.gvsig.proj.catalogue.ref.Extent; |
31 |
|
32 |
/**
|
33 |
* Definition of a Coordinate Reference System (CRS).
|
34 |
*
|
35 |
* A CRS defines how a set of coordinates relate to real positions (on earth, on other
|
36 |
* planet or in the space). A CRS defines the number of coordinate axis, its name, order and
|
37 |
* direction, its units, the mathematical model used to define the geometric figure (ellipsoid)
|
38 |
* to approximate the shape of the earth, the relationship of this mathematical model with the
|
39 |
* earth (datum), among other concepts and parameters. Some CRSs include a projection, which
|
40 |
* defines a mathematical model to approximate the surface of an area of the earth using a
|
41 |
* planar surface.
|
42 |
*
|
43 |
* Note that a set of coordinates is meaningless if their CRS is not defined, as these
|
44 |
* values can refer to different locations on the Earth depending on the CRS being used.
|
45 |
*
|
46 |
* @author gvSIG Team
|
47 |
* @author Cesar Martinez Izquierdo
|
48 |
*/
|
49 |
public interface CRSDefinition { |
50 |
|
51 |
/**
|
52 |
* A common name for this coordinate reference system
|
53 |
*
|
54 |
* @return the name, or {@code null} if none.
|
55 |
*/
|
56 |
String getName();
|
57 |
|
58 |
/**
|
59 |
* Gets a code that references an unambiguous definition of the coordinate reference
|
60 |
* system for some authority. Examples: "EPSG:4326", "EPSG:25830".
|
61 |
*
|
62 |
* @return the identifier which was used to instantiate the object, or the
|
63 |
* identifier that more closely matches the information used to instantiate
|
64 |
* the object (e.g. if derived from an WKT definition)
|
65 |
*/
|
66 |
String getIdentifier();
|
67 |
|
68 |
/**
|
69 |
* Gets the list of identifiers which describe this coordinate reference system
|
70 |
* definition.
|
71 |
*
|
72 |
* @return the list of object identifiers, or an empty collection if there is none.
|
73 |
*/
|
74 |
Set<String> getIdentifiers(); |
75 |
|
76 |
/**
|
77 |
* FIXME: GeoAPI
|
78 |
* Area or region or timeframe in which this (coordinate) reference system is valid.
|
79 |
*
|
80 |
* @return the reference system valid domain, or {@code null} if not available.
|
81 |
* @since 2.1
|
82 |
*/
|
83 |
Extent getDomainOfValidity(); |
84 |
|
85 |
/**
|
86 |
* Textual description of the coordinate reference system, including remarks
|
87 |
* and its scope.
|
88 |
*
|
89 |
* @return the description, or {@code null} if none.
|
90 |
*/
|
91 |
String getDescription();
|
92 |
|
93 |
/**
|
94 |
* Some CRSs include a projection, which defines a mathematical model to approximate
|
95 |
* the surface of an area of the earth using a planar surface. CRS including a
|
96 |
* projection are called projected CRSs
|
97 |
*
|
98 |
* @return true if the CRS is projected, false otherwise
|
99 |
*/
|
100 |
boolean isProjected();
|
101 |
|
102 |
/**
|
103 |
* Gets the type of coordinate reference system
|
104 |
*
|
105 |
* @return
|
106 |
*/
|
107 |
CRSType getType(); |
108 |
|
109 |
/**
|
110 |
* Returns a <cite>Well-Known Text</cite> (WKT) definition for this object.
|
111 |
* Note that there are different versions of the WKT specification
|
112 |
* (the older WKT defined by OGC 01-009 and the newer one, defined by OGC 12-063r5
|
113 |
* and ISO 19162). Also note that ESRI uses different names to refer to CRSs, datums,
|
114 |
* ellipsoids, etc. compared to OGC, so OGC and ESRI WKTs can be considered as different
|
115 |
* dialects.
|
116 |
*
|
117 |
* Whenever possible, this method will return a WKT following the same specification and
|
118 |
* dialect that the one used to instantiate this CRSDefinition. If the original
|
119 |
* specification or dialect are unknown, implementations are encouraged to format according
|
120 |
* to the most recent standard and following OGC dialect.
|
121 |
*
|
122 |
* @return the Well-Known Text (WKT) definition for this object.
|
123 |
* @throws UnsupportedOperationException if this object can not be formatted as WKT.
|
124 |
*/
|
125 |
String toWKT() throws UnsupportedOperationException; |
126 |
|
127 |
/**
|
128 |
* If the CRS type is {@link CRSType#CompoundCRSType}, this method returns the ordered
|
129 |
* list of coordinate reference systems which are its components.
|
130 |
*
|
131 |
* @return the ordered list of coordinate reference systems, or <code>null if the CRS
|
132 |
* is not compound
|
133 |
* @see #getType()
|
134 |
* @see CRSType#CompoundCRSType
|
135 |
*/
|
136 |
List<CRSDefinition> getComponents();
|
137 |
|
138 |
/**
|
139 |
* Gets the number of axis of the associated CoordinateSystem
|
140 |
*
|
141 |
* @return
|
142 |
*/
|
143 |
int getAxisCount();
|
144 |
|
145 |
/**
|
146 |
* Returns the axis for the associated coordinate system at the specified dimension,
|
147 |
* as officially defined by the authority.
|
148 |
*
|
149 |
* @param dimension
|
150 |
* @return
|
151 |
* @throws IndexOutOfBoundsException
|
152 |
*/
|
153 |
CoordinateSystemAxis getAxis(int dimension) throws IndexOutOfBoundsException; |
154 |
|
155 |
/**
|
156 |
* Returns the axis for the associated coordinate system at the specified
|
157 |
* dimension as internally used by gvSIG, which will sometimes differ from
|
158 |
* the order officially defined by the authority.
|
159 |
*
|
160 |
* The internal order is used for convenience and performance. gvSIG geometries
|
161 |
* and gvSIG coordinate transformations always expect coordinates to be provided
|
162 |
* using the internal order (xy axis order). However, some
|
163 |
* protocols or formats require the coordinates to be encoded using the
|
164 |
* official order.
|
165 |
*
|
166 |
* @param dimension
|
167 |
* @return
|
168 |
* @throws IndexOutOfBoundsException
|
169 |
*/
|
170 |
CoordinateSystemAxis getAxisInternal(int dimension) throws IndexOutOfBoundsException; |
171 |
|
172 |
/**
|
173 |
* For derived CRSs, it returns the base coordinate reference system.
|
174 |
*
|
175 |
* @return the base coordinate reference system or null if the CRS is not
|
176 |
* derived
|
177 |
* @see CRSType#isDerived()
|
178 |
* @see CRSType#ProjectedCRSType
|
179 |
* @see CRSType#OtherDerivedCRSType
|
180 |
*/
|
181 |
CRSDefinition getBaseCRS(); |
182 |
|
183 |
/**
|
184 |
* For derived CRSs, it returns the conversion from the {@linkplain #getBaseCRS() base CRS}
|
185 |
* to this CRS.
|
186 |
*
|
187 |
* @return the conversion from the base CRS or null if the CRS is not derived
|
188 |
*
|
189 |
* @see CRSType#isDerived()
|
190 |
* @see CRSType#ProjectedCRSType
|
191 |
* @see CRSType#OtherDerivedCRSType
|
192 |
*/
|
193 |
TransformationDefinition getConversionFromBase(); |
194 |
|
195 |
/**
|
196 |
* Returns the datum associated directly or indirectly to this CRS.
|
197 |
* In the case of a derived CRS, this method returns the
|
198 |
* datum of the {@linkplain #getBaseCRS() base CRS}. In the case of
|
199 |
* a compound CRS, it returns the datum associated to the horizontal component.
|
200 |
*
|
201 |
* @return the datum
|
202 |
*/
|
203 |
Datum getDatum(); |
204 |
|
205 |
/**
|
206 |
* Calculates the distance between 2 points on the surface of the Earth.
|
207 |
*
|
208 |
* The distances are calculated based on the characteristics of CRSDefinition,
|
209 |
* using geodetic distances when possible. Geodetic distances offer highly
|
210 |
* accurate measurements and are based on the exact shape of the ellipsoid.
|
211 |
*
|
212 |
* If this CRSDefinition is projected, then the geodetic calculations are done
|
213 |
* using its base (geographic) CRS. If this CRSDefinition is not geodetic nor
|
214 |
* projected, then Euclidean distances are calculated.
|
215 |
*
|
216 |
* The provided points are considered to be 2D points
|
217 |
* (additional dimensions are ignored).
|
218 |
*
|
219 |
* @return The distance between point1 and point2 in the same units as the
|
220 |
* ellipsoid axis (for geodetic CRSs) or in the same units as defined by the
|
221 |
* first axis dimension (for non-geodetic CRSs).
|
222 |
*/
|
223 |
double getDistance(double[] point1, double[] point2); |
224 |
|
225 |
/**
|
226 |
* Calculates the distance between 2 points on the surface of the Earth.
|
227 |
*
|
228 |
* If this CRS is projected and useBaseCRS is <code>false</code>, then
|
229 |
* the Euclidean distance is calculated. If the CRS is projected and
|
230 |
* <code>useBaseCRS</code> is <code>true<code>, then the
|
231 |
* geodetic distance is calculated, using its base (geographic) CRS.
|
232 |
*
|
233 |
* If the CRS is geodetic, then the geodetic distance is calculated.
|
234 |
* If the CRS is not projected nor geometric, then the Euclidean distance
|
235 |
* is calculated.
|
236 |
*
|
237 |
* Geodetic distances offer highly accurate measurements and are based on
|
238 |
* the exact shape of the ellipsoid.
|
239 |
*
|
240 |
* The provided points are considered to be 2D points
|
241 |
* (additional dimensions are ignored).
|
242 |
*
|
243 |
* @return The distance between point1 and point2 in the same units as the
|
244 |
* ellipsoid axis (for geodetic CRSs) or in the same units as defined by the
|
245 |
* first axis dimension (for non-geodetic CRSs).
|
246 |
*/
|
247 |
double getDistance(double[] point1, double[] point2, boolean useBaseCRS); |
248 |
} |