Line data Source code
1 : /******************************************************************************
2 : *
3 : * Purpose: PCIDSK Georeferencing information storage class. Declaration.
4 : *
5 : ******************************************************************************
6 : * Copyright (c) 2009
7 : * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada.
8 : *
9 : * Permission is hereby granted, free of charge, to any person obtaining a
10 : * copy of this software and associated documentation files (the "Software"),
11 : * to deal in the Software without restriction, including without limitation
12 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 : * and/or sell copies of the Software, and to permit persons to whom the
14 : * Software is furnished to do so, subject to the following conditions:
15 : *
16 : * The above copyright notice and this permission notice shall be included
17 : * in all copies or substantial portions of the Software.
18 : *
19 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 : * DEALINGS IN THE SOFTWARE.
26 : ****************************************************************************/
27 : #ifndef INCLUDE_PCIDSK_GEOREF_H
28 : #define INCLUDE_PCIDSK_GEOREF_H
29 :
30 : #include <string>
31 : #include <vector>
32 :
33 : namespace PCIDSK
34 : {
35 : typedef enum {
36 : UNIT_US_FOOT = 1,
37 : UNIT_METER = 2,
38 : UNIT_DEGREE = 4,
39 : UNIT_INTL_FOOT = 5
40 : } UnitCode;
41 :
42 : /************************************************************************/
43 : /* PCIDSKGeoref */
44 : /************************************************************************/
45 :
46 : //! Interface to PCIDSK georeferencing segment.
47 :
48 : class PCIDSK_DLL PCIDSKGeoref
49 : {
50 : public:
51 119 : virtual ~PCIDSKGeoref() {}
52 :
53 : /**
54 : \brief Get georeferencing transformation.
55 :
56 : Returns the affine georeferencing transform coefficients for this image.
57 : Used to map from pixel/line coordinates to georeferenced coordinates using
58 : the transformation:
59 :
60 : Xgeo = a1 + a2 * Xpix + xrot * Ypix
61 :
62 : Ygeo = b1 + yrot * Xpix + b2 * Ypix
63 :
64 : where Xpix and Ypix are pixel line locations with (0,0) being the top left
65 : corner of the top left pixel, and (0.5,0.5) being the center of the top left
66 : pixel. For an ungeoreferenced image the values will be
67 : (0.0,1.0,0.0,0.0,0.0,1.0).
68 :
69 : @param a1 returns easting of top left corner.
70 : @param a2 returns easting pixel size.
71 : @param xrot returns rotational coefficient, normally zero.
72 : @param b1 returns northing of the top left corner.
73 : @param yrot returns rotational coefficient, normally zero.
74 : @param b3 returns northing pixel size, normally negative indicating north-up.
75 :
76 : */
77 : virtual void GetTransform( double &a1, double &a2, double &xrot,
78 : double &b1, double &yrot, double &b3 ) = 0;
79 :
80 : /**
81 : \brief Fetch georeferencing string.
82 :
83 : Returns the short, 16 character, georeferencing string. This string is
84 : sufficient to document the coordinate system of simple coordinate
85 : systems (like "UTM 17 S D000"), while other coordinate systems are
86 : only fully defined with additional projection parameters.
87 :
88 : @return the georeferencing string.
89 :
90 : */
91 : virtual std::string GetGeosys() = 0;
92 :
93 : /**
94 : \brief Fetch projection parameters.
95 :
96 : Fetches the list of detailed projection parameters used for projection
97 : methods not fully described by the Geosys string. The projection
98 : parameters are as shown below, though in the future more items might
99 : be added to the array. The first 15 are the classic USGS GCTP parameters.
100 :
101 : <ul>
102 : <li> Param[0]: diameter of earth - major axis (meters).
103 : <li> Param[1]: diameter of earth - minor axis (meters).
104 : <li> Param[2]: Reference Longitude (degrees)
105 : <li> Param[3]: Reference Latitude (degrees)
106 : <li> Param[4]: Standard Parallel 1 (degrees)
107 : <li> Param[5]: Standard Parallel 2 (degrees)
108 : <li> Param[6]: False Easting (meters?)
109 : <li> Param[7]: False Northing (meters?)
110 : <li> Param[8]: Scale (unitless)
111 : <li> Param[9]: Height (meters?)
112 : <li> Param[10]: Longitude 1 (degrees)
113 : <li> Param[11]: Latitude 1 (degrees)
114 : <li> Param[12]: Longitude 2 (degrees)
115 : <li> Param[13]: Latitude 2 (degrees)
116 : <li> Param[14]: Azimuth (degrees)
117 : <li> Param[15]: Landsat Number
118 : <li> Param[16]: Landsat Path
119 : <li> Param[17]: Unit Code (1=US Foot, 2=Meter, 4=Degree, 5=Intl Foot).
120 : </ul>
121 :
122 : Review the PCIDSK Database Reference Manual to understand which parameters
123 : apply to which projection methods.
124 :
125 : @return an array of values, at least 18.
126 : */
127 :
128 : virtual std::vector<double> GetParameters() = 0;
129 :
130 : /**
131 : \brief Write simple georeferencing information
132 :
133 : Writes out a georeferencing string and geotransform to the segment.
134 :
135 : @param geosys 16 character coordinate system, like "UTM 17 S D000".
136 : @param a1 easting of top left corner.
137 : @param a2 easting pixel size.
138 : @param xrot rotational coefficient, normally zero.
139 : @param b1 northing of the top left corner.
140 : @param yrot rotational coefficient, normally zero.
141 : @param b3 northing pixel size, normally negative indicating north-up.
142 :
143 : */
144 : virtual void WriteSimple( std::string const& geosys,
145 : double a1, double a2, double xrot,
146 : double b1, double yrot, double b3 ) = 0;
147 :
148 : /**
149 : \brief Write complex projection parameters.
150 :
151 : See GetParameters() for the description of the parameters list.
152 :
153 : @param parameters A list of at least 17 projection parameters.
154 :
155 : */
156 :
157 : virtual void WriteParameters( std::vector<double> const& parameters ) = 0;
158 : };
159 : } // end namespace PCIDSK
160 :
161 : #endif // INCLUDE_PCIDSK_GEOREF_H
|