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 : * SPDX-License-Identifier: MIT 10 : ****************************************************************************/ 11 : #ifndef INCLUDE_PCIDSK_GEOREF_H 12 : #define INCLUDE_PCIDSK_GEOREF_H 13 : 14 : #include <string> 15 : #include <vector> 16 : 17 : namespace PCIDSK 18 : { 19 : typedef enum { 20 : UNIT_US_FOOT = 1, 21 : UNIT_METER = 2, 22 : UNIT_DEGREE = 4, 23 : UNIT_INTL_FOOT = 5 24 : } UnitCode; 25 : 26 : /************************************************************************/ 27 : /* PCIDSKGeoref */ 28 : /************************************************************************/ 29 : 30 : //! Interface to PCIDSK georeferencing segment. 31 : 32 : class PCIDSK_DLL PCIDSKGeoref 33 : { 34 : public: 35 119 : virtual ~PCIDSKGeoref() {} 36 : 37 : /** 38 : \brief Get georeferencing transformation. 39 : 40 : Returns the affine georeferencing transform coefficients for this image. 41 : Used to map from pixel/line coordinates to georeferenced coordinates using 42 : the transformation: 43 : 44 : Xgeo = a1 + a2 * Xpix + xrot * Ypix 45 : 46 : Ygeo = b1 + yrot * Xpix + b2 * Ypix 47 : 48 : where Xpix and Ypix are pixel line locations with (0,0) being the top left 49 : corner of the top left pixel, and (0.5,0.5) being the center of the top left 50 : pixel. For an ungeoreferenced image the values will be 51 : (0.0,1.0,0.0,0.0,0.0,1.0). 52 : 53 : @param a1 returns easting of top left corner. 54 : @param a2 returns easting pixel size. 55 : @param xrot returns rotational coefficient, normally zero. 56 : @param b1 returns northing of the top left corner. 57 : @param yrot returns rotational coefficient, normally zero. 58 : @param b3 returns northing pixel size, normally negative indicating north-up. 59 : 60 : */ 61 : virtual void GetTransform( double &a1, double &a2, double &xrot, 62 : double &b1, double &yrot, double &b3 ) = 0; 63 : 64 : /** 65 : \brief Fetch georeferencing string. 66 : 67 : Returns the short, 16 character, georeferencing string. This string is 68 : sufficient to document the coordinate system of simple coordinate 69 : systems (like "UTM 17 S D000"), while other coordinate systems are 70 : only fully defined with additional projection parameters. 71 : 72 : @return the georeferencing string. 73 : 74 : */ 75 : virtual std::string GetGeosys() = 0; 76 : 77 : /** 78 : \brief Fetch projection parameters. 79 : 80 : Fetches the list of detailed projection parameters used for projection 81 : methods not fully described by the Geosys string. The projection 82 : parameters are as shown below, though in the future more items might 83 : be added to the array. The first 15 are the classic USGS GCTP parameters. 84 : 85 : <ul> 86 : <li> Param[0]: diameter of earth - major axis (meters). 87 : <li> Param[1]: diameter of earth - minor axis (meters). 88 : <li> Param[2]: Reference Longitude (degrees) 89 : <li> Param[3]: Reference Latitude (degrees) 90 : <li> Param[4]: Standard Parallel 1 (degrees) 91 : <li> Param[5]: Standard Parallel 2 (degrees) 92 : <li> Param[6]: False Easting (meters?) 93 : <li> Param[7]: False Northing (meters?) 94 : <li> Param[8]: Scale (unitless) 95 : <li> Param[9]: Height (meters?) 96 : <li> Param[10]: Longitude 1 (degrees) 97 : <li> Param[11]: Latitude 1 (degrees) 98 : <li> Param[12]: Longitude 2 (degrees) 99 : <li> Param[13]: Latitude 2 (degrees) 100 : <li> Param[14]: Azimuth (degrees) 101 : <li> Param[15]: Landsat Number 102 : <li> Param[16]: Landsat Path 103 : <li> Param[17]: Unit Code (1=US Foot, 2=Meter, 4=Degree, 5=Intl Foot). 104 : </ul> 105 : 106 : Review the PCIDSK Database Reference Manual to understand which parameters 107 : apply to which projection methods. 108 : 109 : @return an array of values, at least 18. 110 : */ 111 : 112 : virtual std::vector<double> GetParameters() = 0; 113 : 114 : /** 115 : \brief Write simple georeferencing information 116 : 117 : Writes out a georeferencing string and geotransform to the segment. 118 : 119 : @param geosys 16 character coordinate system, like "UTM 17 S D000". 120 : @param a1 easting of top left corner. 121 : @param a2 easting pixel size. 122 : @param xrot rotational coefficient, normally zero. 123 : @param b1 northing of the top left corner. 124 : @param yrot rotational coefficient, normally zero. 125 : @param b3 northing pixel size, normally negative indicating north-up. 126 : 127 : */ 128 : virtual void WriteSimple( std::string const& geosys, 129 : double a1, double a2, double xrot, 130 : double b1, double yrot, double b3 ) = 0; 131 : 132 : /** 133 : \brief Write complex projection parameters. 134 : 135 : See GetParameters() for the description of the parameters list. 136 : 137 : @param parameters A list of at least 17 projection parameters. 138 : 139 : */ 140 : 141 : virtual void WriteParameters( std::vector<double> const& parameters ) = 0; 142 : }; 143 : } // end namespace PCIDSK 144 : 145 : #endif // INCLUDE_PCIDSK_GEOREF_H