OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimRsmModel Class Reference

#include <ossimRsmModel.h>

Inheritance diagram for ossimRsmModel:
ossimSensorModel ossimProjection ossimOptimizableProjection ossimAdjustableParameterInterface ossimObject ossimErrorStatusInterface ossimReferenced ossimNitfRsmModel

Public Member Functions

 ossimRsmModel ()
 default constructor More...
 
 ossimRsmModel (const ossimRsmModel &obj)
 copy constructor More...
 
const ossimRsmModeloperator= (const ossimRsmModel &rhs)
 assignment operator More...
 
virtual void worldToLineSample (const ossimGpt &world_point, ossimDpt &image_point) const
 worldToLineSample() Overrides base class implementation. More...
 
virtual void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &world_point) const
 lineSampleToWorld() Overrides base class pure virtual. More...
 
virtual void lineSampleHeightToWorld (const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
 lineSampleHeightToWorld() Overrides base class pure virtual. More...
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 imagingRay() Overrides base class pure virtual. More...
 
virtual void updateModel ()
 
virtual void initAdjustableParameters ()
 
virtual ossimObjectdup () const
 dup() Returns pointer to a new instance, copy of this. More...
 
virtual bool useForward () const
 
virtual std::ostream & print (std::ostream &out) const
 print() Extends base-class implementation. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 saveState Fulfills ossimObject base-class pure virtuals. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 loadState Fulfills ossimObject base-class pure virtuals. More...
 
- Public Member Functions inherited from ossimSensorModel
 ossimSensorModel ()
 
 ossimSensorModel (const ossimSensorModel &copy_this)
 
 ossimSensorModel (const ossimKeywordlist &geom_kwl)
 
const ossimSensorModeloperator= (const ossimSensorModel &rhs)
 assignment operator More...
 
virtual ossimObjectgetBaseObject ()
 
virtual const ossimObjectgetBaseObject () const
 
virtual ossimGpt origin () const
 
virtual ossimDpt getMetersPerPixel () const
 
virtual const double & getNominalPosError () const
 Returns the estimated Absolute horizontal position error (CE90) of the sensor model. More...
 
virtual const double & getRelativePosError () const
 Returns the estimated RELATIVE horizontal position error (CE90) of the sensor model. More...
 
virtual void setNominalPosError (const double &ce90)
 Assigns the absolute image position error uncertainty (abs CE90) More...
 
virtual void setRelativePosError (const double &ce90)
 Assigns the relative image position error uncertainty (rel CE90) More...
 
void setRefImgPt (const ossimDpt &pt)
 Sets the center line sampe of the image. More...
 
void setRefGndPt (const ossimGpt &pt)
 Sets the center latitude, longitude, height of the image. More...
 
void setImageRect (const ossimDrect &imageRect)
 
void setGroundRect (const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
 
ossimDpt imageSize () const
 
void setImageSize (const ossimDpt &size)
 
virtual void adjustableParametersChanged ()
 
virtual bool insideImage (const ossimDpt &p) const
 
virtual bool operator== (const ossimProjection &proj) const
 
const ossimStringgetImageID () const
 Access methods: More...
 
const ossimDrectgetImageClipRect () const
 
virtual ossim_uint32 degreesOfFreedom () const
 
virtual bool needsInitialState () const
 needsInitialState() More...
 
virtual double optimizeFit (const ossimTieGptSet &tieSet, double *targetVariance=0)
 
virtual ossimDpt getForwardDeriv (int parmIdx, const ossimGpt &gpos, double hdelta=1e-11)
 
virtual ossimGpt getInverseDeriv (int parmIdx, const ossimDpt &ipos, double hdelta=1e-11)
 
virtual ossimSensorModel::CovMatStatus getObsCovMat (const ossimDpt &ipos, NEWMAT::SymmetricMatrix &Cov, const ossim_float64 defPointingSigma=0.5) const
 Gives 2X2 covariance matrix of observations. More...
 
virtual bool isAffectedByElevation () const
 Implementation of pure virtual ossimProjection::isAffectedByElevation method. More...
 
void computeGsd ()
 This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD by doing a lineSampleHeightToWorld on four points and calculating the distance from them. More...
 
virtual bool getImageGeometry (const ossimString &, const ossimString &, ossimKeywordlist &) const
 Extracts geometry info from a non-ossim key,value pair to an ossim keyword list. More...
 
- Public Member Functions inherited from ossimProjection
 ossimProjection ()
 
virtual ~ossimProjection ()
 
virtual ossimDpt forward (const ossimGpt &wp) const
 
virtual ossimGpt inverse (const ossimDpt &pp) const
 
virtual void getRoundTripError (const ossimDpt &imagePoint, ossimDpt &errorResult) const
 
virtual void getRoundTripError (const ossimGpt &groundPoint, ossimDpt &errorResult) const
 
virtual void getGroundClipPoints (ossimGeoPolygon &gpts) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual bool operator!= (const ossimProjection &projection) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimOptimizableProjection
 ossimOptimizableProjection ()
 
 ossimOptimizableProjection (const ossimOptimizableProjection &source)
 
virtual ~ossimOptimizableProjection ()
 
virtual ossimOptimizableProjectionoperator= (const ossimOptimizableProjection &source)
 
virtual bool setupOptimizer (const ossimString &setup)
 setupFromString() Derived classes should implement as needed. Initialize parameters needed for optimizeFit and degreesOfFreedom More...
 
- Public Member Functions inherited from ossimAdjustableParameterInterface
 ossimAdjustableParameterInterface ()
 
 ossimAdjustableParameterInterface (const ossimAdjustableParameterInterface &rhs)
 
virtual ~ossimAdjustableParameterInterface ()
 
void newAdjustment (ossim_uint32 numberOfParameters=0)
 
void setAdjustmentDescription (const ossimString &description)
 
ossimString getAdjustmentDescription () const
 
ossimString getAdjustmentDescription (ossim_uint32 adjustmentIdx) const
 Returns adjustmentDescription of specific adjustmentInfo. More...
 
void setCurrentAdjustment (ossim_uint32 adjustmentIndex, bool notify=false)
 
bool setCurrentAdjustment (const ossimString &description, bool notify=false)
 Sets the current adjustment to the adjustment with a matching description. More...
 
void eraseAdjustment (bool notify)
 
void eraseAdjustment (ossim_uint32 idx, bool notify)
 
void resetAdjustableParameters (bool notify=false)
 
void copyAdjustment (ossim_uint32 idx, bool notify)
 
void copyAdjustment (bool notify=false)
 
void keepAdjustment (ossim_uint32 idx, bool createCopy)
 
virtual void keepAdjustment (bool createCopy=true)
 
const ossimAdjustableParameterInterfaceoperator= (const ossimAdjustableParameterInterface &rhs)
 
void removeAllAdjustments ()
 
ossim_uint32 getNumberOfAdjustableParameters () const
 
double getAdjustableParameter (ossim_uint32 idx) const
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, bool notify=false)
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, double sigma, bool notify=false)
 
double getParameterSigma (ossim_uint32 idx) const
 
void setParameterSigma (ossim_uint32 idx, double value, bool notify=false)
 
ossimUnitType getParameterUnit (ossim_uint32 idx) const
 
void setParameterUnit (ossim_uint32 idx, ossimUnitType unit)
 
void setParameterUnit (ossim_uint32 idx, const ossimString &unit)
 
void setParameterCenter (ossim_uint32 idx, double center, bool notify=false)
 
double getParameterCenter (ossim_uint32 idx) const
 
double computeParameterOffset (ossim_uint32 idx) const
 
void setParameterOffset (ossim_uint32 idx, ossim_float64 value, bool notify=false)
 
ossimString getParameterDescription (ossim_uint32 idx) const
 
void setParameterDescription (ossim_uint32 idx, const ossimString &descrption)
 
ossim_int32 findParameterIdxGivenDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
ossim_int32 findParameterIdxContainingDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
bool isParameterLocked (ossim_uint32 idx) const
 
void setParameterLockFlag (ossim_uint32 idxParam, bool flag)
 
bool getParameterLockFlag (ossim_uint32 idx) const
 
void lockAllParametersCurrentAdjustment ()
 
void unlockAllParametersCurrentAdjustment ()
 
void lockAllParameters (ossim_uint32 idxAdjustment)
 
void unlockAllParameters (ossim_uint32 idxAdjustment)
 
void resizeAdjustableParameterArray (ossim_uint32 numberOfParameters)
 
void setAdjustment (const ossimAdjustmentInfo &adj, bool notify=false)
 
void setAdjustment (ossim_uint32 idx, const ossimAdjustmentInfo &adj, bool notify=false)
 
void addAdjustment (const ossimAdjustmentInfo &adj, bool notify)
 
void getAdjustment (ossimAdjustmentInfo &adj) const
 
void getAdjustment (ossim_uint32 idx, ossimAdjustmentInfo &adj) const
 
ossim_uint32 getNumberOfAdjustments () const
 
ossim_uint32 getCurrentAdjustmentIdx () const
 
void setDirtyFlag (bool flag=true)
 
void setAllDirtyFlag (bool flag=true)
 
bool hasDirtyAdjustments () const
 
virtual void saveCurrentAdjustmentOnly (ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 Saves the current active adjustment to the KWL file. More...
 
bool saveAdjustments (ossimKeywordlist &kwl, const ossimString &prefix=ossimString("")) const
 Save all adjustments to the KWL file. More...
 
bool loadAdjustments (const ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 
std::ostream & print (std::ostream &out) const
 Dumps the currently active adjustment to ostream. More...
 

Protected Member Functions

ossim_uint32 getPcaIndex (const double &x, const double &y, const double &z) const
 Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point. More...
 
ossim_uint32 getPcaIndex (const ossimDpt &ipt, bool shiftPoint) const
 Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given image point. More...
 
void lowOrderPolynomial (const double &x, const double &y, const double &z, ossimDpt &ipt) const
 Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point. More...
 
double polynomial (const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
 
double dPoly_dLat (const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
 
double dPoly_dLon (const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
 
double dPoly_dHgt (const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
 
bool validate () const
 Performs sanity check on key/required rsm data. More...
 
virtual ~ossimRsmModel ()
 virtual destructor More...
 
- Protected Member Functions inherited from ossimSensorModel
virtual ~ossimSensorModel ()
 
virtual ossimDpt extrapolate (const ossimGpt &gp) const
 
virtual ossimGpt extrapolate (const ossimDpt &ip, const double &height=ossim::nan()) const
 
void buildNormalEquation (const ossimTieGptSet &tieSet, NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &residue, NEWMAT::ColumnVector &projResidue, double pstep_scale)
 
NEWMAT::ColumnVector getResidue (const ossimTieGptSet &tieSet)
 
NEWMAT::ColumnVector solveLeastSquares (NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &r) const
 
NEWMAT::Matrix invert (const NEWMAT::Matrix &m) const
 stable invert stolen from ossimRpcSolver More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimAdjustableParameterInterface
bool paramChanged (ossim_uint32 param_idx) const
 Returns true if specified parameter has been modified since last setAllChangeFlag(false) call. More...
 
void setAllChangeFlags (bool areChanged)
 Sets all the change flags to the boolean indicated to indicate parameters are changed (TRUE) or not (FALSE). More...
 
void initChangeFlags ()
 Initializes the change flags to TRUE. More...
 

Protected Attributes

ossimRsmida m_ida
 
ossimRsmpia m_pia
 
std::vector< ossimRsmpcam_pca
 
- Protected Attributes inherited from ossimSensorModel
ossimIpt theImageSize
 
ossimDpt theSubImageOffset
 
ossimString theImageID
 
ossimString theSensorID
 
ossimDpt theGSD
 
ossim_float64 theMeanGSD
 
ossimGpt theRefGndPt
 
ossimDpt theRefImgPt
 
ossimPolygon theBoundGndPolygon
 
ossimDrect theImageClipRect
 
ossim_float64 theRelPosError
 
ossim_float64 theNominalPosError
 
ossimDpt theParWRTx
 Partials for current point. More...
 
ossimDpt theParWRTy
 
ossimDpt theParWRTz
 
ossimDpt theObs
 Observations & residuals for current point. More...
 
ossimDpt theResid
 
ossimRefPtr< ossimProjectiontheSeedFunction
 Used as an initial guess for iterative solutions and a guess for points outside the support bounds. More...
 
bool theExtrapolateImageFlag
 
bool theExtrapolateGroundFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Additional Inherited Members

- Public Types inherited from ossimSensorModel
enum  CovMatStatus { COV_INVALID = 0, COV_PARTIAL = 1, COV_FULL = 2 }
 
enum  DeriveMode {
  OBS_INIT =-99, EVALUATE =-98, P_WRT_X = -1, P_WRT_Y = -2,
  P_WRT_Z = -3
}
 
- Static Public Member Functions inherited from ossimSensorModel
static void writeGeomTemplate (ostream &os)
 

Detailed Description

Definition at line 17 of file ossimRsmModel.h.

Constructor & Destructor Documentation

◆ ossimRsmModel() [1/2]

ossimRsmModel::ossimRsmModel ( )

default constructor

Definition at line 41 of file ossimRsmModel.cpp.

References initAdjustableParameters().

Referenced by dup().

42  :
44  m_ida(),
45  m_pia(),
46  m_pca()
47 {
49 
50 }
virtual void initAdjustableParameters()
std::vector< ossimRsmpca > m_pca
ossimRsmpia m_pia
ossimRsmida m_ida

◆ ossimRsmModel() [2/2]

ossimRsmModel::ossimRsmModel ( const ossimRsmModel obj)

copy constructor

Definition at line 52 of file ossimRsmModel.cpp.

53  :
54  ossimSensorModel( obj ),
55  m_ida( obj.m_ida ),
56  m_pia( obj.m_pia ),
57  m_pca( obj.m_pca )
58 {
59 
60 }
std::vector< ossimRsmpca > m_pca
ossimRsmpia m_pia
ossimRsmida m_ida

◆ ~ossimRsmModel()

ossimRsmModel::~ossimRsmModel ( )
protectedvirtual

virtual destructor

Definition at line 74 of file ossimRsmModel.cpp.

75 {
76 }

Member Function Documentation

◆ dPoly_dHgt()

double ossimRsmModel::dPoly_dHgt ( const double &  x,
const double &  y,
const double &  z,
const ossim_uint32 maxx,
const ossim_uint32 maxy,
const ossim_uint32 maxz,
std::vector< double >  pcf 
) const
protected

Definition at line 643 of file ossimRsmModel.cpp.

References x, and y.

646 {
647  double dr = 0.0;
648  ossim_uint32 index = 0;
649  for (ossim_uint32 k = 0; k <= maxz; ++k)
650  {
651  for (ossim_uint32 j = 0; j <= maxy; ++j)
652  {
653  for (ossim_uint32 i = 0; i <= maxx; ++i)
654  {
655  if (k>0)
656  {
657  dr += k*pcf[index]*std::pow(x,(double)i) *
658  std::pow(y,(double)j)*std::pow(z,(double)(k-1));
659  }
660  ++index;
661  }
662  }
663  }
664  return dr;
665 }
ossim_uint32 x
ossim_uint32 y
unsigned int ossim_uint32

◆ dPoly_dLat()

double ossimRsmModel::dPoly_dLat ( const double &  x,
const double &  y,
const double &  z,
const ossim_uint32 maxx,
const ossim_uint32 maxy,
const ossim_uint32 maxz,
std::vector< double >  pcf 
) const
protected

Definition at line 595 of file ossimRsmModel.cpp.

References x, and y.

Referenced by lineSampleHeightToWorld().

599 {
600  double dr = 0.0;
601  ossim_uint32 index = 0;
602  for (ossim_uint32 k = 0; k <= maxz; ++k)
603  {
604  for (ossim_uint32 j = 0; j <= maxy; ++j)
605  {
606  for (ossim_uint32 i = 0; i <= maxx; ++i)
607  {
608  if (j>0)
609  {
610  dr+=j*pcf[index]*std::pow(x,(double)i)*std::pow(y,(double)(j-1))*std::pow(z,(double)k);
611  }
612  ++index;
613  }
614  }
615  }
616  return dr;
617 }
ossim_uint32 x
ossim_uint32 y
unsigned int ossim_uint32

◆ dPoly_dLon()

double ossimRsmModel::dPoly_dLon ( const double &  x,
const double &  y,
const double &  z,
const ossim_uint32 maxx,
const ossim_uint32 maxy,
const ossim_uint32 maxz,
std::vector< double >  pcf 
) const
protected

Definition at line 619 of file ossimRsmModel.cpp.

References x, and y.

Referenced by lineSampleHeightToWorld().

622 {
623  double dr = 0.0;
624  ossim_uint32 index = 0;
625  for (ossim_uint32 k = 0; k <= maxz; ++k)
626  {
627  for (ossim_uint32 j = 0; j <= maxy; ++j)
628  {
629  for (ossim_uint32 i = 0; i <= maxx; ++i)
630  {
631  if (i>0)
632  {
633  dr += i*pcf[index]*std::pow(x,(double)(i-1)) *
634  std::pow(y,(double)j)*std::pow(z,(double)k);
635  }
636  ++index;
637  }
638  }
639  }
640  return dr;
641 }
ossim_uint32 x
ossim_uint32 y
unsigned int ossim_uint32

◆ dup()

ossimObject * ossimRsmModel::dup ( ) const
virtual

dup() Returns pointer to a new instance, copy of this.

Implements ossimProjection.

Reimplemented in ossimNitfRsmModel.

Definition at line 397 of file ossimRsmModel.cpp.

References ossimRsmModel().

398 {
399  return new ossimRsmModel(*this);
400 }
ossimRsmModel()
default constructor

◆ getPcaIndex() [1/2]

ossim_uint32 ossimRsmModel::getPcaIndex ( const double &  x,
const double &  y,
const double &  z 
) const
protected

Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point.

Parameters
xLongitude in radians.
yLatitude, in radians.
zHeight in meters.
Returns
Index into m_pca vector.

Definition at line 521 of file ossimRsmModel.cpp.

References lowOrderPolynomial(), x, and y.

Referenced by imagingRay(), lineSampleHeightToWorld(), and worldToLineSample().

523 {
524  ossimDpt ipt;
525  lowOrderPolynomial( x, y, z, ipt );
526  return getPcaIndex( ipt, false );
527 }
ossim_uint32 x
ossim_uint32 y
void lowOrderPolynomial(const double &x, const double &y, const double &z, ossimDpt &ipt) const
Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point...
ossim_uint32 getPcaIndex(const double &x, const double &y, const double &z) const
Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point...

◆ getPcaIndex() [2/2]

ossim_uint32 ossimRsmModel::getPcaIndex ( const ossimDpt ipt,
bool  shiftPoint 
) const
protected

Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given image point.

Note
(0,0) in ossim space is (0.5, 0.5) in rsm space.
Parameters
iptImage line, sample.
shiftPointIf true ipt is shifted +0.5 to go from ossim space(0 is center of pixel) to RSM space(0 is upper left of pixel). If false point is coming from rsm space and does not need to be shifted.
Returns
Index into m_pca vector.

Definition at line 529 of file ossimRsmModel.cpp.

References ossimRsmpia::m_cnis, ossimRsmpia::m_cssiz, m_ida, ossimRsmida::m_minc, ossimRsmida::m_minr, m_pia, ossimRsmpia::m_rnis, ossimRsmpia::m_rssiz, ossimDpt::x, and ossimDpt::y.

530 {
531  //---
532  // RSM (0,0) is upper left corner of pixel(0,0). OSSIM (0,0) is
533  // center of the pixel; hence, the shift 0.5 if coming from ossim.
534  //---
535  double shift = shiftPoint ? 0.5 : 0.0;
536 
537  // Row section number:
538  double rsn = std::floor( ( ipt.y + shift - (double)(m_ida.m_minr) ) /
539  (double)(m_pia.m_rssiz) );
540  if ( rsn < 0.0 )
541  {
542  rsn = 0.0;
543  }
544  else if ( rsn > (m_pia.m_rnis-1) )
545  {
546  rsn = m_pia.m_rnis-1;
547  }
548  // Column section number:
549  double csn = std::floor( ( ipt.x + shift - (double)(m_ida.m_minc) ) / (double)(m_pia.m_cssiz) );
550  if ( csn < 0.0 )
551  {
552  csn = 0.0;
553  }
554  else if ( csn > (m_pia.m_cnis-1) )
555  {
556  csn = m_pia.m_cnis-1;
557  }
558 
559  //return static_cast<ossim_uint32>(rsn) * m_pia.m_rnis + static_cast<ossim_uint32>(csn);
560  return static_cast<ossim_uint32>(rsn) * m_pia.m_cnis + static_cast<ossim_uint32>(csn);
561 }
ossim_uint32 m_rnis
Definition: ossimRsmpia.h:90
double y
Definition: ossimDpt.h:165
ossim_uint32 m_minc
Definition: ossimRsmida.h:140
ossim_uint32 m_cssiz
Definition: ossimRsmpia.h:95
unsigned int ossim_uint32
ossim_uint32 m_rssiz
Definition: ossimRsmpia.h:94
ossimRsmpia m_pia
ossim_uint32 m_minr
Definition: ossimRsmida.h:138
double x
Definition: ossimDpt.h:164
ossimRsmida m_ida
ossim_uint32 m_cnis
Definition: ossimRsmpia.h:91

◆ imagingRay()

void ossimRsmModel::imagingRay ( const ossimDpt image_point,
ossimEcefRay image_ray 
) const
virtual

imagingRay() Overrides base class pure virtual.

Reimplemented from ossimSensorModel.

Definition at line 356 of file ossimRsmModel.cpp.

References getPcaIndex(), lineSampleHeightToWorld(), and m_pca.

Referenced by lineSampleToWorld().

358 {
359  ossim_uint32 pcaIndex = getPcaIndex( imagePoint, true );
360 
361  //---
362  // For "from point", "to point" we want the image ray to be from above the
363  // ellipsoid down to Earth.
364  //
365  // It appears the ray "from point" must be above the ellipsiod for the
366  // ossimElevSource::intersectRay method; ultimately, the
367  // ossimEllipsoid::nearestIntersection method, else it goes off in the
368  // weeds...
369  //---
370  double vectorLength = m_pca[pcaIndex].m_znrmsf * 2.0;
371 
372  ossimGpt gpt;
373 
374  // "from" point
375  double intHgt = m_pca[pcaIndex].m_znrmo + vectorLength;
376  lineSampleHeightToWorld(imagePoint, intHgt, gpt);
377  ossimEcefPoint intECFfrom(gpt);
378 
379  // "to" point
380  lineSampleHeightToWorld(imagePoint, m_pca[pcaIndex].m_znrmo, gpt);
381  ossimEcefPoint intECFto(gpt);
382 
383  // Construct ray
384  ossimEcefRay ray(intECFfrom, intECFto);
385 
386  imageRay = ray;
387 }
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
lineSampleHeightToWorld() Overrides base class pure virtual.
ossim_uint32 getPcaIndex(const double &x, const double &y, const double &z) const
Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point...
std::vector< ossimRsmpca > m_pca
unsigned int ossim_uint32

◆ initAdjustableParameters()

void ossimRsmModel::initAdjustableParameters ( )
virtual

Reimplemented from ossimAdjustableParameterInterface.

Definition at line 393 of file ossimRsmModel.cpp.

Referenced by ossimRsmModel().

394 {
395 }

◆ lineSampleHeightToWorld()

void ossimRsmModel::lineSampleHeightToWorld ( const ossimDpt image_point,
const double &  heightEllipsoid,
ossimGpt worldPoint 
) const
virtual

lineSampleHeightToWorld() Overrides base class pure virtual.

Height understood to be relative to standard ellipsoid.

Implements ossimSensorModel.

Definition at line 198 of file ossimRsmModel.cpp.

References dPoly_dLat(), dPoly_dLon(), getPcaIndex(), ossimGpt::hgt, ossim::isnan(), ossimGpt::lat, ossimGpt::lon, m_pca, ossimNotify(), ossimNotifyLevel_WARN, polynomial(), ossim::radiansToDegrees(), ossimGpt::wrap(), ossimDpt::x, and ossimDpt::y.

Referenced by imagingRay().

201 {
202  // Borrowed from ossimRpcModel algorithm to converge on polynomial roots
203 
204  //---
205  // Constants for convergence tests:
206  //---
207  // SPEC says 1/20 of a pixel for polynomial fit, so converge to at least that point
208  static const int MAX_NUM_ITERATIONS = 100;
209  static const double CONVERGENCE_EPSILON = 0.05; // pixels
210 
211  ossim_uint32 pcaIndex = getPcaIndex( image_point, true );
212 
213  // Image point of 0 to ossim is 0.5 to RSM.
214  // double U = (image_point.y-m_rnrmo) / (m_rnrmsf);
215  // double V = (image_point.x-m_cnrmo) / (m_cnrmsf);
216 
217  double U = (image_point.y+0.5-m_pca[pcaIndex].m_rnrmo) / (m_pca[pcaIndex].m_rnrmsf);
218  double V = (image_point.x+0.5-m_pca[pcaIndex].m_cnrmo) / (m_pca[pcaIndex].m_cnrmsf);
219 
220  //---
221  // Initialize quantities to be used in the iteration for ground point:
222  //---
223  double nlat = 0.0; // normalized latitude
224  double nlon = 0.0; // normalized longitude
225  double nhgt;
226 
227  if(ossim::isnan(ellHeight))
228  {
229  nhgt = (- m_pca[pcaIndex].m_znrmo) / m_pca[pcaIndex].m_znrmsf; // norm height
230  }
231  else
232  {
233  nhgt = (ellHeight - m_pca[pcaIndex].m_znrmo) / m_pca[pcaIndex].m_znrmsf; // norm height
234  }
235 
236  double epsilonU = CONVERGENCE_EPSILON/m_pca[pcaIndex].m_rnrmsf;
237  double epsilonV = CONVERGENCE_EPSILON/m_pca[pcaIndex].m_cnrmsf;
238  int iteration = 0;
239  //---
240  // Declare variables only once outside the loop. These include:
241  // * polynomials (numerators Pu, Pv, and denominators Qu, Qv),
242  // * partial derivatives of polynomials wrt X, Y,
243  // * computed normalized image point: Uc, Vc,
244  // * residuals of normalized image point: deltaU, deltaV,
245  // * partial derivatives of Uc and Vc wrt X, Y,
246  // * corrections to normalized lat, lon: deltaLat, deltaLon.
247  //---
248  double Pu, Qu, Pv, Qv;
249  double dPu_dLat, dQu_dLat, dPv_dLat, dQv_dLat;
250  double dPu_dLon, dQu_dLon, dPv_dLon, dQv_dLon;
251  double Uc, Vc;
252  double deltaU, deltaV;
253  double dU_dLat, dU_dLon, dV_dLat, dV_dLon, W;
254  double deltaLat, deltaLon;
255 
256  //---
257  // Now iterate until the computed Uc, Vc is within epsilon of the desired
258  // image point U, V:
259  //---
260  do
261  {
262  //---
263  // Calculate the normalized line and sample Uc, Vc as ratio of
264  // polynomials Pu, Qu and Pv, Qv:
265  //---
266  Pu = polynomial(nlon, nlat, nhgt, m_pca[pcaIndex].m_rnpwrx, m_pca[pcaIndex].m_rnpwry, m_pca[pcaIndex].m_rnpwrz, m_pca[pcaIndex].m_rnpcf);
267  Qu = polynomial(nlon, nlat, nhgt, m_pca[pcaIndex].m_rdpwrx, m_pca[pcaIndex].m_rdpwry, m_pca[pcaIndex].m_rdpwrz, m_pca[pcaIndex].m_rdpcf);
268  Pv = polynomial(nlon, nlat, nhgt, m_pca[pcaIndex].m_cnpwrx, m_pca[pcaIndex].m_cnpwry, m_pca[pcaIndex].m_cnpwrz, m_pca[pcaIndex].m_cnpcf);
269  Qv = polynomial(nlon, nlat, nhgt, m_pca[pcaIndex].m_cdpwrx, m_pca[pcaIndex].m_cdpwry, m_pca[pcaIndex].m_cdpwrz, m_pca[pcaIndex].m_cdpcf);
270  Uc = Pu/Qu;
271  Vc = Pv/Qv;
272 
273  //---
274  // Compute residuals between desired and computed line, sample:
275  //---
276  deltaU = U - Uc;
277  deltaV = V - Vc;
278 
279  //---
280  // Check for convergence and skip re-linearization if converged:
281  //---
282  if ((fabs(deltaU) > epsilonU) || (fabs(deltaV) > epsilonV))
283  {
284  //---
285  // Analytically compute the partials of each polynomial wrt lat, lon:
286  //---
287  dPu_dLat = dPoly_dLat(nlon, nlat, nhgt, m_pca[pcaIndex].m_rnpwrx, m_pca[pcaIndex].m_rnpwry, m_pca[pcaIndex].m_rnpwrz, m_pca[pcaIndex].m_rnpcf);
288  dQu_dLat = dPoly_dLat(nlon, nlat, nhgt, m_pca[pcaIndex].m_rdpwrx, m_pca[pcaIndex].m_rdpwry, m_pca[pcaIndex].m_rdpwrz, m_pca[pcaIndex].m_rdpcf);
289  dPv_dLat = dPoly_dLat(nlon, nlat, nhgt, m_pca[pcaIndex].m_cnpwrx, m_pca[pcaIndex].m_cnpwry, m_pca[pcaIndex].m_cnpwrz, m_pca[pcaIndex].m_cnpcf);
290  dQv_dLat = dPoly_dLat(nlon, nlat, nhgt, m_pca[pcaIndex].m_cdpwrx, m_pca[pcaIndex].m_cdpwry, m_pca[pcaIndex].m_cdpwrz, m_pca[pcaIndex].m_cdpcf);
291  dPu_dLon = dPoly_dLon(nlon, nlat, nhgt, m_pca[pcaIndex].m_rnpwrx, m_pca[pcaIndex].m_rnpwry, m_pca[pcaIndex].m_rnpwrz, m_pca[pcaIndex].m_rnpcf);
292  dQu_dLon = dPoly_dLon(nlon, nlat, nhgt, m_pca[pcaIndex].m_rdpwrx, m_pca[pcaIndex].m_rdpwry, m_pca[pcaIndex].m_rdpwrz, m_pca[pcaIndex].m_rdpcf);
293  dPv_dLon = dPoly_dLon(nlon, nlat, nhgt, m_pca[pcaIndex].m_cnpwrx, m_pca[pcaIndex].m_cnpwry, m_pca[pcaIndex].m_cnpwrz, m_pca[pcaIndex].m_cnpcf);
294  dQv_dLon = dPoly_dLon(nlon, nlat, nhgt, m_pca[pcaIndex].m_cdpwrx, m_pca[pcaIndex].m_cdpwry, m_pca[pcaIndex].m_cdpwrz, m_pca[pcaIndex].m_cdpcf);
295 
296  //---
297  // Analytically compute partials of quotients U and V wrt lat, lon:
298  //---
299  dU_dLat = (Qu*dPu_dLat - Pu*dQu_dLat)/(Qu*Qu);
300  dU_dLon = (Qu*dPu_dLon - Pu*dQu_dLon)/(Qu*Qu);
301  dV_dLat = (Qv*dPv_dLat - Pv*dQv_dLat)/(Qv*Qv);
302  dV_dLon = (Qv*dPv_dLon - Pv*dQv_dLon)/(Qv*Qv);
303 
304  W = dU_dLon*dV_dLat - dU_dLat*dV_dLon;
305 
306  //---
307  // Now compute the corrections to normalized lat, lon:
308  //---
309  deltaLat = (dU_dLon*deltaV - dV_dLon*deltaU) / W;
310  deltaLon = (dV_dLat*deltaU - dU_dLat*deltaV) / W;
311  nlat += deltaLat;
312  nlon += deltaLon;
313  }
314 
315  ++iteration;
316 
317  } while (((fabs(deltaU)>epsilonU) || (fabs(deltaV)>epsilonV))
318  && (iteration < MAX_NUM_ITERATIONS));
319  //---
320  // Test for exceeding allowed number of iterations. Flag error if so:
321  //---
322  if (iteration == MAX_NUM_ITERATIONS)
323  {
325  << "WARNING ossimRsmModel::lineSampleHeightToWorld:\n"
326  << "Max number of iterations reached in ground point "
327  << "solution. Results are inaccurate." << endl;
328  }
329 
330  //---
331  // Now un-normalize the ground point lat, lon and establish return quantity:
332  //
333  // lon will 0 to 2PI when image is near PI radians as specified in RSMIDA
334  // GRNDD field when value is "H" versus "G". OSSIMGPT wrap handles this
335  // automatically, so no need to worry about it.
336  //---
337  gpt.lat = ossim::radiansToDegrees(nlat*m_pca[pcaIndex].m_ynrmsf + m_pca[pcaIndex].m_ynrmo);
338  gpt.lon = ossim::radiansToDegrees(nlon*m_pca[pcaIndex].m_xnrmsf + m_pca[pcaIndex].m_xnrmo);
339  gpt.hgt = (nhgt * m_pca[pcaIndex].m_znrmsf) + m_pca[pcaIndex].m_znrmo; //ellHeight;
340 
341  //---
342  // Note: See above note. Added in wrap call. Longitude was coming out 242
343  // when should have been -118. (drb - 22 May 2015)
344  //---
345  gpt.wrap();
346 
347 } // End: ossimRsmModel::lineSampleHeightToWorld( ... )
double dPoly_dLat(const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
double y
Definition: ossimDpt.h:165
ossim_uint32 getPcaIndex(const double &x, const double &y, const double &z) const
Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point...
double polynomial(const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
double radiansToDegrees(double x)
Definition: ossimCommon.h:257
std::vector< ossimRsmpca > m_pca
double dPoly_dLon(const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
unsigned int ossim_uint32
double x
Definition: ossimDpt.h:164
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ lineSampleToWorld()

void ossimRsmModel::lineSampleToWorld ( const ossimDpt image_point,
ossimGpt world_point 
) const
virtual

lineSampleToWorld() Overrides base class pure virtual.

Intersects DEM.

Reimplemented from ossimSensorModel.

Definition at line 167 of file ossimRsmModel.cpp.

References ossimDpt::hasNans(), imagingRay(), ossimElevManager::instance(), ossimElevSource::intersectRay(), ossimGpt::makeNan(), ossimDpt::x, and ossimDpt::y.

169 {
170  if(!imagePoint.hasNans())
171  {
172  ossimEcefRay ray;
173 
174  //---
175  // Note:
176  // RSM (0,0) is upper left corner of pixel(0,0). OSSIM (0,0) is
177  // center of the pixel; hence, the + 0.5. (drb 22 May 2015)
178  //---
179  // imagingRay(imagePoint, ray);
180  imagingRay(ossimDpt(imagePoint.x+0.5, imagePoint.y+0.5), ray);
181  ossimElevManager::instance()->intersectRay(ray, worldPoint);
182  }
183  else
184  {
185  worldPoint.makeNan();
186  }
187 }
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
imagingRay() Overrides base class pure virtual.
bool intersectRay(const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
METHOD: intersectRay()
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.

◆ loadState()

bool ossimRsmModel::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

loadState Fulfills ossimObject base-class pure virtuals.

Loads and saves geometry KWL files. Returns true if successful.

Reimplemented from ossimSensorModel.

Reimplemented in ossimNitfRsmModel.

Definition at line 454 of file ossimRsmModel.cpp.

456 {
457  static const char MODULE[] = "ossimRsmModel::loadState";
458  if (traceExec())
459  {
460  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
461  }
462 
463  bool status = false;
464 
465  // Check for type match before preceeding:
466  std::string pfx = ( prefix ? prefix : "" );
467  std::string type = kwl.findKey( pfx, std::string(ossimKeywordNames::TYPE_KW) );
468  if ( (type == "ossimNitfRsmModel" ) || ( type == MODEL_TYPE_KW ) )
469  {
470  // Pass on to the base-class for parsing first:
471  if ( ossimSensorModel::loadState(kwl, prefix) )
472  {
473  if ( m_ida.loadState( kwl, pfx ) )
474  {
475  if ( m_pia.loadState( kwl, pfx ) )
476  {
477  m_pca.clear();
478 
479  for ( ossim_uint32 tagIndex = 0; tagIndex < m_pia.m_tnis; ++tagIndex )
480  {
481  ossimRsmpca pca;
482  if ( pca.loadState( kwl, pfx, tagIndex ) )
483  {
484  m_pca.push_back( pca );
485  }
486  else
487  {
489  << "WARNING! RSMPCA[" << tagIndex << "] intitialization failed!"
490  << std::endl;
491  break; // Get out...
492  }
493  }
494 
495  // Should now have a rsmpca record for each segment.
496  if ( m_pia.m_tnis == (ossim_uint32)m_pca.size() )
497  {
498  // Set the status for downstream code.
499  status = true;
500 
501  updateModel();
502  }
503 
504  } // Matches: if ( m_pia.loadState( kwl, pfx ) )
505 
506  } // Matches:if ( m_ida.loadState( kwl, pfx ) )
507 
508  } // Matches: if ( ossimSensorModel::loadState(kwl, prefix) )
509 
510  } // Matches: if ( (type == "ossimNitfRsmModel" ) || ...
511 
512  if (traceExec())
513  {
515  << MODULE << " exit status = " << (status?"true":"false") << "\n";
516  }
517 
518  return status;
519 }
virtual void updateModel()
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossim_uint32 m_tnis
Definition: ossimRsmpia.h:92
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix, ossim_uint32 index)
loadState Loads state from keyword list.
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix)
loadState Loads state from keyword list.
static const char * TYPE_KW
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix)
loadState Loads state from keyword list.
std::vector< ossimRsmpca > m_pca
unsigned int ossim_uint32
ossimRsmpia m_pia
return status
ossimRsmida m_ida
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ lowOrderPolynomial()

void ossimRsmModel::lowOrderPolynomial ( const double &  x,
const double &  y,
const double &  z,
ossimDpt ipt 
) const
protected

Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point.

Parameters
xLongitude in radians.
yLatitude, in radians.
zHeight in meters. ipt Initialized by this.

Definition at line 563 of file ossimRsmModel.cpp.

References ossimRsmpia::m_c0, ossimRsmpia::m_cx, ossimRsmpia::m_cxx, ossimRsmpia::m_cxy, ossimRsmpia::m_cxz, ossimRsmpia::m_cy, ossimRsmpia::m_cyy, ossimRsmpia::m_cyz, ossimRsmpia::m_cz, ossimRsmpia::m_czz, m_pia, ossimRsmpia::m_r0, ossimRsmpia::m_rx, ossimRsmpia::m_rxx, ossimRsmpia::m_rxy, ossimRsmpia::m_rxz, ossimRsmpia::m_ry, ossimRsmpia::m_ryy, ossimRsmpia::m_ryz, ossimRsmpia::m_rz, ossimRsmpia::m_rzz, ossimDpt::x, x, ossimDpt::y, and y.

Referenced by getPcaIndex().

565 {
566  ipt.y = m_pia.m_r0 + m_pia.m_rx * x + m_pia.m_ry * y + m_pia.m_rz * z +
567  m_pia.m_rxx * x * x + m_pia.m_rxy * x * y + m_pia.m_rxz * x * z +
568  m_pia.m_ryy * y * y + m_pia.m_ryz * y * z + m_pia.m_rzz * z * z;
569 
570  ipt.x = m_pia.m_c0 + m_pia.m_cx * x + m_pia.m_cy * y + m_pia.m_cz * z +
571  m_pia.m_cxx * x * x + m_pia.m_cxy * x * y + m_pia.m_cxz * x * z +
572  m_pia.m_cyy * y * y + m_pia.m_cyz * y * z + m_pia.m_czz * z * z;
573 }
ossim_uint32 x
ossim_uint32 y
ossim_float64 m_cy
Definition: ossimRsmpia.h:79
double y
Definition: ossimDpt.h:165
ossim_float64 m_cxy
Definition: ossimRsmpia.h:83
ossim_float64 m_rz
Definition: ossimRsmpia.h:67
ossim_float64 m_ryy
Definition: ossimRsmpia.h:73
ossim_float64 m_cz
Definition: ossimRsmpia.h:80
ossim_float64 m_r0
Definition: ossimRsmpia.h:64
ossim_float64 m_cxz
Definition: ossimRsmpia.h:84
ossim_float64 m_rzz
Definition: ossimRsmpia.h:75
ossim_float64 m_ry
Definition: ossimRsmpia.h:66
ossimRsmpia m_pia
ossim_float64 m_czz
Definition: ossimRsmpia.h:88
ossim_float64 m_cyy
Definition: ossimRsmpia.h:86
double x
Definition: ossimDpt.h:164
ossim_float64 m_rxx
Definition: ossimRsmpia.h:69
ossim_float64 m_cx
Definition: ossimRsmpia.h:78
ossim_float64 m_ryz
Definition: ossimRsmpia.h:74
ossim_float64 m_cxx
Definition: ossimRsmpia.h:82
ossim_float64 m_rxy
Definition: ossimRsmpia.h:70
ossim_float64 m_c0
Definition: ossimRsmpia.h:77
ossim_float64 m_cyz
Definition: ossimRsmpia.h:87
ossim_float64 m_rxz
Definition: ossimRsmpia.h:71
ossim_float64 m_rx
Definition: ossimRsmpia.h:65

◆ operator=()

const ossimRsmModel & ossimRsmModel::operator= ( const ossimRsmModel rhs)

assignment operator

Definition at line 62 of file ossimRsmModel.cpp.

References m_ida, m_pca, m_pia, and ossimSensorModel::operator=().

Referenced by ossimNitfRsmModel::operator=().

63 {
64  if (this != &rhs)
65  {
67  m_ida = rhs.m_ida;
68  m_pia = rhs.m_pia;
69  m_pca = rhs.m_pca;
70  }
71  return *this;
72 }
const ossimSensorModel & operator=(const ossimSensorModel &rhs)
assignment operator
std::vector< ossimRsmpca > m_pca
ossimRsmpia m_pia
ossimRsmida m_ida

◆ polynomial()

double ossimRsmModel::polynomial ( const double &  x,
const double &  y,
const double &  z,
const ossim_uint32 maxx,
const ossim_uint32 maxy,
const ossim_uint32 maxz,
std::vector< double >  pcf 
) const
protected

Definition at line 575 of file ossimRsmModel.cpp.

References x, and y.

Referenced by lineSampleHeightToWorld(), and worldToLineSample().

578 {
579  double r = 0.0;
580  ossim_uint32 index = 0;
581  for (ossim_uint32 k = 0; k <= maxz; ++k)
582  {
583  for (ossim_uint32 j = 0; j <= maxy; ++j)
584  {
585  for (ossim_uint32 i = 0; i <= maxx; ++i)
586  {
587  r+=pcf[index]*std::pow(x,(double)i)*std::pow(y,(double)j)*std::pow(z,(double)k);
588  ++index;
589  }
590  }
591  }
592  return r;
593 }
ossim_uint32 x
ossim_uint32 y
unsigned int ossim_uint32

◆ print()

std::ostream & ossimRsmModel::print ( std::ostream &  out) const
virtual

print() Extends base-class implementation.

Dumps contents of object to ostream.

Reimplemented from ossimSensorModel.

Definition at line 407 of file ossimRsmModel.cpp.

References saveState().

408 {
409  std::string prefix = "";
410  ossimKeywordlist kwl;
411  saveState( kwl, prefix.c_str() );
412  out << kwl;
413  return out;
414 }
Represents serializable keyword/value map.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saveState Fulfills ossimObject base-class pure virtuals.

◆ saveState()

bool ossimRsmModel::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

saveState Fulfills ossimObject base-class pure virtuals.

Loads and saves geometry KWL files. Returns true if successful.

Reimplemented from ossimSensorModel.

Reimplemented in ossimNitfRsmModel.

Definition at line 416 of file ossimRsmModel.cpp.

Referenced by print().

418 {
419  static const char MODULE[] = "ossimRsmModel::saveState";
420  if (traceExec())
421  {
422  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
423  }
424 
425  kwl.add(prefix, ossimKeywordNames::TYPE_KW, MODEL_TYPE_KW.c_str());
426 
427  //---
428  // Hand off to base class for common stuff:
429  //---
430  ossimSensorModel::saveState(kwl, prefix);
431 
432  std::string pfx = (prefix ? prefix : "" );
433 
434  // IDA:
435  m_ida.saveState( kwl, prefix );
436 
437  // PIA:
438  m_pia.saveState( kwl, prefix );
439 
440  // PCA:
441  for ( ossim_uint32 i = 0; i < m_pca.size(); ++i )
442  {
443  m_pca[i].saveState( kwl, pfx, i );
444  }
445 
446  if (traceExec())
447  {
448  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exited...\n";
449  }
450 
451  return true;
452 }
void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
saveState Saves state to keyword list.
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
std::vector< ossimRsmpca > m_pca
unsigned int ossim_uint32
void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
saveState Saves state to keyword list.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimRsmpia m_pia
ossimRsmida m_ida
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ updateModel()

void ossimRsmModel::updateModel ( )
virtual

VIRTUAL METHOD: updateModel() Following a change to the adjustable parameter set, this virtual is called to permit instances to compute derived quantities after parameter change.

Reimplemented from ossimSensorModel.

Definition at line 389 of file ossimRsmModel.cpp.

390 {
391 }

◆ useForward()

virtual bool ossimRsmModel::useForward ( ) const
inlinevirtual

useForward() return true when it's better (more accurate / fast) to use forward (from ground to image) than inverse(from image to ground)

Implements ossimOptimizableProjection.

Definition at line 70 of file ossimRsmModel.h.

70 {return false;}

◆ validate()

bool ossimRsmModel::validate ( ) const
protected

Performs sanity check on key/required rsm data.

Returns
true on success, false on error.

Definition at line 667 of file ossimRsmModel.cpp.

References ossimRsmpia::m_cssiz, ossimRsmida::m_grndd, m_ida, m_pca, m_pia, ossimRsmpia::m_rnis, ossimRsmpia::m_rssiz, ossimRsmpia::m_tnis, ossimNotify(), ossimNotifyLevel_WARN, and status.

668 {
669  static const char MODULE[] = "ossimRsmModel::validate";
670 
671  bool status = true;
672 
673  if ( (m_pia.m_rnis == 0) || (m_pia.m_rnis == 0) || (m_pia.m_tnis == 0) )
674  {
675  status = false;
677  << MODULE
678  << " ERROR: rsmpia must have at least one section!" << std::endl;
679  }
680 
681  if ( m_pca.size() != m_pia.m_tnis )
682  {
683  status = false;
685  << MODULE
686  << " ERROR: rsmpca array not equal to section count!" << std::endl;
687  }
688  if ( ( m_ida.m_grndd != 'G' ) && ( m_ida.m_grndd != 'H' ) && ( m_ida.m_grndd != 'R' ) )
689  {
690  status = false;
692  << MODULE
693  << " ERROR: rsmida grndd Ground Domain Form not set!" << std::endl;
694  }
695  if ( m_ida.m_grndd == 'R' )
696  {
697  status = false;
699  << MODULE
700  << " ERROR: rsmida grndd Rectangular Ground Domain not supported!" << std::endl;
701  }
702  if ( m_pia.m_rssiz == 0 )
703  {
704  status = false; // divide by zero.
706  << MODULE
707  << " ERROR: rsmpia rrsiz Section row size cannot be zero!" << std::endl;
708  }
709  if ( m_pia.m_cssiz == 0 )
710  {
711  status = false; // divide by zero.
713  << MODULE
714  << " ERROR: rsmpia cssiz Section column size cannot be zero!" << std::endl;
715  }
716 
717  return status;
718 }
ossim_uint32 m_rnis
Definition: ossimRsmpia.h:90
ossim_uint32 m_tnis
Definition: ossimRsmpia.h:92
ossim_uint32 m_cssiz
Definition: ossimRsmpia.h:95
std::vector< ossimRsmpca > m_pca
ossim_uint32 m_rssiz
Definition: ossimRsmpia.h:94
ossimRsmpia m_pia
return status
char m_grndd
Definition: ossimRsmida.h:81
ossimRsmida m_ida
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ worldToLineSample()

void ossimRsmModel::worldToLineSample ( const ossimGpt world_point,
ossimDpt image_point 
) const
virtual

worldToLineSample() Overrides base class implementation.

Directly computes line-sample from the polynomials.

Reimplemented from ossimSensorModel.

Definition at line 84 of file ossimRsmModel.cpp.

References ossim::degreesToRadians(), getPcaIndex(), ossimGpt::hgt, ossimGpt::isHgtNan(), ossimGpt::isLatNan(), ossimGpt::isLonNan(), ossim::isnan(), ossimGpt::lat, ossimDpt::line, ossimGpt::lon, ossimRsmida::m_grndd, m_ida, m_pca, ossimDpt::makeNan(), polynomial(), ossimDpt::samp, x, and y.

86 {
87  if(ground_point.isLatNan() || ground_point.isLonNan() )
88  {
89  img_pt.makeNan();
90  return;
91  }
92 
93  //---
94  // RSMIDA GRNDD Ground Domain Form:
95  // G: Geodetic: range x is -pi to pi, y is -pi/2 to pi/2
96  // H: Geodetic: range x is 0 to 2pi, y is -pi/2 to pi/2 (where image is close to pi.
97  // R: Rectangular (not supported).
98  //---
99 
100  // Initial xyz for computing the pca index.
101  double x;
102  if ( m_ida.m_grndd == 'H' )
103  {
104  x = ossim::degreesToRadians((ground_point.lon >= 0.0) ?
105  ground_point.lon : ground_point.lon + 360.0);
106  }
107  else
108  {
109  x = ossim::degreesToRadians( ground_point.lon );
110  }
111 
112  double y = ossim::degreesToRadians(ground_point.lat);
113  double z = ground_point.hgt;
114  if ( ossim::isnan( z ) )
115  {
116  z = 0.0; // ??? drb
117  }
118 
119  ossim_uint32 pcaIndex = getPcaIndex( x, y, z );
120 
121  //---
122  // Normalize the lat, lon, hgt:
123  // a_norm = (a-offset)/scalefactor
124  //---
125  y = (y - m_pca[pcaIndex].m_ynrmo) / m_pca[pcaIndex].m_ynrmsf;
126  x = (x - m_pca[pcaIndex].m_xnrmo) / m_pca[pcaIndex].m_xnrmsf;
127  if( ground_point.isHgtNan() )
128  {
129  z = ( - m_pca[pcaIndex].m_znrmo) / m_pca[pcaIndex].m_znrmsf;
130  }
131  else
132  {
133  z = (ground_point.hgt - m_pca[pcaIndex].m_znrmo) / m_pca[pcaIndex].m_znrmsf;
134  }
135 
136  double rnNrm = polynomial(x, y, z, m_pca[pcaIndex].m_rnpwrx, m_pca[pcaIndex].m_rnpwry, m_pca[pcaIndex].m_rnpwrz, m_pca[pcaIndex].m_rnpcf);
137  double rdNrm = polynomial(x, y, z, m_pca[pcaIndex].m_rdpwrx, m_pca[pcaIndex].m_rdpwry, m_pca[pcaIndex].m_rdpwrz, m_pca[pcaIndex].m_rdpcf);
138  double cnNrm = polynomial(x, y, z, m_pca[pcaIndex].m_cnpwrx, m_pca[pcaIndex].m_cnpwry, m_pca[pcaIndex].m_cnpwrz, m_pca[pcaIndex].m_cnpcf);
139  double cdNrm = polynomial(x, y, z, m_pca[pcaIndex].m_cdpwrx, m_pca[pcaIndex].m_cdpwry, m_pca[pcaIndex].m_cdpwrz, m_pca[pcaIndex].m_cdpcf);
140 
141  double rNrm = rnNrm / rdNrm;
142  double cNrm = cnNrm / cdNrm;
143 
144  //---
145  // Unnormalize the computed value
146  // a = (a_norm * scalefactor) + offset
147  //
148  // Note:
149  //
150  // RSM (0,0) is upper left corner of pixel(0,0). OSSIM (0,0) is
151  // center of the pixel; hence, the - 0.5. (drb 22 May 2015)
152  //---
153 
154  // img_pt.line = (rNrm * m_rnrmsf) + m_rnrmo;
155  // img_pt.samp = (cNrm * m_cnrmsf) + m_cnrmo;
156  img_pt.line = (rNrm * m_pca[pcaIndex].m_rnrmsf) + m_pca[pcaIndex].m_rnrmo - 0.5;
157  img_pt.samp = (cNrm * m_pca[pcaIndex].m_cnrmsf) + m_pca[pcaIndex].m_cnrmo - 0.5;
158 
159 
160 } // End: ossimRsmModel::worldToLineSample( ... )
ossim_uint32 x
ossim_uint32 y
ossim_uint32 getPcaIndex(const double &x, const double &y, const double &z) const
Gets index into RSM Polynomial Coefficients(rsmpca) container array for a given ground point...
double polynomial(const double &x, const double &y, const double &z, const ossim_uint32 &maxx, const ossim_uint32 &maxy, const ossim_uint32 &maxz, std::vector< double > pcf) const
std::vector< ossimRsmpca > m_pca
double degreesToRadians(double x)
Definition: ossimCommon.h:258
unsigned int ossim_uint32
char m_grndd
Definition: ossimRsmida.h:81
ossimRsmida m_ida
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

Member Data Documentation

◆ m_ida

ossimRsmida ossimRsmModel::m_ida
protected

Definition at line 165 of file ossimRsmModel.h.

Referenced by getPcaIndex(), operator=(), validate(), and worldToLineSample().

◆ m_pca

std::vector<ossimRsmpca> ossimRsmModel::m_pca
protected

◆ m_pia

ossimRsmpia ossimRsmModel::m_pia
protected

Definition at line 166 of file ossimRsmModel.h.

Referenced by getPcaIndex(), lowOrderPolynomial(), operator=(), and validate().


The documentation for this class was generated from the following files: