root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.catalog / org.gvsig.proj.catalog.api / src / main / java / org / gvsig / proj / catalog / CRSDefinition.java @ 852
History | View | Annotate | Download (11.5 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.catalog; |
25 |
|
26 |
import java.util.List; |
27 |
import java.util.Set; |
28 |
|
29 |
import javax.measure.Unit; |
30 |
import javax.measure.quantity.Length; |
31 |
|
32 |
import org.gvsig.proj.catalog.datum.Datum; |
33 |
import org.gvsig.proj.catalog.exception.CoordinateReferenceSystemException; |
34 |
import org.gvsig.proj.catalog.exception.UnsupportedCoordinateReferenceSystemException; |
35 |
import org.gvsig.proj.catalog.extent.Extent; |
36 |
|
37 |
/**
|
38 |
* Definition of a Coordinate Reference System (CRS).
|
39 |
*
|
40 |
* A CRS defines how a set of coordinates relate to real positions (on earth, on other
|
41 |
* planet or in the space). A CRS defines the number of coordinate axis, its name, order and
|
42 |
* direction, its units, the mathematical model used to define the geometric figure (ellipsoid)
|
43 |
* to approximate the shape of the earth, the relationship of this mathematical model with the
|
44 |
* earth (datum), among other concepts and parameters. Some CRSs include a projection, which
|
45 |
* defines a mathematical model to approximate the surface of an area of the earth using a
|
46 |
* planar surface.
|
47 |
*
|
48 |
* Note that a set of coordinates is meaningless if their CRS is not defined, as these
|
49 |
* values can refer to different locations on the Earth depending on the CRS being used.
|
50 |
*
|
51 |
* @author gvSIG Team
|
52 |
* @author Cesar Martinez Izquierdo
|
53 |
*/
|
54 |
public interface CRSDefinition { |
55 |
|
56 |
/**
|
57 |
* A common name for this coordinate reference system
|
58 |
*
|
59 |
* @return The human-readable name of the CRS. This method should never return null
|
60 |
*/
|
61 |
String getName();
|
62 |
|
63 |
/**
|
64 |
* Gets a code that references an unambiguous definition of the coordinate reference
|
65 |
* system for some authority. Examples: "EPSG:4326", "EPSG:25830".
|
66 |
*
|
67 |
* Note that identifiers in the "USER:" namespace are an special case, as their
|
68 |
* definition will be different for each user, so they don't reference an
|
69 |
* unambiguous definition.
|
70 |
*
|
71 |
* @return the identifier which was used to instantiate the object, or the
|
72 |
* identifier that more closely matches the information used to instantiate
|
73 |
* the object (e.g. if derived from an WKT definition), or <code>null</code> if an identifier is
|
74 |
* not available
|
75 |
*/
|
76 |
String getIdentifier();
|
77 |
|
78 |
/**
|
79 |
* Gets the list of identifiers which describe this coordinate reference system
|
80 |
* definition.
|
81 |
*
|
82 |
* @return the list of object identifiers, or an empty collection if there is none.
|
83 |
*/
|
84 |
Set<String> getIdentifiers(); |
85 |
|
86 |
/**
|
87 |
* Gets the authority which defines this coordinate references system
|
88 |
* (e.g. "EPSG", "ESRI", "USER"...).
|
89 |
*
|
90 |
* If the CRS is defined by several
|
91 |
* authorities, it returns the authority which was used to instantiate
|
92 |
* the object, or the authority that more closely matches the information
|
93 |
* used to instantiate the object (e.g. if derived from an WKT definition)
|
94 |
*
|
95 |
* @return The authority name, or {@code null} if not available.
|
96 |
*/
|
97 |
String getAuthorityName();
|
98 |
|
99 |
/**
|
100 |
* FIXME: GeoAPI
|
101 |
* Area or region or timeframe in which this (coordinate) reference system is valid.
|
102 |
*
|
103 |
* @return the reference system valid domain, or {@code null} if not available.
|
104 |
* @since 2.1
|
105 |
*/
|
106 |
Extent getDomainOfValidity(); |
107 |
|
108 |
/**
|
109 |
* Textual description of the coordinate reference system, including remarks
|
110 |
* and its scope.
|
111 |
*
|
112 |
* @return the description, or {@code null} if none.
|
113 |
*/
|
114 |
String getDescription();
|
115 |
|
116 |
/**
|
117 |
* Gets the type of coordinate reference system
|
118 |
*
|
119 |
* @return
|
120 |
*/
|
121 |
CRSType getType(); |
122 |
|
123 |
/**
|
124 |
* Returns a <cite>Well-Known Text</cite> (WKT) definition for this object.
|
125 |
* Note that there are different versions of the WKT specification
|
126 |
* (the older WKT defined by OGC 01-009 and the newer one, defined by OGC 12-063r5
|
127 |
* and ISO 19162). Also note that ESRI uses different names to refer to CRSs, datums,
|
128 |
* ellipsoids, etc. compared to OGC, so OGC and ESRI WKTs can be considered as different
|
129 |
* dialects. Use
|
130 |
* {@link #toString(org.gvsig.proj.catalog.TextSerialization.WKTConvention, int)}
|
131 |
* if a particular format and/or convention is required.
|
132 |
*
|
133 |
* Whenever possible, this method will return a WKT following the same specification and
|
134 |
* dialect that the one used to instantiate this CRSDefinition. If the original
|
135 |
* specification or dialect are unknown, implementations are encouraged to format according
|
136 |
* to the most recent standard and following OGC dialect.
|
137 |
*
|
138 |
* @return the Well-Known Text (WKT) definition for this object.
|
139 |
* @throws UnsupportedOperationException if this object can not be formatted as WKT.
|
140 |
* @see #toString(org.gvsig.proj.catalog.TextSerialization.WKTConvention, int)
|
141 |
*/
|
142 |
String toWKT() throws UnsupportedOperationException; |
143 |
|
144 |
/**
|
145 |
* Returns a text serialization of this definition (such as a WKT string), using the
|
146 |
* specified {@link TextSerialization.Format} and trying to convert names to the
|
147 |
* specified {@link TextSerialization.WKTConvention}.
|
148 |
* {@link TextSerialization.Format#WKT1} format MUST be supported by any implementation
|
149 |
* of this API. This method must throw an UnsupportedOperationException if the requested format is not
|
150 |
* supported by a particular implementation
|
151 |
*
|
152 |
* @param format The {@link TextSerialization.Format} used to serialize this definition.
|
153 |
*
|
154 |
* @return A serialized version of this definition.
|
155 |
* @throws UnsupportedOperationException if the requested format is not supported
|
156 |
* or if this is object can not be formatted using that format.
|
157 |
* @see #toString(org.gvsig.proj.catalog.TextSerialization.WKTConvention, int)
|
158 |
*/
|
159 |
String toString(TextSerialization.Format format) throws UnsupportedOperationException; |
160 |
|
161 |
/**
|
162 |
* Returns a text serialization of this definition (such as a WKT string), using the
|
163 |
* specified {@link TextSerialization.Format} and trying to convert names to the
|
164 |
* specified {@link TextSerialization.WKTConvention}.
|
165 |
* {@link TextSerialization.Format#WKT1} format MUST be supported by any implementation
|
166 |
* of this API. This method must throw an UnsupportedOperationException if the requested format is not
|
167 |
* supported by a particular implementation
|
168 |
*
|
169 |
* @param format The {@link TextSerialization.Format} used to serialize this definition.
|
170 |
* @param convention The preferred {@link TextSerialization.WKTConvention} used to
|
171 |
* encode projection names, datum names, units, etc. This is only a hint,
|
172 |
* implementations can ignore this hint if they are not able to convert this object
|
173 |
* to the requested convention.
|
174 |
* @param indentation The amount of spaces to use in indentation. Use 0 to produce
|
175 |
* a single line serialization.
|
176 |
*
|
177 |
* @return A serialized version of this definition.
|
178 |
* @throws UnsupportedOperationException if the requested format is not supported
|
179 |
* or if this is object can not be formatted using that format.
|
180 |
* @see #toString(org.gvsig.proj.catalog.TextSerialization.WKTConvention)
|
181 |
*/
|
182 |
String toString(TextSerialization.Format format, TextSerialization.WKTConvention convention, int indentation) throws UnsupportedOperationException; |
183 |
|
184 |
/**
|
185 |
* If the CRS type is {@link CRSType#CompoundCRSType}, this method returns the ordered
|
186 |
* list of coordinate reference systems which are its components.
|
187 |
*
|
188 |
* @return the ordered list of coordinate reference systems, or <code>null if the CRS
|
189 |
* is not compound
|
190 |
* @throws UnsupportedCoordinateReferenceSystemException
|
191 |
* @see #getType()
|
192 |
* @see CRSType#CompoundCRSType
|
193 |
*/
|
194 |
List<CRSDefinition> getComponents() throws UnsupportedCoordinateReferenceSystemException; |
195 |
|
196 |
/**
|
197 |
* Gets the number of axis of the associated CoordinateSystem
|
198 |
*
|
199 |
* @return
|
200 |
*/
|
201 |
int getAxisCount();
|
202 |
|
203 |
/**
|
204 |
* Returns the axis for the associated coordinate system at the specified dimension,
|
205 |
* as officially defined by the authority.
|
206 |
*
|
207 |
* @param dimension
|
208 |
* @return
|
209 |
* @throws IndexOutOfBoundsException
|
210 |
*/
|
211 |
CoordinateSystemAxis getAxis(int dimension) throws IndexOutOfBoundsException; |
212 |
|
213 |
/**
|
214 |
* Returns the axis for the associated coordinate system at the specified
|
215 |
* dimension as internally used by gvSIG, which will sometimes differ from
|
216 |
* the order officially defined by the authority.
|
217 |
*
|
218 |
* The internal order is used for convenience and performance. gvSIG geometries
|
219 |
* and gvSIG coordinate transformations always expect coordinates to be provided
|
220 |
* using the internal order (xy axis order). However, some
|
221 |
* protocols or formats require the coordinates to be encoded using the
|
222 |
* official order.
|
223 |
*
|
224 |
* @param dimension
|
225 |
* @return
|
226 |
* @throws IndexOutOfBoundsException
|
227 |
*/
|
228 |
CoordinateSystemAxis getAxisInternal(int dimension) throws IndexOutOfBoundsException; |
229 |
|
230 |
/**
|
231 |
* Returns the datum associated directly or indirectly to this CRS.
|
232 |
* In the case of a derived CRS, this method returns the
|
233 |
* datum of the {@linkplain #getBaseCRS() base CRS}. In the case of
|
234 |
* a compound CRS, it returns the datum associated to the horizontal component.
|
235 |
*
|
236 |
* @return the datum
|
237 |
*/
|
238 |
Datum getDatum(); |
239 |
|
240 |
/**
|
241 |
* Indicates whether some other CRSDefinition is "equal to" this one.
|
242 |
*
|
243 |
* Definitions are considered equal if they represent the same CRS (same type,
|
244 |
* same datum, same ellipsoid parameters, etc), despite some differences in
|
245 |
* naming (CRS name, datum aliases, missing/different authority code...).
|
246 |
*
|
247 |
* @param ignoreAxis Ignores the names and order of the axis in the comparison
|
248 |
* @param ignoreMetadata Ignores metadata (including unit names) in the comparison
|
249 |
*
|
250 |
* @return
|
251 |
*/
|
252 |
boolean equals(CRSDefinition definition, boolean ignoreAxis, boolean ignoreMetadata); |
253 |
|
254 |
|
255 |
/**
|
256 |
* For derived CRSs (such as projected CRSs), it returns the base coordinate
|
257 |
* reference system.
|
258 |
*
|
259 |
* @return the base coordinate reference system or null if the CRS is not
|
260 |
* derived
|
261 |
* @throws UnsupportedCoordinateReferenceSystemException
|
262 |
* @see CRSType#isDerived()
|
263 |
* @see CRSType#ProjectedCRSType
|
264 |
* @see CRSType#OtherDerivedCRSType
|
265 |
*/
|
266 |
CRSDefinition getBaseCRS() throws UnsupportedCoordinateReferenceSystemException;
|
267 |
|
268 |
/**
|
269 |
* For derived CRSs (such as projected CRSs), it returns the conversion from the
|
270 |
* {@linkplain #getBaseCRS() base CRS} to this CRS.
|
271 |
*
|
272 |
* @return the conversion from the base CRS or null if the CRS is not derived
|
273 |
* @throws CoordinateReferenceSystemException
|
274 |
*
|
275 |
* @see CRSType#isDerived()
|
276 |
* @see CRSType#ProjectedCRSType
|
277 |
* @see CRSType#OtherDerivedCRSType
|
278 |
*/
|
279 |
TransformationDefinition getConversionFromBase() throws CoordinateReferenceSystemException;
|
280 |
} |