OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageGeometry.h
Go to the documentation of this file.
1 //***********************************************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Oscar Kramer (oscarkramer@yahoo.com)
8 //
9 // Description: Class declaration of ossimImageGeometry.
10 //
11 //***********************************************************************************************
12 // $Id: ossimImageGeometry.h 3102 2012-01-18 15:30:20Z oscar.kramer $
13 
14 #ifndef ossimImageGeometry_HEADER
15 #define ossimImageGeometry_HEADER 1
16 
18 #include <ossim/base/ossimObject.h>
19 #include <ossim/base/ossimDpt.h>
20 #include <ossim/base/ossimIpt.h>
21 #include <ossim/base/ossimRtti.h>
22 #include <ossim/base/ossimRefPtr.h>
27 #include <vector>
28 #include <ossim/matrix/newmat.h>
29 #include <ossim/base/ossimDpt3d.h>
31 
32 // Forward class declarations:
33 class ossimDrect;
34 class ossimIrect;
35 class ossimGrect;
36 
37 //***********************************************************************************************
61 //
64 //***********************************************************************************************
66 {
67 public:
68  typedef std::vector<ossim_float64> DeltaParamList;
69 
72  virtual ~ossimImageGeometry();
73 
79  ossimImageGeometry(const ossimImageGeometry& copy_this);
80 
84 
88  bool open(const ossimFilename& image);
89 
98  void rnToRn(const ossimDpt& inRnPt, ossim_uint32 inResolutionLevel,
99  ossim_uint32 outResolutionLevel,ossimDpt& outRnPt) const;
100 
108  void rnToFull(const ossimDpt& rnPt, ossim_uint32 resolutionLevel, ossimDpt& fullPt) const;
109 
116  void fullToRn(const ossimDpt& fullPt, ossim_uint32 resolutionLevel, ossimDpt& rnPt) const;
117 
125  void rnToWorld(const ossimDpt& rnPt, ossim_uint32 resolutionLevel, ossimGpt& wpt) const;
126 
134  void worldToRn(const ossimGpt& wpt, ossim_uint32 resolutionLevel, ossimDpt& rnPt) const;
135 
140  bool localToWorld(const ossimDpt& local_pt, ossimGpt& world_pt) const;
141  bool localToWorld(const ossimDrect& local_rect, ossimGrect& world_rect) const;
142 
146  bool localToWorld(const ossimDpt& local_pt, const double& h_ellipsoid, ossimGpt& world_pt) const;
147 
151  bool worldToLocal(const ossimGpt& world_pt, ossimDpt& local_pt) const;
152  bool worldToLocal(const ossimGrect& world_rect, ossimDrect& local_rect) const;
153 
155  void setTransform(ossim2dTo2dTransform* transform);
156 
158  void setProjection(ossimProjection* projection);
159 
161  const ossim2dTo2dTransform* getTransform() const { return m_transform.get(); }
162  ossim2dTo2dTransform* getTransform() { return m_transform.get(); }
163 
165  const ossimProjection* getProjection() const { return m_projection.get(); }
166  ossimProjection* getProjection() { return m_projection.get(); }
167 
173  bool isMapProjected() const;
174 
180  { return dynamic_cast<const ossimMapProjection*>( m_projection.get() ); }
181 
187  { return dynamic_cast<ossimMapProjection*>( m_projection.get() ); }
188 
190  bool hasProjection() const { return m_projection.valid(); }
191 
193  bool hasTransform() const { return m_transform.valid(); }
194 
196  bool isAffectedByElevation() const;
197 
201  ossimDpt getMetersPerPixel() const;
202 
219  void getMetersPerPixel( ossimDpt& gsd ) const;
220 
224  ossimDpt getDegreesPerPixel() const;
225 
241  void getDegreesPerPixel( ossimDpt& dpp ) const;
242 
245  bool getCornerGpts(ossimGpt& ul, ossimGpt& ur, ossimGpt& lr, ossimGpt& ll) const;
246 
263  void getTiePoint(ossimGpt& tie, bool edge) const;
264 
279  void getTiePoint(ossimDpt& tie, bool edge) const;
280 
282  std::ostream& print(std::ostream& out) const;
283 
286  bool operator==(const ossimImageGeometry& compare_this) const;
287 
289  const ossimImageGeometry& operator=(const ossimImageGeometry& copy_this);
290 
295  ossimDpt decimationFactor(ossim_uint32 r_index) const;
296 
309  void decimationFactor(ossim_uint32 r_index, ossimDpt& result) const;
310 
315  void decimationFactors(std::vector<ossimDpt>& decimations) const;
316 
318  void setDiscreteDecimation(const std::vector<ossimDpt>& decimation_list)
319  { m_decimationFactors = decimation_list; }
320 
323  {
324  return (ossim_uint32)m_decimationFactors.size();
325  }
327  {
328  m_imageSize = size;
329  }
330  const ossimIpt& getImageSize()const
331  {
332  return m_imageSize;
333  }
334 
335  bool getCrossesDateline()const;
336 
337 
338  void getImageEdgePoints(std::vector<ossimDpt>& result, ossim_uint32 partitions = 25)const;
339 
361  void calculatePolyBounds(ossimPolyArea2d& result, ossim_uint32 partitions = 25)const;
362 
371  void getBoundingRect(ossimIrect& bounding_rect) const;
372  void getBoundingRect(ossimDrect& bounding_rect) const; // Overloaded for drect.
373 
374  void getBoundingGroundRect(ossimGrect& bounding_grect) const;
375 
378  virtual ossimObject* dup() const { return new ossimImageGeometry(*this); }
379 
382  virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
383 
385  virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0) const;
386 
399  void setTargetRrds(ossim_uint32 rrds);
400 
406  ossim_uint32 getTargetRrds() const;
407 
413  void applyScale(const ossimDpt& scale, bool recenterTiePoint);
414 
415  virtual bool isEqualTo(const ossimObject& obj, ossimCompareType compareType = OSSIM_COMPARE_FULL)const;
416 
417 
418 
419  // If we have an adjustable parameter interface return one.
420  //
421  // @return a pointer to an ossimAdjustableParameterInterface or NULL if no
422  // adjustable paramters exist
423  //
424  virtual ossimAdjustableParameterInterface* getAdjustableParameterInterface();
425  virtual const ossimAdjustableParameterInterface* getAdjustableParameterInterface()const;
426 
427 
428  // Compute partials from image to ground with respect to the adjustable parameters.
429  //
430  //
431  bool computeImageToGroundPartialsWRTAdjParam(ossimDpt& result,
432  const ossimGpt& gpt,
433  ossim_uint32 idx,
434  ossim_float64 paramDelta=1.0);
435  bool computeImageToGroundPartialsWRTAdjParams(NEWMAT::Matrix& result,
436  const ossimGpt& gpt,
437  ossim_float64 paramDelta=1.0);
438  bool computeImageToGroundPartialsWRTAdjParams(NEWMAT::Matrix& result,
439  const ossimGpt& gpt,
440  const DeltaParamList& deltas);
441 
442  bool computeGroundToImagePartials(NEWMAT::Matrix& result,
443  const ossimGpt& gpt,
444  const ossimDpt3d& deltaLlh);
445 
446  bool computeGroundToImagePartials(NEWMAT::Matrix& result,
447  const ossimGpt& gpt);
448 
453  ossim_float64 upIsUpAngle(const ossimDpt&) const;
454  ossim_float64 upIsUpAngle() const;
455 
460  ossim_float64 northUpAngle() const;
461 
462 protected:
467  void undecimatePoint(const ossimDpt& rnPt,
468  ossim_uint32 resolutionLevel,
469  ossimDpt& outPt) const;
470 
475  void decimatePoint(const ossimDpt& inPt,
476  ossim_uint32 resolutionLevel,
477  ossimDpt& rnPt) const;
478 
481  std::vector<ossimDpt> m_decimationFactors;
482  ossimIpt m_imageSize; // Image width and height
483 
486 
487  TYPE_DATA
488 };
489 
490 #endif /* #ifndef ossimImageGeometry_HEADER */
ossimRefPtr< ossim2dTo2dTransform > m_transform
Maintains local_image-to-full_image transformation.
ossimProjection * getProjection()
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
ossimMapProjection * getAsMapProjection()
const ossimIpt & getImageSize() const
Represents serializable keyword/value map.
const ossimMapProjection * getAsMapProjection() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossim_uint32 m_targetRrds
Target rrds for localToWorld and worldToLocal methods.
ossimCompareType
void setImageSize(const ossimIpt &size)
std::vector< ossim_float64 > DeltaParamList
double ossim_float64
virtual std::ostream & print(std::ostream &out) const
Generic print method.
yy_size_t size
#define TYPE_DATA
Definition: ossimRtti.h:339
unsigned int ossim_uint32
ossimRefPtr< ossimProjection > m_projection
Maintains full_image-to-world_space transformation.
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
void setDiscreteDecimation(const std::vector< ossimDpt > &decimation_list)
Sets the decimation scheme to a discrete list of decimation factors.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossim2dTo2dTransform * getTransform()
ossimReferenced & operator=(const ossimReferenced &)
#define OSSIM_DLL
const ossim2dTo2dTransform * getTransform() const
Access methods for transform (may be NULL pointer).
bool hasProjection() const
Returns TRUE if valid projection defined.
virtual ossimObject * dup() const
Creates a new instance of ossimImageGeometry with the same transform and projection.
std::vector< ossimDpt > m_decimationFactors
List of decimation factors for R-levels.
ossim_uint32 getNumberOfDecimations() const
bool hasTransform() const
Returns TRUE if valid transform defined.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23