From 4a874334caaeed3cfb784cec9ccd12010d4c834f Mon Sep 17 00:00:00 2001 From: acpaquette <acpaquette@usgs.gov> Date: Tue, 4 Apr 2023 14:50:39 -0700 Subject: [PATCH] Removed a bunch of child class redundent functions --- .../usgscsm/UsgsAstroProjectedLsSensorModel.h | 410 +----------------- src/UsgsAstroProjectedLsSensorModel.cpp | 409 +---------------- 2 files changed, 7 insertions(+), 812 deletions(-) diff --git a/include/usgscsm/UsgsAstroProjectedLsSensorModel.h b/include/usgscsm/UsgsAstroProjectedLsSensorModel.h index a51cb7b..56b6fbb 100644 --- a/include/usgscsm/UsgsAstroProjectedLsSensorModel.h +++ b/include/usgscsm/UsgsAstroProjectedLsSensorModel.h @@ -25,23 +25,21 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ #define INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ -#include <CorrelationModel.h> #include <RasterGM.h> #include <SettableEllipsoid.h> -#include "Distortion.h" -#include "UsgsAstroLsSensorModel.h" #include<utility> #include<memory> #include<string> #include<vector> -#include "ale/Distortion.h" #include "ale/Orientations.h" #include "ale/States.h" #include "spdlog/spdlog.h" +#include "UsgsAstroLsSensorModel.h" + class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { public: // Initializes the class from state data as formatted @@ -80,11 +78,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { static const std::string _SENSOR_MODEL_NAME; // state date element 0 static const std::string _STATE_KEYWORD[]; - static const int NUM_PARAM_TYPES; - static const std::string PARAM_STRING_ALL[]; - static const csm::param::Type PARAM_CHAR_ALL[]; - static const int NUM_PARAMETERS; - static const std::string PARAMETER_NAME[]; // Set to default values void reset(); @@ -247,272 +240,9 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { // possible. //< - //--- - // Monoscopic Mensuration - //--- - virtual csm::ImageCoord getImageStart() const; - //> This method returns the starting coordinate (line, sample in full - // image space pixels) for the imaging operation. Typically (0,0). - //< - - virtual csm::ImageVector getImageSize() const; - //> This method returns the number of lines and samples in full image - // space pixels for the imaging operation. - // - // Note that the model might not be valid over the entire imaging - // operation. Use getValidImageRange() to get the valid range of image - // coordinates. - //< - - virtual std::pair<csm::ImageCoord, csm::ImageCoord> getValidImageRange() - const; - //> This method returns the minimum and maximum image coordinates - // (line, sample in full image space pixels), respectively, over which - // the current model is valid. The image coordinates define opposite - // corners of a rectangle whose sides are parallel to the line and - // sample axes. - // - // The valid image range does not always match the full image - // coverage as returned by the getImageStart and getImageSize methods. - // - // Used in conjunction with the getValidHeightRange method, it is - // possible to determine the full range of ground coordinates over which - // the model is valid. - //< - - virtual std::pair<double, double> getValidHeightRange() const; - //> This method returns the minimum and maximum heights (in meters - // relative to WGS-84 ellipsoid), respectively, over which the model is - // valid. For example, a model for an airborne platform might not be - // designed to return valid coordinates for heights above the aircraft. - // - // If there are no limits defined for the model, (-99999.0,99999.0) - // will be returned. - //< - - //--- - // Time and Trajectory - //--- - - virtual const csm::CorrelationModel& getCorrelationModel() const; - //> This method returns a reference to a CorrelationModel. - // The CorrelationModel is used to determine the correlation between - // the model parameters of different models of the same type. - // These correlations are used to establish the "a priori" cross-covariance - // between images. While some applications (such as generation of a - // replacement sensor model) may wish to call this method directly, - // it is reccommended that the inherited method - // GeometricModel::getCrossCovarianceMatrix() be called instead. - //< - - virtual std::vector<double> getUnmodeledCrossCovariance( - const csm::ImageCoord& pt1, const csm::ImageCoord& pt2) const; - //> This method returns the 2x2 line and sample cross covariance - // (in pixels squared) between the given imagePt1 and imagePt2 for any - // model error not accounted for by the model parameters. The error is - // reported as the four terms of a 2x2 matrix, returned as a 4 element - // vector. - //< - - virtual csm::EcefCoord getReferencePoint() const; - //> This method returns the ground point indicating the general - // location of the image. - //< - - virtual void setReferencePoint(const csm::EcefCoord& groundPt); - //> This method sets the ground point indicating the general location - // of the image. - //< - - //--- - // Sensor Model Parameters - //--- - virtual int getNumParameters() const; - //> This method returns the number of adjustable parameters. - //< - - virtual std::string getParameterName(int index) const; - //> This method returns the name for the adjustable parameter - // indicated by the given index. - // - // If the index is out of range, a csm::Error may be thrown. - //< - - virtual std::string getParameterUnits(int index) const; - //> This method returns the units for the adjustable parameter - // indicated by the given index. This string is intended for human - // consumption, not automated analysis. Preferred unit names are: - // - //- meters "m" - //- centimeters "cm" - //- millimeters "mm" - //- micrometers "um" - //- nanometers "nm" - //- kilometers "km" - //- inches-US "inch" - //- feet-US "ft" - //- statute miles "mi" - //- nautical miles "nmi" - //- - //- radians "rad" - //- microradians "urad" - //- decimal degrees "deg" - //- arc seconds "arcsec" - //- arc minutes "arcmin" - //- - //- seconds "sec" - //- minutes "min" - //- hours "hr" - //- - //- steradian "sterad" - //- - //- none "unitless" - //- - //- lines per second "lines/sec" - //- samples per second "samples/sec" - //- frames per second "frames/sec" - //- - //- watts "watt" - //- - //- degrees Kelvin "K" - //- - //- gram "g" - //- kilogram "kg" - //- pound - US "lb" - //- - //- hertz "hz" - //- megahertz "mhz" - //- gigahertz "ghz" - // - // Units may be combined with "/" or "." to indicate division or - // multiplication. The caret symbol "^" can be used to indicate - // exponentiation. Thus "m.m" and "m^2" are the same and indicate - // square meters. The return "m/sec^2" indicates an acceleration in - // meters per second per second. - // - // Derived classes may choose to return additional unit names, as - // required. - //< - - virtual bool hasShareableParameters() const; - //> This method returns true if there exists at least one adjustable - // parameter on the model that is shareable. See the - // isParameterShareable() method. This method should return false if - // all calls to isParameterShareable() return false. - //< - - virtual bool isParameterShareable(int index) const; - //> This method returns a flag to indicate whether or not the adjustable - // parameter referenced by index is shareable across models. - //< - - virtual csm::SharingCriteria getParameterSharingCriteria(int index) const; - //> This method returns characteristics to indicate how the adjustable - // parameter referenced by index is shareable across models. - //< - - virtual double getParameterValue(int index) const; - //> This method returns the value of the adjustable parameter - // referenced by the given index. - //< - - virtual void setParameterValue(int index, double value); - //> This method sets the value for the adjustable parameter referenced by - // the given index. - //< - - virtual csm::param::Type getParameterType(int index) const; - //> This method returns the type of the adjustable parameter - // referenced by the given index. - //< - - virtual void setParameterType(int index, csm::param::Type pType); - //> This method sets the type of the adjustable parameter - // reference by the given index. - //< - - virtual std::shared_ptr<spdlog::logger> getLogger(); - virtual void setLogger(std::string logName); - - //--- - // Uncertainty Propagation - //--- - virtual double getParameterCovariance(int index1, int index2) const; - //> This method returns the covariance between the parameters - // referenced by index1 and index2. Variance of a single parameter - // is indicated by specifying the samve value for index1 and index2. - //< - - virtual void setParameterCovariance(int index1, int index2, - double covariance); - //> This method is used to set the covariance between the parameters - // referenced by index1 and index2. Variance of a single parameter - // is indicated by specifying the samve value for index1 and index2. - //< - //--- // Error Correction //--- - virtual int getNumGeometricCorrectionSwitches() const; - //> This method returns the number of geometric correction switches - // implemented for the current model. - //< - - virtual std::string getGeometricCorrectionName(int index) const; - //> This method returns the name for the geometric correction switch - // referenced by the given index. - //< - - virtual void setGeometricCorrectionSwitch(int index, bool value, - csm::param::Type pType); - //> This method is used to enable/disable the geometric correction switch - // referenced by the given index. - //< - - virtual bool getGeometricCorrectionSwitch(int index) const; - //> This method returns the value of the geometric correction switch - // referenced by the given index. - //< - - virtual std::vector<double> getCrossCovarianceMatrix( - const csm::GeometricModel& comparisonModel, - csm::param::Set pSet = csm::param::VALID, - const csm::GeometricModel::GeometricModelList& otherModels = - csm::GeometricModel::GeometricModelList()) const; - //> This method returns a matrix containing the elements of the error - // cross covariance between this model and a given second model - // (comparisonModel). The set of cross covariance elements returned is - // indicated by pSet, which, by default, is all VALID parameters. - // - // If comparisonModel is the same as this model, the covariance for - // this model will be returned. It is equivalent to calling - // getParameterCovariance() for the same set of elements. Note that - // even if the cross covariance for a particular model type is always - // zero, the covariance for this model must still be supported. - // - // The otherModels list contains all of the models in the current - // photogrammetric process; some cross-covariance implementations are - // influenced by other models. It can be omitted if it is not needed - // by any models being used. - // - // The returned vector will logically be a two-dimensional matrix of - // covariances, though for simplicity it is stored in a one-dimensional - // vector (STL has no two-dimensional structure). The height (number of - // rows) of this matrix is the number of parameters on the current model, - // and the width (number of columns) is the number of parameters on - // the comparison model. Thus, the covariance between p1 on this model - // and p2 on the comparison model is found in index (N*p1 + p2) - // in the returned vector. N is the size of the vector returned by - // getParameterSetIndices() on the comparison model for the given pSet). - // - // Note that cross covariance is often zero. Non-zero cross covariance - // can occur for models created from the same sensor (or different - // sensors on the same platform). While cross covariances can result - // from a bundle adjustment involving multiple models, no mechanism - // currently exists within csm to "set" the cross covariance between - // models. It should thus be assumed that the returned cross covariance - // reflects the "un-adjusted" state of the models. - //< virtual csm::Version getVersion() const; //> This method returns the version of the model code. The Version @@ -531,142 +261,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { // model created from the same sensor's support data would produce // different pedigrees for each case. //< - - //--- - // Basic collection information - //--- - virtual std::string getImageIdentifier() const; - //> This method returns an identifier to uniquely indicate the imaging - // operation associated with this model. - // This is the primary identifier of the model. - // - // This method may return an empty string if the ID is unknown. - //< - - virtual void setImageIdentifier(const std::string& imageId, - csm::WarningList* warnings = NULL); - //> This method sets an identifier to uniquely indicate the imaging - // operation associated with this model. Typically used for models - // whose initialization does not produce an adequate identifier. - // - // If a non-NULL warnings argument is received, it will be populated - // as applicable. - //< - - virtual std::string getSensorIdentifier() const; - //> This method returns an identifier to indicate the specific sensor - // that was used to acquire the image. This ID must be unique among - // sensors for a given model name. It is used to determine parameter - // correlation and sharing. Equivalent to camera or mission ID. - // - // This method may return an empty string if the sensor ID is unknown. - //< - - virtual std::string getPlatformIdentifier() const; - //> This method returns an identifier to indicate the specific platform - // that was used to acquire the image. This ID must unique among - // platforms for a given model name. It is used to determine parameter - // correlation sharing. Equivalent to vehicle or aircraft tail number. - // - // This method may return an empty string if the platform ID is unknown. - //< - - virtual std::string getCollectionIdentifier() const; - //> This method returns an identifer to indicate a collection activity - // common to a set of images. This ID must be unique among collection - // activities for a given model name. It is used to determine parameter - // correlation and sharing. - //< - - virtual std::string getTrajectoryIdentifier() const; - //> This method returns an identifier to indicate a trajectory common - // to a set of images. This ID must be unique among trajectories - // for a given model name. It is used to determine parameter - // correlation and sharing. - //< - - virtual std::string getSensorType() const; - //> This method returns a description of the sensor type (EO, IR, SAR, - // etc). See csm.h for a list of common types. Should return - // CSM_SENSOR_TYPE_UNKNOWN if the sensor type is unknown. - //< - - virtual std::string getSensorMode() const; - //> This method returns a description of the sensor mode (FRAME, - // PUSHBROOM, SPOT, SCAN, etc). See csm.h for a list of common modes. - // Should return CSM_SENSOR_MODE_UNKNOWN if the sensor mode is unknown. - //< - - virtual std::string getReferenceDateAndTime() const; - //> This method returns an approximate date and time at which the - // image was taken. The returned string follows the ISO 8601 standard. - // - //- Precision Format Example - //- year yyyy "1961" - //- month yyyymm "196104" - //- day yyyymmdd "19610420" - //- hour yyyymmddThh "19610420T20" - //- minute yyyymmddThhmm "19610420T2000" - //- second yyyymmddThhmmss "19610420T200000" - //< - - //--- - // Sensor Model State - //--- - // virtual std::string setModelState(std::string stateString) const; - //> This method returns a string containing the data to exactly recreate - // the current model. It can be used to restore this model to a - // previous state with the replaceModelState method or create a new - // model object that is identical to this model. - // The string could potentially be saved to a file for later use. - // An empty string is returned if it is not possible to save the - // current state. - //< - - private: - - // Some state data values not found in the support data require a - // sensor model in order to be set. - void updateState(); - - // This method returns the value of the specified adjustable parameter - // with the associated adjustment added in. - double getValue(int index, const std::vector<double>& adjustments) const; - - void reconstructSensorDistortion(double& focalX, double& focalY, - const double& desiredPrecision) const; - - // Computes the LOS correction due to light aberration - void lightAberrationCorr(const double& vx, const double& vy, const double& vz, - const double& xl, const double& yl, const double& zl, - double& dxl, double& dyl, double& dzl) const; - - // Intersects a LOS at a specified height above the ellipsoid. - void losEllipsoidIntersect(const double& height, const double& xc, - const double& yc, const double& zc, - const double& xl, const double& yl, - const double& zl, double& x, double& y, double& z, - double& achieved_precision, - const double& desired_precision, - csm::WarningList* warnings = NULL) const; - - // Computes the imaging locus that would view a ground point at a specific - // time. Computationally, this is the opposite of losToEcf. - std::vector<double> computeDetectorView( - const double& time, // The time to use the EO at - const csm::EcefCoord& groundPoint, // The ground coordinate - const std::vector<double>& adj) // Parameter Adjustments for partials - const; - - csm::NoCorrelationModel _no_corr_model; // A way to report no correlation - // between images is supported - std::vector<double> _no_adjustment; // A vector of zeros indicating no internal adjustment - - // Store here the projective approximation of the sensor model - std::vector<double> m_projTransCoeffs; - - // Flag indicating if an initial approximation is used - bool m_useApproxInitTrans; }; #endif // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ diff --git a/src/UsgsAstroProjectedLsSensorModel.cpp b/src/UsgsAstroProjectedLsSensorModel.cpp index 3ffc98b..9b0c361 100644 --- a/src/UsgsAstroProjectedLsSensorModel.cpp +++ b/src/UsgsAstroProjectedLsSensorModel.cpp @@ -23,15 +23,7 @@ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISI OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ #include "UsgsAstroProjectedLsSensorModel.h" -#include "Distortion.h" #include "Utilities.h" -#include "EigenUtilities.h" - -#include <float.h> -#include <math.h> -#include <algorithm> -#include <iostream> -#include <sstream> #include <proj.h> @@ -40,8 +32,8 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ale/Util.h" -#define MESSAGE_LOG(...) \ - if (m_logger) { \ +#define MESSAGE_LOG(...) \ + if (m_logger) { \ m_logger->log(__VA_ARGS__); \ } @@ -49,25 +41,6 @@ using json = nlohmann::json; const std::string UsgsAstroProjectedLsSensorModel::_SENSOR_MODEL_NAME = "USGS_ASTRO_PROJECTED_LINE_SCANNER_SENSOR_MODEL"; -const int UsgsAstroProjectedLsSensorModel::NUM_PARAMETERS = 16; -const std::string UsgsAstroProjectedLsSensorModel::PARAMETER_NAME[] = { - "IT Pos. Bias ", // 0 - "CT Pos. Bias ", // 1 - "Rad Pos. Bias ", // 2 - "IT Vel. Bias ", // 3 - "CT Vel. Bias ", // 4 - "Rad Vel. Bias ", // 5 - "Omega Bias ", // 6 - "Phi Bias ", // 7 - "Kappa Bias ", // 8 - "Omega Rate ", // 9 - "Phi Rate ", // 10 - "Kappa Rate ", // 11 - "Omega Accl ", // 12 - "Phi Accl ", // 13 - "Kappa Accl ", // 14 - "Focal Bias " // 15 -}; const std::string UsgsAstroProjectedLsSensorModel::_STATE_KEYWORD[] = { "m_modelName", @@ -123,13 +96,6 @@ const std::string UsgsAstroProjectedLsSensorModel::_STATE_KEYWORD[] = { "m_projString", }; -const int UsgsAstroProjectedLsSensorModel::NUM_PARAM_TYPES = 4; -const std::string UsgsAstroProjectedLsSensorModel::PARAM_STRING_ALL[] = { - "NONE", "FICTITIOUS", "REAL", "FIXED"}; -const csm::param::Type UsgsAstroProjectedLsSensorModel::PARAM_CHAR_ALL[] = { - csm::param::NONE, csm::param::FICTITIOUS, csm::param::REAL, - csm::param::FIXED}; - //*************************************************************************** // UsgsAstroLineScannerSensorModel::replaceModelState //*************************************************************************** @@ -212,18 +178,12 @@ void UsgsAstroProjectedLsSensorModel::reset() { //***************************************************************************** // UsgsAstroProjectedLsSensorModel Constructor //***************************************************************************** -UsgsAstroProjectedLsSensorModel::UsgsAstroProjectedLsSensorModel() { - _no_adjustment.assign(UsgsAstroProjectedLsSensorModel::NUM_PARAMETERS, 0.0); -} +UsgsAstroProjectedLsSensorModel::UsgsAstroProjectedLsSensorModel() : UsgsAstroLsSensorModel() {} //***************************************************************************** // UsgsAstroProjectedLsSensorModel Destructor //***************************************************************************** -UsgsAstroProjectedLsSensorModel::~UsgsAstroProjectedLsSensorModel() { - if (m_logger) { - m_logger->flush(); - } -} +UsgsAstroProjectedLsSensorModel::~UsgsAstroProjectedLsSensorModel() {} //--------------------------------------------------------------------------- // Core Photogrammetry @@ -393,118 +353,6 @@ csm::EcefLocus UsgsAstroProjectedLsSensorModel::imageToRemoteImagingLocus( return UsgsAstroLsSensorModel::imageToRemoteImagingLocus(cameraImagePt, desired_precision, achieved_precision, warnings); } -//--------------------------------------------------------------------------- -// Uncertainty Propagation -//--------------------------------------------------------------------------- - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getParameterCovariance -//*************************************************************************** -double UsgsAstroProjectedLsSensorModel::getParameterCovariance(int index1, - int index2) const { - int index = UsgsAstroProjectedLsSensorModel::NUM_PARAMETERS * index1 + index2; - - MESSAGE_LOG( - spdlog::level::debug, - "getParameterCovariance for {} {} is {}", - index1, index2, m_covariance[index]) - - return m_covariance[index]; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setParameterCovariance -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setParameterCovariance(int index1, int index2, - double covariance) { - int index = UsgsAstroProjectedLsSensorModel::NUM_PARAMETERS * index1 + index2; - - MESSAGE_LOG( - spdlog::level::debug, - "setParameterCovariance for {} {} is {}", - index1, index2, m_covariance[index]) - - m_covariance[index] = covariance; -} - -//--------------------------------------------------------------------------- -// Time and Trajectory -//--------------------------------------------------------------------------- - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getTrajectoryIdentifier -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getTrajectoryIdentifier() const { - return "UNKNOWN"; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getReferenceDateAndTime -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getReferenceDateAndTime() const { - csm::EcefCoord referencePointGround = - UsgsAstroProjectedLsSensorModel::getReferencePoint(); - csm::ImageCoord referencePointImage = - UsgsAstroProjectedLsSensorModel::groundToImage(referencePointGround); - double relativeTime = - UsgsAstroProjectedLsSensorModel::getImageTime(referencePointImage); - time_t ephemTime = m_centerEphemerisTime + relativeTime; - - return ephemTimeToCalendarTime(ephemTime); -} - -//--------------------------------------------------------------------------- -// Sensor Model Parameters -//--------------------------------------------------------------------------- - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setParameterValue -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setParameterValue(int index, double value) { - m_currentParameterValue[index] = value; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getParameterValue -//*************************************************************************** -double UsgsAstroProjectedLsSensorModel::getParameterValue(int index) const { - return m_currentParameterValue[index]; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getParameterName -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getParameterName(int index) const { - return PARAMETER_NAME[index]; -} - -std::string UsgsAstroProjectedLsSensorModel::getParameterUnits(int index) const { - // All parameters are meters or scaled to meters - return "m"; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getNumParameters -//*************************************************************************** -int UsgsAstroProjectedLsSensorModel::getNumParameters() const { - return UsgsAstroProjectedLsSensorModel::NUM_PARAMETERS; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getParameterType -//*************************************************************************** -csm::param::Type UsgsAstroProjectedLsSensorModel::getParameterType(int index) const { - return m_parameterType[index]; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setParameterType -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setParameterType(int index, - csm::param::Type pType) { - m_parameterType[index] = pType; -} - //--------------------------------------------------------------------------- // Sensor Model Information //--------------------------------------------------------------------------- @@ -513,53 +361,7 @@ void UsgsAstroProjectedLsSensorModel::setParameterType(int index, // UsgsAstroProjectedLsSensorModel::getPedigree //*************************************************************************** std::string UsgsAstroProjectedLsSensorModel::getPedigree() const { - return "USGS_LINE_SCANNER"; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getImageIdentifier -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getImageIdentifier() const { - return m_imageIdentifier; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setImageIdentifier -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setImageIdentifier(const std::string& imageId, - csm::WarningList* warnings) { - // Image id should include the suffix without the path name - m_imageIdentifier = imageId; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getSensorIdentifier -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getSensorIdentifier() const { - return m_sensorIdentifier; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getPlatformIdentifier -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getPlatformIdentifier() const { - return m_platformIdentifier; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setReferencePoint -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setReferencePoint( - const csm::EcefCoord& ground_pt) { - m_referencePointXyz = ground_pt; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getReferencePoint -//*************************************************************************** -csm::EcefCoord UsgsAstroProjectedLsSensorModel::getReferencePoint() const { - // Return ground point at image center - return m_referencePointXyz; + return "USGS_PROJECTED_LINE_SCANNER"; } //*************************************************************************** @@ -569,196 +371,6 @@ std::string UsgsAstroProjectedLsSensorModel::getModelName() const { return UsgsAstroProjectedLsSensorModel::_SENSOR_MODEL_NAME; } -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getImageStart -//*************************************************************************** -csm::ImageCoord UsgsAstroProjectedLsSensorModel::getImageStart() const { - return csm::ImageCoord(0.0, 0.0); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getImageSize -//*************************************************************************** -csm::ImageVector UsgsAstroProjectedLsSensorModel::getImageSize() const { - return csm::ImageVector(m_nLines, m_nSamples); -} - -//--------------------------------------------------------------------------- -// Monoscopic Mensuration -//--------------------------------------------------------------------------- - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getValidHeightRange -//*************************************************************************** -std::pair<double, double> UsgsAstroProjectedLsSensorModel::getValidHeightRange() const { - return std::pair<double, double>(m_minElevation, m_maxElevation); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getValidImageRange -//*************************************************************************** -std::pair<csm::ImageCoord, csm::ImageCoord> -UsgsAstroProjectedLsSensorModel::getValidImageRange() const { - return std::pair<csm::ImageCoord, csm::ImageCoord>( - csm::ImageCoord(0.0, 0.0), - csm::ImageCoord(m_nLines, - m_nSamples)); // Technically nl and ns are outside the - // image in a zero based system. -} - -//--------------------------------------------------------------------------- -// Error Correction -//--------------------------------------------------------------------------- - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getNumGeometricCorrectionSwitches -//*************************************************************************** -int UsgsAstroProjectedLsSensorModel::getNumGeometricCorrectionSwitches() const { - return 0; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getGeometricCorrectionName -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getGeometricCorrectionName( - int index) const { - MESSAGE_LOG( - spdlog::level::debug, - "Accessing name of geometric correction switch {}. " - "Geometric correction switches are not supported, throwing exception", - index); - // Since there are no geometric corrections, all indices are out of range - throw csm::Error(csm::Error::INDEX_OUT_OF_RANGE, "Index is out of range.", - "UsgsAstroProjectedLsSensorModel::getGeometricCorrectionName"); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::setGeometricCorrectionSwitch -//*************************************************************************** -void UsgsAstroProjectedLsSensorModel::setGeometricCorrectionSwitch( - int index, bool value, csm::param::Type pType) { - MESSAGE_LOG( - spdlog::level::debug, - "Setting geometric correction switch {} to {} " - "with parameter type {}. " - "Geometric correction switches are not supported, throwing exception", - index, value, pType); - // Since there are no geometric corrections, all indices are out of range - throw csm::Error(csm::Error::INDEX_OUT_OF_RANGE, "Index is out of range.", - "UsgsAstroProjectedLsSensorModel::setGeometricCorrectionSwitch"); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getGeometricCorrectionSwitch -//*************************************************************************** -bool UsgsAstroProjectedLsSensorModel::getGeometricCorrectionSwitch(int index) const { - MESSAGE_LOG( - spdlog::level::debug, - "Accessing value of geometric correction switch {}. " - "Geometric correction switches are not supported, throwing exception", - index); - // Since there are no geometric corrections, all indices are out of range - throw csm::Error(csm::Error::INDEX_OUT_OF_RANGE, "Index is out of range.", - "UsgsAstroProjectedLsSensorModel::getGeometricCorrectionSwitch"); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getCrossCovarianceMatrix -//*************************************************************************** -std::vector<double> UsgsAstroProjectedLsSensorModel::getCrossCovarianceMatrix( - const csm::GeometricModel& comparisonModel, csm::param::Set pSet, - const csm::GeometricModel::GeometricModelList& otherModels) const { - // Return covariance matrix - if (&comparisonModel == this) { - std::vector<int> paramIndices = getParameterSetIndices(pSet); - int numParams = paramIndices.size(); - std::vector<double> covariances(numParams * numParams, 0.0); - for (int i = 0; i < numParams; i++) { - for (int j = 0; j < numParams; j++) { - covariances[i * numParams + j] = - getParameterCovariance(paramIndices[i], paramIndices[j]); - } - } - return covariances; - } - // No correlation between models. - const std::vector<int>& indices = getParameterSetIndices(pSet); - size_t num_rows = indices.size(); - const std::vector<int>& indices2 = - comparisonModel.getParameterSetIndices(pSet); - size_t num_cols = indices.size(); - - return std::vector<double>(num_rows * num_cols, 0.0); -} - -//*************************************************************************** -// UsgsAstroLineScannerSensorModel::getCorrelationModel -//*************************************************************************** -const csm::CorrelationModel& UsgsAstroProjectedLsSensorModel::getCorrelationModel() - const { - // All Line Scanner images are assumed uncorrelated - return _no_corr_model; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getUnmodeledCrossCovariance -//*************************************************************************** -std::vector<double> UsgsAstroProjectedLsSensorModel::getUnmodeledCrossCovariance( - const csm::ImageCoord& pt1, const csm::ImageCoord& pt2) const { - // No unmodeled error - return std::vector<double>(4, 0.0); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getCollectionIdentifier -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getCollectionIdentifier() const { - return "UNKNOWN"; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::hasShareableParameters -//*************************************************************************** -bool UsgsAstroProjectedLsSensorModel::hasShareableParameters() const { - // Parameter sharing is not supported for this sensor - return false; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::isParameterShareable -//*************************************************************************** -bool UsgsAstroProjectedLsSensorModel::isParameterShareable(int index) const { - // Parameter sharing is not supported for this sensor - return false; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getParameterSharingCriteria -//*************************************************************************** -csm::SharingCriteria UsgsAstroProjectedLsSensorModel::getParameterSharingCriteria( - int index) const { - MESSAGE_LOG( - spdlog::level::debug, - "Checking sharing criteria for parameter {}. " - "Sharing is not supported.", - index); - return csm::SharingCriteria(); -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getSensorType -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getSensorType() const { - return CSM_SENSOR_TYPE_EO; -} - -//*************************************************************************** -// UsgsAstroProjectedLsSensorModel::getSensorMode -//*************************************************************************** -std::string UsgsAstroProjectedLsSensorModel::getSensorMode() const { - return CSM_SENSOR_MODE_PB; -} - //*************************************************************************** // UsgsAstroProjectedLsSensorModel::getVersion //*************************************************************************** @@ -786,14 +398,3 @@ std::string UsgsAstroProjectedLsSensorModel::constructStateFromIsd( // some state data is not in the ISD and requires a SM to compute them. return lsState.dump(); } - -//*************************************************************************** -// UsgsAstroLineScannerSensorModel::getLogger -//*************************************************************************** -std::shared_ptr<spdlog::logger> UsgsAstroProjectedLsSensorModel::getLogger() { - return m_logger; -} - -void UsgsAstroProjectedLsSensorModel::setLogger(std::string logName) { - m_logger = spdlog::get(logName); -} -- GitLab