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

#include <ossimNitfMapModel.h>

Inheritance diagram for ossimNitfMapModel:
ossimSensorModel ossimProjection ossimOptimizableProjection ossimAdjustableParameterInterface ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimNitfMapModel ()
 
 ossimNitfMapModel (const ossimFilename &init_file)
 
 ossimNitfMapModel (const ossimKeywordlist &geom_kwl)
 
virtual ~ossimNitfMapModel ()
 
virtual ossimObjectdup () const
 
virtual std::ostream & print (std::ostream &out) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual void lineSampleHeightToWorld (const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
 
virtual bool useForward () const
 
- 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...
 
virtual void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &world_point) const
 
virtual void worldToLineSample (const ossimGpt &world_point, ossimDpt &image_point) const
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 
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 void updateModel ()
 
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)
 
virtual void initAdjustableParameters ()
 
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...
 

Static Public Member Functions

static void writeGeomTemplate (ostream &os)
 
- Static Public Member Functions inherited from ossimSensorModel
static void writeGeomTemplate (ostream &os)
 

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
}
 
- 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 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
 

Detailed Description

Definition at line 24 of file ossimNitfMapModel.h.

Constructor & Destructor Documentation

◆ ossimNitfMapModel() [1/3]

ossimNitfMapModel::ossimNitfMapModel ( )

CONSTRUCTORS:

Definition at line 37 of file ossimNitfMapModel.cpp.

39 {
40  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel: entering..." << std::endl;
41 
42  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel: returning..." << std::endl;
43 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ossimNitfMapModel() [2/3]

ossimNitfMapModel::ossimNitfMapModel ( const ossimFilename init_file)

Definition at line 52 of file ossimNitfMapModel.cpp.

53 {
54  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel(init_file): entering..." << std::endl;
55 
56  //***
57  // Open the NITF file:
58  //***
59  FILE* fptr = fopen (init_file.chars(), "r");
60  if (!fptr)
61  {
62  if(traceDebug())
63  {
64  ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimNitfMapModel::ossimNitfMapModel(init_file): Could not open NITF file at: <" << init_file << ">."
65  << " Aborting with error..." << std::endl;
66  }
67  theErrorStatus = 1;
68  return;
69  }
70 
71  //***
72  // Read a sufficient number of bytes to include USE tag:
73  //***
74  char* header = new char [6000];
75  fread(header, 6000, 1, fptr);
76  fclose(fptr);
77  fptr = 0;
78  //***
79  // Validate correct NITF version:
80  //***
81  if (strncmp(header, "NITF02.00", 9))
82  {
83  if (traceDebug())
84  {
85  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel(init_file):"
86  << "\n\tFailed attempt to open <" << init_file
87  << "> as NITF2.00."<<endl;
88  }
89  theErrorStatus = 1;
90  delete [] header;
91  return;
92  }
93 
94  //***
95  // Fetch Image ID:
96  //***
97  char charbuf[80];
98  strncpy(charbuf, &header[447], 28);
99  charbuf[28] = '\0';
100  theImageID = charbuf;
101 
102  //***
103  // Fetch Image Size:
104  //***
105  strncpy(charbuf, &header[737], 8);
106  charbuf[8] = '\0';
107  theImageSize.line = atoi(charbuf);
108  strncpy(charbuf, &header[745], 8);
109  charbuf[8] = '\0';
110  theImageSize.samp = atoi(charbuf);
111 
112 
113  // Fetch Image Size:
114  ossimString coord;
115  strncpy(charbuf, &header[775], 1);
116  charbuf[1] = '\0';
117  coord = charbuf;
118  if (coord == "G")
119  {
120  double degreeLat;
121  double degreeLon;
122  double minute;
123  double second;
124  ossimString hemis;
125 
126  strncpy(charbuf, &header[780], 2);
127  charbuf[2] = '\0';
128  second = atof(charbuf);
129  second = second / 60;
130  strncpy(charbuf, &header[778], 2);
131  charbuf[2] = '\0';
132  minute = atof(charbuf);
133  minute = (minute + second) / 60;
134  strncpy(charbuf, &header[776], 2);
135  charbuf[2] = '\0';
136  degreeLat = atof(charbuf);
137  degreeLat = degreeLat + minute;
138  strncpy(charbuf, &header[782], 1);
139  charbuf[1] = '\0';
140  hemis = charbuf;
141  if (hemis == "S")
142  degreeLat = 0 - degreeLat;
143  strncpy(charbuf, &header[788], 2);
144  charbuf[2] = '\0';
145  second = atof(charbuf);
146  second = second / 60;
147  strncpy(charbuf, &header[786], 2);
148  charbuf[2] = '\0';
149  minute = atof(charbuf);
150  minute = (minute + second) / 60;
151  strncpy(charbuf, &header[783], 3);
152  charbuf[3] = '\0';
153  degreeLon = atof(charbuf);
154  degreeLon = degreeLon + minute;
155  strncpy(charbuf, &header[790], 1);
156  charbuf[1] = '\0';
157  hemis = charbuf;
158  if (hemis == "W")
159  degreeLon = 0 - degreeLon;
160  ossimDpt ip0 (degreeLon, degreeLat);
161  strncpy(charbuf, &header[795], 2);
162  charbuf[2] = '\0';
163  second = atof(charbuf);
164  second = second / 60;
165  strncpy(charbuf, &header[793], 2);
166  charbuf[2] = '\0';
167  minute = atof(charbuf);
168  minute = (minute + second) / 60;
169  strncpy(charbuf, &header[791], 2);
170  charbuf[2] = '\0';
171  degreeLat = atof(charbuf);
172  degreeLat = degreeLat + minute;
173  strncpy(charbuf, &header[797], 1);
174  charbuf[1] = '\0';
175  hemis = charbuf;
176  if (hemis == "S")
177  degreeLat = 0 - degreeLat;
178  strncpy(charbuf, &header[803], 2);
179  charbuf[2] = '\0';
180  second = atof(charbuf);
181  second = second / 60;
182  strncpy(charbuf, &header[801], 2);
183  charbuf[2] = '\0';
184  minute = atof(charbuf);
185  minute = (minute + second) / 60;
186  strncpy(charbuf, &header[798], 3);
187  charbuf[3] = '\0';
188  degreeLon = atof(charbuf);
189  degreeLon = degreeLon + minute;
190  strncpy(charbuf, &header[805], 1);
191  charbuf[1] = '\0';
192  hemis = charbuf;
193  if (hemis == "W")
194  degreeLon = 0 - degreeLon;
195  ossimDpt ip1 (degreeLon, degreeLat);
196  strncpy(charbuf, &header[810], 2);
197  charbuf[2] = '\0';
198  second = atof(charbuf);
199  second = second / 60;
200  strncpy(charbuf, &header[808], 2);
201  charbuf[2] = '\0';
202  minute = atof(charbuf);
203  minute = (minute + second) / 60;
204  strncpy(charbuf, &header[806], 2);
205  charbuf[2] = '\0';
206  degreeLat = atof(charbuf);
207  degreeLat = degreeLat + minute;
208  strncpy(charbuf, &header[812], 1);
209  charbuf[1] = '\0';
210  hemis = charbuf;
211  if (hemis == "S")
212  degreeLat = 0 - degreeLat;
213  strncpy(charbuf, &header[818], 2);
214  charbuf[2] = '\0';
215  second = atof(charbuf);
216  second = second / 60;
217  strncpy(charbuf, &header[816], 2);
218  charbuf[2] = '\0';
219  minute = atof(charbuf);
220  minute = (minute + second) / 60;
221  strncpy(charbuf, &header[813], 3);
222  charbuf[3] = '\0';
223  degreeLon = atof(charbuf);
224  degreeLon = degreeLon + minute;
225  strncpy(charbuf, &header[820], 1);
226  charbuf[1] = '\0';
227  hemis = charbuf;
228  if (hemis == "W")
229  degreeLon = 0 - degreeLon;
230  ossimDpt ip2 (degreeLon, degreeLat);
231  strncpy(charbuf, &header[825], 2);
232  charbuf[2] = '\0';
233  second = atof(charbuf);
234  second = second / 60;
235  strncpy(charbuf, &header[823], 2);
236  charbuf[2] = '\0';
237  minute = atof(charbuf);
238  minute = (minute + second) / 60;
239  strncpy(charbuf, &header[821], 2);
240  charbuf[2] = '\0';
241  degreeLat = atof(charbuf);
242  degreeLat = degreeLat + minute;
243  strncpy(charbuf, &header[827], 1);
244  charbuf[1] = '\0';
245  hemis = charbuf;
246  if (hemis == "S")
247  degreeLat = 0 - degreeLat;
248  strncpy(charbuf, &header[833], 2);
249  charbuf[2] = '\0';
250  second = atof(charbuf);
251  second = second / 60;
252  strncpy(charbuf, &header[831], 2);
253  charbuf[2] = '\0';
254  minute = atof(charbuf);
255  minute = (minute + second) / 60;
256  strncpy(charbuf, &header[828], 3);
257  charbuf[3] = '\0';
258  degreeLon = atof(charbuf);
259  degreeLon = degreeLon + minute;
260  strncpy(charbuf, &header[835], 1);
261  charbuf[1] = '\0';
262  hemis = charbuf;
263  if (hemis == "W")
264  degreeLon = 0 - degreeLon;
265  ossimDpt ip3 (degreeLon, degreeLat);
266 
268  = ossimPolygon (ip0, ip1, ip2, ip3);
269  }
270  else
271  {
272  if(traceDebug())
273  {
274  ossimNotify(ossimNotifyLevel_WARN) << "WARNING ossimNitfMapModel::ossimNitfMapModel(init_file): Could not find the corner coordinates!! "
275  << " Aborting with error..." << std::endl;
276  }
277  theErrorStatus = 1;
278  delete [] header;
279  return;
280  }
281 
282 
283  // Search for the PIAIMC Tag to fetch GSD:
284  const char* tag_ptr = strstr(header, PIAIMC_TAG);
285  if (tag_ptr)
286  {
287  //***
288  // Parse the tag for GSD (in inches):
289  //***
290  strncpy(charbuf, &tag_ptr[348], 7);
291  charbuf[7] = '\0';
292  theGSD.line = atof(charbuf)/12.0 * MTRS_PER_FT;
294  }
295  else
296  {
297  if(traceDebug())
298  {
299  ossimNotify(ossimNotifyLevel_WARN) << "WARNING ossimNitfMapModel::ossimNitfMapModel(init_file): Could not find the <" << PIAIMC_TAG
300  << "> tag in the NITF file at: <" << init_file << "> to extract GSD."
301  << " Searching for alternate <" << USE26A_TAG << ">... "<< std::endl;
302  }
303 
304 
305  //***
306  // Search USE26A tag:
307  //***
308  const char* tag_ptr = strstr(header, USE26A_TAG);
309  if (tag_ptr)
310  {
311  //***
312  // Parse the tag for GSD (in inches):
313  //***
314  strncpy(charbuf, &tag_ptr[15], 5);
315  charbuf[6] = '\0';
316  theGSD.line = atof(charbuf)/12.0 * MTRS_PER_FT;
318  }
319  else
320  {
321  if(traceDebug())
322  {
323  ossimNotify(ossimNotifyLevel_WARN) << "WARNING ossimNitfMapModel::ossimNitfMapModel(init_file): Could not find the <" << USE26A_TAG
324  << "> tag in the NITF file at: <" << init_file << "> to extract GSD."
325  << " Searching for alternate <" << USE00A_TAG << ">... "<< std::endl;
326  }
327 
328  //***
329  // Search USE00A tag:
330  //***
331  const char* tag_ptr = strstr(header, USE00A_TAG);
332  if (!tag_ptr)
333  {
334  if(traceDebug())
335  {
336  ossimNotify(ossimNotifyLevel_DEBUG) << "WARNING ossimNitfMapModel::ossimNitfMapModel(init_file): Could not find the <" << USE00A_TAG
337  << "> tag in the NITF file at: <"
338  << init_file << ">." << " Aborting with error..." << std::endl;
339  }
340  theErrorStatus = 1;
341  delete [] header;
342  return;
343  }
344 
345  //***
346  // Parse the tag for GSD (in inches):
347  //***
348  strncpy(charbuf, &tag_ptr[15], 5);
349  charbuf[6] = '\0';
350  theGSD.line = atof(charbuf)/12.0 * MTRS_PER_FT;
352  }
353  }
354 
355  ossimString drivePart;
356  ossimString pathPart;
357  ossimString filePart;
358  ossimString extPart;
359  init_file.split(drivePart,
360  pathPart,
361  filePart,
362  extPart);
363  //***
364  // Save current state:
365  //***
366  ossimFilename geom_filename;
367  geom_filename.merge(drivePart,
368  pathPart,
369  filePart,
370  "geom");
371  ossimKeywordlist geom_kwl;
372  saveState(geom_kwl);
373  geom_kwl.write(geom_filename.chars());
374 
375  delete [] header;
376 
377  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel: Exited..." << std::endl;
378 }
Represents serializable keyword/value map.
ossimString theImageID
double samp
Definition: ossimDpt.h:164
void split(ossimString &drivePart, ossimString &pathPart, ossimString &filePart, ossimString &extPart) const
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
double line
Definition: ossimDpt.h:165
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
ossimPolygon theBoundGndPolygon
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
#define MTRS_PER_FT
ossim_int32 samp
Definition: ossimIpt.h:141
void merge(const ossimString &drivePart, const ossimString &pathPart, const ossimString &filePart, const ossimString &extPart)
ossim_int32 line
Definition: ossimIpt.h:142
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ossimNitfMapModel() [3/3]

ossimNitfMapModel::ossimNitfMapModel ( const ossimKeywordlist geom_kwl)

Definition at line 388 of file ossimNitfMapModel.cpp.

389  : ossimSensorModel()
390 {
391  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel(geom_file): entering..." << std::endl;
392 
393  //***
394  // Parse keywordlist for geometry:
395  //***
396  loadState(geom_kwl);
397 
398  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::ossimNitfMapModel(geom_file): Exited..." << std::endl;
399 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimNitfMapModel()

ossimNitfMapModel::~ossimNitfMapModel ( )
virtual

Definition at line 405 of file ossimNitfMapModel.cpp.

406 {
407  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::~ossimNitfMapModel: entering..." << std::endl;
408  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::~ossimNitfMapModel: returning..." << std::endl;
409 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Function Documentation

◆ dup()

virtual ossimObject* ossimNitfMapModel::dup ( ) const
inlinevirtual

Returns pointer to a new instance, copy of this.

Implements ossimProjection.

Definition at line 39 of file ossimNitfMapModel.h.

39 { return 0; } // TBR

◆ lineSampleHeightToWorld()

void ossimNitfMapModel::lineSampleHeightToWorld ( const ossimDpt lineSampPt,
const double &  heightEllipsoid,
ossimGpt worldPt 
) const
virtual

METHOD: lineSampleHeightToWorld This is the pure virtual that performs the actual work of projecting the image point to the given elevation above Ellipsoid.

Implements ossimSensorModel.

Definition at line 418 of file ossimNitfMapModel.cpp.

421 {
422  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::lineSampleHeightToWorld: entering..." << std::endl;
423 
424  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::lineSampleHeightToWorld: exiting..." << std::endl;
425 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadState()

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

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimSensorModel.

Definition at line 601 of file ossimNitfMapModel.cpp.

603 {
604  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::loadState: entering..." << std::endl;
605 
606  if (traceDebug())
607  {
608  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::loadState:"
609  << "\nInput kwl: " << kwl
610  << std::endl;
611  }
612 
613  const char* value = 0;
614  const char* keyword = 0;
615  bool success = false;
616 
617  //***
618  // Assure this keywordlist contains correct type info:
619  //***
620  value = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
621  if (!value || (strcmp(value, TYPE_NAME(this))))
622  goto loadStateError;
623 
624  //***
625  // Pass on to the base-class for parsing first:
626  //***
627  success = ossimSensorModel::loadState(kwl, prefix);
628  if (!success) goto loadStateError;
629 
630  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::loadState: returning..." << std::endl;
631  return true;
632 
633  //***
634  // Local error handling:
635  //***
636  loadStateError:
637  theErrorStatus++;
638  ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimNitfMapModel::loadState: encountered parsing the following required keyword: "
639  << "<" << keyword << ">. Check the keywordlist for proper syntax."
640  << std::endl;
641 
642  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::loadState: returning with error..." << std::endl;
643  return false;
644 }
#define TYPE_NAME(p)
Definition: ossimRtti.h:326
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
const char * find(const char *key) const
static const char * TYPE_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ print()

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

Extends base-class implementation. Dumps contents of object to ostream.

Reimplemented from ossimSensorModel.

Definition at line 433 of file ossimNitfMapModel.cpp.

References ossimSensorModel::print().

434 {
435  out << "\nDump of ossimNitfMapModel object at " << hex << this << ":"
436  << endl;
437 
438  return ossimSensorModel::print(out);
439 }
virtual std::ostream & print(std::ostream &out) const

◆ saveState()

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

Fulfills ossimObject base-class pure virtuals. Loads and saves geometry KWL files. Returns true if successful.

Reimplemented from ossimSensorModel.

Definition at line 447 of file ossimNitfMapModel.cpp.

449 {
450  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::saveState: entering..." << std::endl;
451 
452 
453  // Hand off to base class for common stuff:
454  ossimSensorModel::saveState(kwl, prefix);
455 
456  kwl.add(prefix,
457  IMAGE_ID_KW,
458  theImageID.chars());
459 
460  kwl.add(prefix,
463  true);
464 
465  kwl.add(prefix,
468  true);
469 
470  kwl.add(prefix,
472  theGSD.line,
473  true);
474 
475  kwl.add(prefix,
477  theGSD.samp,
478  true);
479 
480  kwl.add(prefix,
482  0,
483  true);
484 
485  kwl.add(prefix,
487  0,
488  true);
489 
490  kwl.add(prefix,
492  theImageSize.line - 1,
493  true);
494 
495  kwl.add(prefix,
497  theImageSize.samp - 1,
498  true);
499 
500  ossimDpt ulcorner;
501  if(!theBoundGndPolygon.vertex(0, ulcorner))
502  {
503  ulcorner = ossimDpt(0,0);
504  }
505 
506  kwl.add(prefix,
508  ulcorner.lat,
509  true);
510 
511  kwl.add(prefix,
513  ulcorner.lon,
514  true);
515 
516  kwl.add(prefix,
518  ulcorner.lat,
519  true);
520 
521  kwl.add(prefix,
523  ulcorner.lon,
524  true);
525 
526  ossimDpt corner;
527  if(!theBoundGndPolygon.nextVertex(corner))
528  {
529  corner = ossimDpt(0,0);
530  }
531  kwl.add(prefix,
533  corner.lat,
534  true);
535 
536  kwl.add(prefix,
538  corner.lon,
539  true);
540 
541  ossimDpt lrcorner;
542  if(!theBoundGndPolygon.nextVertex(lrcorner))
543  {
544  lrcorner = ossimDpt(0,0);
545  }
546  kwl.add(prefix,
548  lrcorner.lat,
549  true);
550  kwl.add(prefix,
552  lrcorner.lon,
553  true);
554 
555 
556  if(!theBoundGndPolygon.nextVertex(corner))
557  {
558  corner = ossimDpt(0,0);
559  }
560  kwl.add(prefix,
562  corner.lat,
563  true);
564  kwl.add(prefix,
566  corner.lon,
567  true);
568 
569  kwl.add(prefix,
571  (ulcorner.lat + lrcorner.lat)/2,
572  true);
573  kwl.add(prefix,
575  (lrcorner.lon + ulcorner.lon)/2,
576  true);
577 
578  kwl.add(prefix,
580  fabs((ulcorner.lat - lrcorner.lat))/(theImageSize.line - 1),
581  true);
582  kwl.add(prefix,
584  fabs((lrcorner.lon - ulcorner.lon))/(theImageSize.samp - 1),
585  true);
586 
587  kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimEquDistCylProjection");
588 // kwl.add(prefix, ossimKeywordNames::TYPE_KW, TYPE_NAME(this));
589 
590  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::saveState: returning..." << std::endl;
591  return true;
592 }
static const char * DECIMAL_DEGREES_PER_PIXEL_LAT
static const char * CENTRAL_MERIDIAN_KW
static const char * UL_LAT_KW
static const char * LR_X_KW
bool nextVertex(ossimDpt &tbd_vertex) const
METHOD: nextVertex() Assigns the ossimDpt tbd_vertex following the current vertex.
ossimString theImageID
double samp
Definition: ossimDpt.h:164
static const char * NUMBER_LINES_KW
static const char * TIE_POINT_LON_KW
static const char * LR_LON_KW
bool vertex(int index, ossimDpt &tbd_vertex) const
METHOD: vertex(index) Returns the ossimDpt vertex given the index.
static const char * METERS_PER_PIXEL_Y_KW
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * LR_Y_KW
static const char * LR_LAT_KW
double line
Definition: ossimDpt.h:165
double lat
Definition: ossimDpt.h:165
static const char * UL_X_KW
static const char * LL_LON_KW
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
ossimPolygon theBoundGndPolygon
static const char * DECIMAL_DEGREES_PER_PIXEL_LON
static const char * LL_LAT_KW
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static const char * UL_Y_KW
double lon
Definition: ossimDpt.h:164
static const char * ORIGIN_LATITUDE_KW
ossim_int32 samp
Definition: ossimIpt.h:141
static const char * UL_LON_KW
static const char * UR_LAT_KW
static const char * UR_LON_KW
ossim_int32 line
Definition: ossimIpt.h:142
static const char * TIE_POINT_LAT_KW
static const char * METERS_PER_PIXEL_X_KW
static const char * NUMBER_SAMPLES_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ useForward()

virtual bool ossimNitfMapModel::useForward ( ) const
inlinevirtual

ossimOptimizableProjection

Implements ossimOptimizableProjection.

Definition at line 71 of file ossimNitfMapModel.h.

71 {return false;}

◆ writeGeomTemplate()

void ossimNitfMapModel::writeGeomTemplate ( ostream &  os)
static

Writes a template of geom keywords processed by loadState and saveState to output stream.

Definition at line 652 of file ossimNitfMapModel.cpp.

653 {
654  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::writeGeomTemplate: entering..." << std::endl;
655 
656  os <<
657  "//**************************************************************\n"
658  "// Template for LandSat model keywordlist\n"
659  "//**************************************************************\n"
660  << ossimKeywordNames::TYPE_KW << ": " << "ossimNitfMapModel" << endl;
661 
663 
664  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimNitfMapModel::writeGeomTemplate: returning..." << std::endl;
665  return;
666 }
static const char * TYPE_KW
static void writeGeomTemplate(ostream &os)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

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