LCOV - code coverage report
Current view: top level - frmts/pcidsk/sdk - pcidsk_gcp.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 0 86 0.0 %
Date: 2024-11-25 13:07:18 Functions: 0 23 0.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Purpose: Declaration of the PCIDSK::GCP class.
       4             :  *
       5             :  ******************************************************************************
       6             :  * Copyright (c) 2009
       7             :  * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada.
       8             :  *
       9             :  * SPDX-License-Identifier: MIT
      10             :  ****************************************************************************/
      11             : 
      12             : #ifndef INCLUDE_PCIDSK_SRC_GCP_H
      13             : #define INCLUDE_PCIDSK_SRC_GCP_H
      14             : 
      15             : #include "pcidsk_config.h"
      16             : 
      17             : #include <string>
      18             : #include <cstring>
      19             : 
      20             : namespace PCIDSK {
      21             :     /**
      22             :      * \brief PCIDSK Generic GCP Structure
      23             :      *
      24             :      * The PCIDSK::GCP class encompases all the possible field
      25             :      * combinations in the last two revisions of PCI's GCP segment
      26             :      * type.
      27             :      *
      28             :      * If a legacy GCP type is used, the additional information fields
      29             :      * will return empty values.
      30             :      */
      31             :     class PCIDSK_DLL GCP {
      32             :     public:
      33           0 :         GCP(double x, double y, double z,
      34             :             double line, double pix,
      35             :             std::string const& gcp_id,
      36             :             std::string const& map_units,
      37             :             std::string const& proj_parms = "",
      38             :             double xerr = 0.0, double yerr = 0.0, double zerr = 0.0,
      39             :             double line_err = 0.0, double pix_err = 0.0)
      40           0 :         {
      41           0 :             ground_point_[0] = x;
      42           0 :             ground_point_[1] = y;
      43           0 :             ground_point_[2] = z;
      44             : 
      45           0 :             ground_error_[0] = xerr;
      46           0 :             ground_error_[1] = yerr;
      47           0 :             ground_error_[2] = zerr;
      48             : 
      49           0 :             raster_point_[1] = line;
      50           0 :             raster_point_[0] = pix;
      51             : 
      52           0 :             raster_error_[1] = line_err;
      53           0 :             raster_error_[0] = pix_err;
      54             : 
      55           0 :             std::memset(gcp_id_, ' ', 64);
      56             : 
      57           0 :             std::strncpy(gcp_id_, gcp_id.c_str(),
      58           0 :                          gcp_id.size() > 64 ? 64 : gcp_id.size());
      59           0 :             gcp_id_[gcp_id.size() > 64 ? 64 : gcp_id.size()] = '\0';
      60             : 
      61           0 :             this->map_units_ = map_units;
      62           0 :             this->proj_parms_ = proj_parms;
      63             : 
      64           0 :             elevation_unit_ = EMetres;
      65           0 :             elevation_datum_ = EEllipsoidal;
      66           0 :             iscp_ = false; // default to GCPs
      67           0 :             isactive_ = true;
      68           0 :         }
      69             : 
      70           0 :         GCP(GCP const& gcp)
      71           0 :         {
      72           0 :             Copy(gcp);
      73           0 :         }
      74             : 
      75           0 :         GCP& operator=(GCP const& gcp)
      76             :         {
      77           0 :             Copy(gcp);
      78           0 :             return *this;
      79             :         }
      80             : 
      81             :         enum EElevationDatum
      82             :         {
      83             :             EMeanSeaLevel = 0,
      84             :             EEllipsoidal
      85             :         };
      86             : 
      87             :         enum EElevationUnit
      88             :         {
      89             :             EMetres = 0,
      90             :             EAmericanFeet,
      91             :             EInternationalFeet,
      92             :             EUnknown
      93             :         };
      94             : 
      95           0 :         void SetElevationUnit(EElevationUnit unit)
      96             :         {
      97           0 :             elevation_unit_ = unit;
      98           0 :         }
      99             : 
     100           0 :         void SetElevationDatum(EElevationDatum datum)
     101             :         {
     102           0 :             elevation_datum_ = datum;
     103           0 :         }
     104             : 
     105           0 :         void GetElevationInfo(EElevationDatum& datum, EElevationUnit& unit) const
     106             :         {
     107           0 :             unit = elevation_unit_;
     108           0 :             datum = elevation_datum_;
     109           0 :         }
     110             : 
     111           0 :         void SetCheckpoint(bool is_checkpoint)
     112             :         {
     113           0 :             if (is_checkpoint)
     114           0 :                 isactive_ = true;  // active doesn't apply to check points
     115           0 :             iscp_ = is_checkpoint;
     116           0 :         }
     117             : 
     118           0 :         bool IsCheckPoint(void) const
     119             :         {
     120           0 :             return iscp_;
     121             :         }
     122             : 
     123           0 :         void SetActive(bool is_active)
     124             :         {
     125           0 :             isactive_ = is_active;
     126           0 :             iscp_ = false; // active doesn't apply to check points
     127           0 :         }
     128             : 
     129           0 :         bool IsActive(void) const
     130             :         {
     131           0 :             return isactive_;
     132             :         }
     133             : 
     134           0 :         double GetX() const { return ground_point_[0]; }
     135           0 :         double GetXErr() const { return ground_error_[0]; }
     136           0 :         double GetY() const { return ground_point_[1]; }
     137           0 :         double GetYErr() const { return ground_error_[1]; }
     138           0 :         double GetZ() const { return ground_point_[2]; }
     139           0 :         double GetZErr() const { return ground_error_[2]; }
     140             : 
     141           0 :         double GetPixel() const { return raster_point_[0]; }
     142           0 :         double GetPixelErr() const { return raster_error_[0]; }
     143           0 :         double GetLine() const { return raster_point_[1]; }
     144           0 :         double GetLineErr() const { return raster_error_[1]; }
     145             : 
     146           0 :         void GetMapUnits(std::string& map_units, std::string& proj_parms) const
     147           0 :         { map_units = map_units_; proj_parms = proj_parms_;}
     148             :         void SetMapUnits(std::string const& map_units,
     149             :             std::string const& proj_parms) { map_units_ = map_units;
     150             :                                              proj_parms_ = proj_parms;}
     151             : 
     152           0 :         const char* GetIDString(void) const { return gcp_id_; }
     153             :     private:
     154           0 :         void Copy(GCP const& gcp)
     155             :         {
     156           0 :             ground_point_[0] = gcp.ground_point_[0];
     157           0 :             ground_point_[1] = gcp.ground_point_[1];
     158           0 :             ground_point_[2] = gcp.ground_point_[2];
     159             : 
     160           0 :             ground_error_[0] = gcp.ground_error_[0];
     161           0 :             ground_error_[1] = gcp.ground_error_[1];
     162           0 :             ground_error_[2] = gcp.ground_error_[2];
     163             : 
     164           0 :             raster_point_[0] = gcp.raster_point_[0];
     165           0 :             raster_point_[1] = gcp.raster_point_[1];
     166             : 
     167           0 :             raster_error_[0] = gcp.raster_error_[0];
     168           0 :             raster_error_[1] = gcp.raster_error_[1];
     169             : 
     170           0 :             this->map_units_ = gcp.map_units_;
     171           0 :             this->proj_parms_ = gcp.proj_parms_;
     172           0 :             this->iscp_ = gcp.iscp_;
     173           0 :             this->isactive_ = gcp.isactive_;
     174             : 
     175           0 :             std::strncpy(this->gcp_id_, gcp.gcp_id_, 64);
     176             : 
     177           0 :             this->gcp_id_[64] = '\0';
     178             : 
     179           0 :             this->elevation_unit_ = gcp.elevation_unit_;
     180           0 :             this->elevation_datum_ = gcp.elevation_datum_;
     181           0 :         }
     182             : 
     183             :         bool iscp_; // true = checkpoint, false = GCP
     184             :         bool isactive_; // true = active, false = inactive
     185             : 
     186             :         EElevationUnit elevation_unit_;
     187             :         EElevationDatum elevation_datum_;
     188             : 
     189             :         // Point information
     190             :         double ground_point_[3];
     191             :         double ground_error_[3]; // variances
     192             : 
     193             :         double raster_point_[2];
     194             :         double raster_error_[2];
     195             : 
     196             :         char gcp_id_[65];
     197             : 
     198             :         std::string map_units_; ///< PCI mapunits string
     199             :         std::string proj_parms_;  ///< PCI projection parameters string
     200             :     };
     201             : } // end namespace PCIDSK
     202             : 
     203             : #endif // INCLUDE_PCIDSK_SRC_GCP_H
     204             : 

Generated by: LCOV version 1.14