Statistics
| Revision:

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 @ 795

History | View | Annotate | Download (8.06 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
     * FIXME: GeoAPI
111
     * Returns a <cite>Well-Known Text</cite> (WKT) for this object.
112
     * Well-Known Texts (WKT) may come in two formats:
113
     *
114
     * <ul>
115
     *   <li>The current standard, WKT 2, is defined by ISO 19162.</li>
116
     *   <li>The legacy format, WKT 1, was defined by {@linkplain org.opengis.annotation.Specification#OGC_01009 OGC 01-009}
117
     *       and is shown using Extended Backus Naur Form (EBNF) <a href="doc-files/WKT.html">here</a>.</li>
118
     * </ul>
119
     *
120
     * Implementations are encouraged to format according the most recent standard.
121
     * This operation may fail if unsupported or if this instance contains elements that do not have
122
     * WKT representation.
123
     *
124
     * @return the Well-Known Text (WKT) for this object.
125
     * @throws UnsupportedOperationException if this object can not be formatted as WKT.
126
     *
127
     * @departure extension
128
     *   This method is not part of the OGC specification. It has been added in order to provide
129
     *   the converse of the <code>CRSFactory.createFromWKT(String)</code> method, which is
130
     *   defined in OGC 01-009.
131
     *
132
     * @see org.opengis.referencing.crs.CRSFactory#createFromWKT(String)
133
     */
134
        String toWKT() throws UnsupportedOperationException;
135
        
136
        /**
137
        * FIXME: GeoAPI & review definition
138
    * The ordered list of coordinate reference systems.
139
    *
140
    * @return the ordered list of coordinate reference systems.
141
    *
142
    * @departure generalization
143
    *   ISO 19111 said <cite>"nesting of compound CRSs shall not be permitted; the individual single systems
144
    *   shall be aggregated together"</cite>. However this approach causes data lost: it is difficult to add
145
    *   a temporal CRS to an existing three-dimensional compound CRS without loosing the name and identifiers
146
    *   of the 3D CRS, unless nesting is permitted. It is programmatically easier to convert nested CRSs to a
147
    *   flat list of single CRSs when needed than to reconstruct the 3D CRS from the single components.
148
    *   Consequently GeoAPI has been keep conformant with the legacy OGC 01-009 specification in this aspect,
149
    *   which were allowing nested compound CRS.
150
    *
151
    * @since 2.3
152
    */
153
        List<CRSDefinition> getComponents();
154
        
155
        /**
156
         * Gets the number of axis of the associated CoordinateSystem
157
         * 
158
         * @return
159
         */
160
        int getAxisCount();
161
        
162
        /**
163
         * Returns the axis for the associated coordinate system at the specified dimension,
164
         * as officially defined by the authority. 
165
         * 
166
         * @param dimension
167
         * @return
168
         * @throws IndexOutOfBoundsException
169
         */
170
        CoordinateSystemAxis getAxis(int dimension) throws IndexOutOfBoundsException;
171
        
172
        /**
173
         * Returns the axis for the associated coordinate system at the specified
174
         * dimension as internally used by gvSIG, which will sometimes differ from
175
         * the order officially defined by the authority.
176
         * 
177
         * The internal order is used for convenience and performance. gvSIG geometries
178
         * and gvSIG coordinate transformations always expect coordinates to be provided
179
         * using the internal order (xy axis order). However, some
180
         * protocols or formats require the coordinates to be encoded using the
181
         * official order. 
182
         * 
183
         * @param dimension
184
         * @return
185
         * @throws IndexOutOfBoundsException
186
         */
187
        CoordinateSystemAxis getAxisInternal(int dimension) throws IndexOutOfBoundsException;
188
        
189
    /**
190
     * For derived CRSs, it returns the base coordinate reference system.
191
     *
192
     * @return the base coordinate reference system or null if the CRS is not
193
     * derived
194
     * @see CRSType#isDerived()
195
     * @see CRSType#ProjectedCRSType
196
     * @see CRSType#OtherDerivedCRSType
197
     */
198
        CRSDefinition getBaseCRS();
199

    
200
    /**
201
     * For derived CRSs, it returns the conversion from the {@linkplain #getBaseCRS() base CRS}
202
     * to this CRS.
203
     *
204
     * @return the conversion from the base CRS or null if the CRS is not derived
205
     *
206
     * @see CRSType#isDerived()
207
     * @see CRSType#ProjectedCRSType
208
     * @see CRSType#OtherDerivedCRSType
209
     */
210
        TransformationDefinition getConversionFromBase();
211
        
212
    /**
213
     * Returns the datum associated directly or indirectly to this CRS.
214
     * In the case of a derived CRS, this method returns the
215
     * datum of the {@linkplain #getBaseCRS() base CRS}. In the case of
216
     * a compound CRS, it returns the datum associated to the horizontal component.
217
     *
218
     * @return the datum
219
     */
220
    Datum getDatum();
221
}