1
/******************************************************************************
3
* Purpose: Declaration of the PCIDSK::GCP class.
5
******************************************************************************
7
* PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
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:
16
* The above copyright notice and this permission notice shall be included
17
* in all copies or substantial portions of the Software.
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
****************************************************************************/
28
#ifndef __INCLUDE_PCIDSK_SRC_GCP_H
29
#define __INCLUDE_PCIDSK_SRC_GCP_H
31
#include "pcidsk_config.h"
38
* \brief PCIDSK Generic GCP Structure
40
* The PCIDSK::GCP class encompases all the possible field
41
* combinations in the last two revisions of PCI's GCP segment
44
* If a legacy GCP type is used, the additional information fields
45
* will return empty values.
47
class PCIDSK_DLL GCP {
49
GCP(double x, double y, double z,
50
double line, double pix,
51
std::string const& gcp_id,
52
std::string const& map_units,
53
std::string const& proj_parms = "",
54
double xerr = 0.0, double yerr = 0.0, double zerr = 0.0,
55
double line_err = 0.0, double pix_err = 0.0)
61
ground_error_[0] = xerr;
62
ground_error_[1] = yerr;
63
ground_error_[2] = zerr;
65
raster_point_[1] = line;
66
raster_point_[0] = pix;
68
raster_error_[1] = line_err;
69
raster_error_[0] = pix_err;
71
std::memset(gcp_id_, ' ', 64);
73
std::strncpy(gcp_id_, gcp_id.c_str(),
74
gcp_id.size() > 64 ? 64 : gcp_id.size());
75
gcp_id_[gcp_id.size() > 64 ? 64 : gcp_id.size()] = '\0';
77
this->map_units_ = map_units;
78
this->proj_parms_ = proj_parms;
80
elevation_unit_ = EMetres;
81
elevation_datum_ = EEllipsoidal;
82
iscp_ = false; // default to GCPs
90
GCP& operator=(GCP const& gcp)
110
void SetElevationUnit(EElevationUnit unit)
112
elevation_unit_ = unit;
115
void SetElevationDatum(EElevationDatum datum)
117
elevation_datum_ = datum;
120
void GetElevationInfo(EElevationDatum& datum, EElevationUnit& unit) const
122
unit = elevation_unit_;
123
datum = elevation_datum_;
126
void SetCheckpoint(bool is_checkpoint)
128
iscp_ = is_checkpoint;
131
bool IsCheckPoint(void) const
136
double GetX() const { return ground_point_[0]; }
137
double GetXErr() const { return ground_error_[0]; }
138
double GetY() const { return ground_point_[1]; }
139
double GetYErr() const { return ground_error_[1]; }
140
double GetZ() const { return ground_point_[2]; }
141
double GetZErr() const { return ground_error_[2]; }
143
double GetPixel() const { return raster_point_[0]; }
144
double GetPixelErr() const { return raster_error_[0]; }
145
double GetLine() const { return raster_point_[1]; }
146
double GetLineErr() const { return raster_error_[1]; }
148
void GetMapUnits(std::string& map_units, std::string& proj_parms) const
149
{ map_units = map_units_; proj_parms = proj_parms_;}
150
void SetMapUnits(std::string const& map_units,
151
std::string const& proj_parms) { map_units_ = map_units;
152
proj_parms_ = proj_parms;}
154
const char* GetIDString(void) const { return gcp_id_; }
156
void Copy(GCP const& gcp)
158
ground_point_[0] = gcp.ground_point_[0];
159
ground_point_[1] = gcp.ground_point_[1];
160
ground_point_[2] = gcp.ground_point_[2];
162
ground_error_[0] = gcp.ground_error_[0];
163
ground_error_[1] = gcp.ground_error_[1];
164
ground_error_[2] = gcp.ground_error_[2];
166
raster_point_[0] = gcp.raster_point_[0];
167
raster_point_[1] = gcp.raster_point_[1];
169
raster_error_[0] = gcp.raster_error_[0];
170
raster_error_[1] = gcp.raster_error_[1];
172
this->map_units_ = gcp.map_units_;
173
this->proj_parms_ = gcp.proj_parms_;
174
this->iscp_ = gcp.iscp_;
176
std::strncpy(this->gcp_id_, gcp.gcp_id_, 64);
178
this->gcp_id_[64] = '\0';
180
this->elevation_unit_ = gcp.elevation_unit_;
181
this->elevation_datum_ = gcp.elevation_datum_;
184
bool iscp_; // true = checkpoint, false = GCP
186
EElevationUnit elevation_unit_;
187
EElevationDatum elevation_datum_;
190
double ground_point_[3];
191
double ground_error_[3]; // variances
193
double raster_point_[2];
194
double raster_error_[2];
198
std::string map_units_; ///< PCI mapunits string
199
std::string proj_parms_; ///< PCI projection parameters string
201
} // end namespace PCIDSK
203
#endif // __INCLUDE_PCIDSK_SRC_GCP_H