pcidsk_gcp.h

00001 #ifndef __INCLUDE_PCIDSK_SRC_GCP_H
00002 #define __INCLUDE_PCIDSK_SRC_GCP_H
00003 
00004 #include "pcidsk_config.h"
00005 
00006 #include <string>
00007 #include <cstring>
00008 
00009 namespace PCIDSK {
00020     class PCIDSK_DLL GCP {
00021     public:
00022         GCP(double x, double y, double z,
00023             double line, double pix,
00024             std::string const& gcp_id,
00025             std::string const& map_units, // TODO: Add ProjParms?
00026             double xerr = 0.0, double yerr = 0.0, double zerr = 0.0,
00027             double line_err = 0.0, double pix_err = 0.0)
00028         {
00029             ground_point_[0] = x;
00030             ground_point_[1] = y;
00031             ground_point_[2] = z;
00032             
00033             ground_error_[0] = xerr;
00034             ground_error_[1] = yerr;
00035             ground_error_[2] = zerr;
00036             
00037             raster_point_[1] = line;
00038             raster_point_[0] = pix;
00039             
00040             raster_error_[1] = line_err;
00041             raster_error_[0] = pix_err;
00042             
00043             std::strncpy(gcp_id_, gcp_id.c_str(),
00044                          gcp_id.size() > 64 ? 64 : gcp_id.size());
00045             gcp_id_[64] = '\0';
00046             
00047             this->map_units_ = map_units;
00048             
00049             elevation_unit_ = EMetres;
00050             elevation_datum_ = EEllipsoidal;
00051             iscp_ = false; // default to GCPs
00052         }
00053         
00054         GCP(GCP const& gcp)
00055         {
00056             Copy(gcp);
00057         }
00058         
00059         GCP& operator=(GCP const& gcp)
00060         {
00061             Copy(gcp);
00062             return *this;
00063         }
00064 
00065         enum EElevationDatum
00066         {
00067             EMeanSeaLevel = 0,
00068             EEllipsoidal
00069         };
00070         
00071         enum EElevationUnit
00072         {
00073             EMetres = 0,
00074             EAmericanFeet,
00075             EInternationalFeet,
00076             EUnknown
00077         };
00078         
00079         void SetElevationUnit(EElevationUnit unit)
00080         {
00081             elevation_unit_ = unit;
00082         }
00083         
00084         void SetElevationDatum(EElevationDatum datum)
00085         {
00086             elevation_datum_ = datum;
00087         }
00088         
00089         void GetElevationInfo(EElevationDatum& datum, EElevationUnit& unit) const
00090         {
00091             unit = elevation_unit_;
00092             datum = elevation_datum_;
00093         }
00094         
00095         void SetCheckpoint(bool is_checkpoint)
00096         {
00097             iscp_ = is_checkpoint;
00098         }
00099         
00100         bool IsCheckPoint(void) const
00101         {
00102             return iscp_;
00103         }
00104         
00105         double GetX() const { return ground_point_[0]; }
00106         double GetXErr() const { return ground_error_[0]; }
00107         double GetY() const { return ground_point_[1]; }
00108         double GetYErr() const { return ground_error_[1]; }
00109         double GetZ() const { return ground_point_[2]; }
00110         double GetZErr() const { return ground_error_[2]; }
00111         
00112         double GetPixel() const { return raster_point_[0]; }
00113         double GetPixelErr() const { return raster_error_[0]; }
00114         double GetLine() const { return raster_point_[1]; }
00115         double GetLineErr() const { return raster_error_[1]; }
00116         
00117         std::string const& GetMapUnits(void) const { return map_units_; }
00118         void SetMapUnits(std::string const& map_units) { map_units_ = map_units; }
00119         
00120         const char* GetIDString(void) const { return gcp_id_; }
00121     private:
00122         void Copy(GCP const& gcp)
00123         {
00124             ground_point_[0] = gcp.ground_point_[0];
00125             ground_point_[1] = gcp.ground_point_[1];
00126             ground_point_[2] = gcp.ground_point_[2];
00127             
00128             ground_error_[0] = gcp.ground_error_[0];
00129             ground_error_[1] = gcp.ground_error_[1];
00130             ground_error_[2] = gcp.ground_error_[2];
00131             
00132             raster_point_[0] = gcp.raster_point_[0];
00133             raster_point_[1] = gcp.raster_point_[1];
00134             
00135             raster_error_[0] = gcp.raster_error_[0];
00136             raster_error_[1] = gcp.raster_error_[1];
00137             
00138             this->map_units_ = gcp.map_units_;
00139             this->iscp_ = gcp.iscp_;
00140             
00141             std::strncpy(this->gcp_id_, gcp.gcp_id_, 64);
00142             
00143             this->gcp_id_[64] = '\0';
00144             
00145             this->elevation_unit_ = gcp.elevation_unit_;
00146             this->elevation_datum_ = gcp.elevation_datum_;
00147         }
00148         
00149         bool iscp_; // true = checkpoint, false = GCP
00150 
00151         EElevationUnit elevation_unit_;
00152         EElevationDatum elevation_datum_;
00153 
00154         // Point information
00155         double ground_point_[3];
00156         double ground_error_[3]; // variances
00157         
00158         double raster_point_[2];
00159         double raster_error_[2];
00160         
00161         char gcp_id_[65];
00162         
00163         std::string map_units_;
00164     };
00165 } // end namespace PCIDSK
00166 
00167 #endif // __INCLUDE_PCIDSK_SRC_GCP_H
00168 

Generated on Fri Jul 16 16:01:31 2010 for libpcidsk by  doxygen 1.5.1