36 static const ossimTrace traceExec (
"ossimRsmModel:exec");
37 static const ossimTrace traceDebug (
"ossimRsmModel:debug");
39 static std::string MODEL_TYPE_KW =
"ossimRsmModel";
105 ground_point.
lon : ground_point.
lon + 360.0);
113 double z = ground_point.
hgt;
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;
129 z = ( -
m_pca[pcaIndex].m_znrmo) /
m_pca[pcaIndex].m_znrmsf;
133 z = (ground_point.
hgt -
m_pca[pcaIndex].m_znrmo) /
m_pca[pcaIndex].m_znrmsf;
141 double rNrm = rnNrm / rdNrm;
142 double cNrm = cnNrm / cdNrm;
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;
199 const double& ellHeight,
208 static const int MAX_NUM_ITERATIONS = 100;
209 static const double CONVERGENCE_EPSILON = 0.05;
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);
229 nhgt = (-
m_pca[pcaIndex].m_znrmo) /
m_pca[pcaIndex].m_znrmsf;
233 nhgt = (ellHeight -
m_pca[pcaIndex].m_znrmo) /
m_pca[pcaIndex].m_znrmsf;
236 double epsilonU = CONVERGENCE_EPSILON/
m_pca[pcaIndex].m_rnrmsf;
237 double epsilonV = CONVERGENCE_EPSILON/
m_pca[pcaIndex].m_cnrmsf;
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;
252 double deltaU, deltaV;
253 double dU_dLat, dU_dLon, dV_dLat, dV_dLon, W;
254 double deltaLat, deltaLon;
282 if ((fabs(deltaU) > epsilonU) || (fabs(deltaV) > epsilonV))
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);
304 W = dU_dLon*dV_dLat - dU_dLat*dV_dLon;
309 deltaLat = (dU_dLon*deltaV - dV_dLon*deltaU) / W;
310 deltaLon = (dV_dLat*deltaU - dU_dLat*deltaV) / W;
317 }
while (((fabs(deltaU)>epsilonU) || (fabs(deltaV)>epsilonV))
318 && (iteration < MAX_NUM_ITERATIONS));
322 if (iteration == MAX_NUM_ITERATIONS)
325 <<
"WARNING ossimRsmModel::lineSampleHeightToWorld:\n" 326 <<
"Max number of iterations reached in ground point " 327 <<
"solution. Results are inaccurate." << endl;
339 gpt.
hgt = (nhgt *
m_pca[pcaIndex].m_znrmsf) +
m_pca[pcaIndex].m_znrmo;
370 double vectorLength =
m_pca[pcaIndex].m_znrmsf * 2.0;
375 double intHgt =
m_pca[pcaIndex].m_znrmo + vectorLength;
409 std::string prefix =
"";
417 const char* prefix)
const 419 static const char MODULE[] =
"ossimRsmModel::saveState";
432 std::string pfx = (prefix ? prefix :
"" );
443 m_pca[i].saveState( kwl, pfx, i );
457 static const char MODULE[] =
"ossimRsmModel::loadState";
466 std::string pfx = ( prefix ? prefix :
"" );
468 if ( (type ==
"ossimNitfRsmModel" ) || ( type == MODEL_TYPE_KW ) )
482 if ( pca.
loadState( kwl, pfx, tagIndex ) )
484 m_pca.push_back( pca );
489 <<
"WARNING! RSMPCA[" << tagIndex <<
"] intitialization failed!" 515 << MODULE <<
" exit status = " << (
status?
"true":
"false") <<
"\n";
522 const double&
x,
const double&
y,
const double& z)
const 535 double shift = shiftPoint ? 0.5 : 0.0;
538 double rsn = std::floor( ( ipt.
y + shift - (
double)(
m_ida.
m_minr) ) /
564 const double&
x,
const double&
y,
const double& z,
ossimDpt& ipt )
const 576 const double&
x,
const double&
y,
const double& z,
const ossim_uint32& maxx,
587 r+=pcf[index]*std::pow(
x,(
double)i)*std::pow(
y,(
double)j)*std::pow(z,(
double)k);
596 const double&
x,
const double&
y,
const double& z,
const ossim_uint32& maxx,
610 dr+=j*pcf[index]*std::pow(
x,(
double)i)*std::pow(
y,(
double)(j-1))*std::pow(z,(
double)k);
620 const double&
x,
const double&
y,
const double& z,
const ossim_uint32& maxx,
633 dr += i*pcf[index]*std::pow(
x,(
double)(i-1)) *
634 std::pow(
y,(
double)j)*std::pow(z,(
double)k);
644 const double&
x,
const double&
y,
const double& z,
const ossim_uint32& maxx,
657 dr += k*pcf[index]*std::pow(
x,(
double)i) *
658 std::pow(
y,(
double)j)*std::pow(z,(
double)(k-1));
669 static const char MODULE[] =
"ossimRsmModel::validate";
678 <<
" ERROR: rsmpia must have at least one section!" << std::endl;
686 <<
" ERROR: rsmpca array not equal to section count!" << std::endl;
693 <<
" ERROR: rsmida grndd Ground Domain Form not set!" << std::endl;
700 <<
" ERROR: rsmida grndd Rectangular Ground Domain not supported!" << std::endl;
707 <<
" ERROR: rsmpia rrsiz Section row size cannot be zero!" << std::endl;
714 <<
" ERROR: rsmpia cssiz Section column size cannot be zero!" << std::endl;
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
lineSampleHeightToWorld() Overrides base class pure virtual.
virtual void initAdjustableParameters()
virtual void updateModel()
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
bool validate() const
Performs sanity check on key/required rsm data.
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
virtual void imagingRay(const ossimDpt &image_point, ossimEcefRay &image_ray) const
imagingRay() Overrides base class pure virtual.
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
bool intersectRay(const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
METHOD: intersectRay()
void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
saveState Saves state to keyword list.
const ossimRsmModel & operator=(const ossimRsmModel &rhs)
assignment operator
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...
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
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...
virtual ~ossimRsmModel()
virtual destructor
ossim_float64 hgt
Height in meters above the ellipsiod.
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix, ossim_uint32 index)
loadState Loads state from keyword list.
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
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
void wrap()
Wrap method to maintain longitude between -180 and +180 and latitude between -90 and +90...
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix)
loadState Loads state from keyword list.
static const char * TYPE_KW
double radiansToDegrees(double x)
bool loadState(const ossimKeywordlist &kwl, const std::string &prefix)
loadState Loads state from keyword list.
const ossimSensorModel & operator=(const ossimSensorModel &rhs)
assignment operator
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
std::vector< ossimRsmpca > m_pca
double degreesToRadians(double x)
virtual ossimObject * dup() const
dup() Returns pointer to a new instance, copy of this.
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
ossimRsmModel()
default constructor
virtual void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &world_point) const
lineSampleToWorld() Overrides base class pure virtual.
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
virtual void worldToLineSample(const ossimGpt &world_point, ossimDpt &image_point) const
worldToLineSample() Overrides base class implementation.
virtual std::ostream & print(std::ostream &out) const
print() Extends base-class implementation.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
loadState Fulfills ossimObject base-class pure virtuals.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saveState Fulfills ossimObject base-class pure virtuals.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
RTTI_DEF1(ossimRsmModel, "ossimRsmModel", ossimSensorModel)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.