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

Class to handle transforming image points, rectangles, and offsets from one reduced resolution data set (rrds) level to another. More...

#include <ossimImageModel.h>

Inheritance diagram for ossimImageModel:
ossimObject ossimReferenced ossimImageProjectionModel

Public Member Functions

 ossimImageModel ()
 default constructor More...
 
virtual void initialize (const ossimImageHandler &ih)
 Method to initialize class from an image handler. More...
 
void rnToR0 (ossim_uint32 rrds, const ossimDpt &rnPt, ossimDpt &r0Pt) const
 Get r0 point from rn point. More...
 
void rnToR0 (const ossimDpt &rnPt, ossimDpt &r0Pt) const
 Get r0 point from rn point. More...
 
void r0ToRn (ossim_uint32 rrds, const ossimDpt &r0Pt, ossimDpt &rnPt) const
 Get rn point from r0 point. More...
 
void r0ToRn (const ossimDpt &r0Pt, ossimDpt &rnPt) const
 Get rn point from r0 point. More...
 
void getSubImageOffset (ossim_uint32 rrds, ossimDpt &offset) const
 Get the sub image offset for a given resolution level. More...
 
void getImageRectangle (ossim_uint32 rrds, ossimDrect &rect) const
 Gets the zero-based image rectangle for a given reduced resolution data set. More...
 
void getBoundingRectangle (ossim_uint32 rrds, ossimDrect &rect) const
 Gets the model-based image rectangle for a given reduced resolution data set. More...
 
ossim_uint32 getNumberOfDecimationLevels () const
 
void setTargetRrds (ossim_uint32 rrds)
 Set theTargetRrds data member. More...
 
ossim_uint32 getTargetRrds () const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
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 bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) 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
 

Protected Member Functions

virtual ~ossimImageModel ()
 virtual destructor More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

ossimDpt theSubImageOffset
 Offset from the full image. More...
 
std::vector< ossimDpttheDecimationFactors
 Decimation factors for each rrds level. More...
 
ossim_uint32 theLines
 
ossim_uint32 theSamples
 
ossim_uint32 theTargetRrds
 

Detailed Description

Class to handle transforming image points, rectangles, and offsets from one reduced resolution data set (rrds) level to another.

Derived from ossimObject only so users can pass via the ossimViewInterface::setView method.

Definition at line 33 of file ossimImageModel.h.

Constructor & Destructor Documentation

◆ ossimImageModel()

ossimImageModel::ossimImageModel ( )

default constructor

Definition at line 23 of file ossimImageModel.cpp.

24  : ossimObject(),
27  theLines(0),
28  theSamples(0),
29  theTargetRrds(0)
30 {
31 }
ossim_uint32 theSamples
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
ossim_uint32 theLines
ossim_uint32 theTargetRrds
ossimDpt theSubImageOffset
Offset from the full image.

◆ ~ossimImageModel()

ossimImageModel::~ossimImageModel ( )
protectedvirtual

virtual destructor

Definition at line 33 of file ossimImageModel.cpp.

34 {
35 }

Member Function Documentation

◆ getBoundingRectangle()

void ossimImageModel::getBoundingRectangle ( ossim_uint32  rrds,
ossimDrect rect 
) const

Gets the model-based image rectangle for a given reduced resolution data set.

If this image is a sub image the offset is applied. So if the image has a sub image offset of (1024, 1024), and has 1024 lines and 1024 samples the rectangle for r0 will be: (1024, 1024) (2047, 2047)

Parameters
rrdsThe reduced resolution data set.
rectInitialized with image rectangle for rrds.
Note
Throws ossimException on out of range rrds.

Definition at line 118 of file ossimImageModel.cpp.

References theDecimationFactors, theLines, theSamples, theSubImageOffset, ossimDpt::x, and ossimDpt::y.

120 {
121  if ( rrds < theDecimationFactors.size() )
122  {
125 
126  ossim_float64 lrX = urX + theSamples*theDecimationFactors[rrds].x - 1.0;
127  ossim_float64 lrY = urY + theLines *theDecimationFactors[rrds].y - 1.0;
128  ossimDrect r(0, 0, lrX, lrY);
129  rect = r;
130  }
131  else
132  {
133  std::string e =
134  "ossimImageModel::getBoundingRectangle rrds out of range!";
135  throw ossimException(e);
136  }
137 }
ossim_uint32 theSamples
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
double y
Definition: ossimDpt.h:165
double ossim_float64
ossim_uint32 theLines
double x
Definition: ossimDpt.h:164
ossimDpt theSubImageOffset
Offset from the full image.

◆ getImageRectangle()

void ossimImageModel::getImageRectangle ( ossim_uint32  rrds,
ossimDrect rect 
) const

Gets the zero-based image rectangle for a given reduced resolution data set.

Parameters
rrdsThe reduced resolution data set.
rectInitialized with image rectangle for rrds.
Note
Throws ossimException on out of range rrds.

Definition at line 101 of file ossimImageModel.cpp.

References theDecimationFactors, theLines, and theSamples.

103 {
104  if ( rrds < theDecimationFactors.size() )
105  {
106  ossim_float64 lrX = theSamples * theDecimationFactors[rrds].x - 1.0;
107  ossim_float64 lrY = theLines * theDecimationFactors[rrds].y - 1.0;
108  ossimDrect r(0.0, 0.0, lrX, lrY);
109  rect = r;
110  }
111  else
112  {
113  std::string e = "ossimImageModel::getImageRectangle rrds out of range!";
114  throw ossimException(e);
115  }
116 }
ossim_uint32 theSamples
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
double ossim_float64
ossim_uint32 theLines

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimImageModel::getNumberOfDecimationLevels ( ) const
Returns
This returns the total number of decimation levels.

Definition at line 138 of file ossimImageModel.cpp.

References theDecimationFactors.

139 {
140  return (ossim_uint32)theDecimationFactors.size();
141 }
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
unsigned int ossim_uint32

◆ getSubImageOffset()

void ossimImageModel::getSubImageOffset ( ossim_uint32  rrds,
ossimDpt offset 
) const

Get the sub image offset for a given resolution level.

Parameters
rrdsThe reduced resolution data set.
offsetthe Point to initialize.
Note
Throws ossimException on out of range rrds.

Definition at line 86 of file ossimImageModel.cpp.

References theDecimationFactors, theSubImageOffset, ossimDpt::x, and ossimDpt::y.

88 {
89  if ( rrds < theDecimationFactors.size() )
90  {
91  offset.x = theSubImageOffset.x * theDecimationFactors[rrds].x;
92  offset.y = theSubImageOffset.y * theDecimationFactors[rrds].y;
93  }
94  else
95  {
96  std::string e = "ossimImageModel::getSubImageOffset rrds out of range!";
97  throw ossimException(e);
98  }
99 }
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
double y
Definition: ossimDpt.h:165
double x
Definition: ossimDpt.h:164
ossimDpt theSubImageOffset
Offset from the full image.

◆ getTargetRrds()

ossim_uint32 ossimImageModel::getTargetRrds ( ) const
Returns
The target reduced resolution data set.

Definition at line 148 of file ossimImageModel.cpp.

References theTargetRrds.

149 {
150  return theTargetRrds;
151 }
ossim_uint32 theTargetRrds

◆ initialize()

void ossimImageModel::initialize ( const ossimImageHandler ih)
virtual

Method to initialize class from an image handler.

Parameters
ihImage handler.

Reimplemented in ossimImageProjectionModel.

Definition at line 37 of file ossimImageModel.cpp.

References ossimImageHandler::getDecimationFactors(), ossimImageHandler::getNumberOfLines(), ossimImageHandler::getNumberOfSamples(), theDecimationFactors, theLines, theSamples, and theSubImageOffset.

Referenced by ossimImageProjectionModel::initialize().

38 {
40  theLines = ih.getNumberOfLines(0);
43 }
virtual void getDecimationFactors(vector< ossimDpt > &decimations) const
This returns all decimation for all levels.
ossim_uint32 theSamples
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
ossim_uint32 theLines
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
ossimDpt theSubImageOffset
Offset from the full image.

◆ r0ToRn() [1/2]

void ossimImageModel::r0ToRn ( ossim_uint32  rrds,
const ossimDpt r0Pt,
ossimDpt rnPt 
) const

Get rn point from r0 point.

Parameters
rrdsTarget (rnPt) reduced resolution data set.
r0PtThe image point to tranform.
rnPtthe Point to initialize.
Note
Throws ossimException on out of range rrds.

Definition at line 65 of file ossimImageModel.cpp.

References theDecimationFactors, ossimDpt::x, and ossimDpt::y.

Referenced by r0ToRn().

68 {
69  if ( rrds < theDecimationFactors.size() )
70  {
71  rnPt.x = r0Pt.x * theDecimationFactors[rrds].x;
72  rnPt.y = r0Pt.y * theDecimationFactors[rrds].y;
73  }
74  else
75  {
76  std::string e = "ossimImageModel::r0ToRn rrds out of range!";
77  throw ossimException(e);
78  }
79 }
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
double y
Definition: ossimDpt.h:165
double x
Definition: ossimDpt.h:164

◆ r0ToRn() [2/2]

void ossimImageModel::r0ToRn ( const ossimDpt r0Pt,
ossimDpt rnPt 
) const

Get rn point from r0 point.

This requires calling setTargetRrds(ossim_uint32 rrds) to the level for rnPt.

Parameters
r0PtThe image point to tranform.
rnPtthe Point to initialize.
Note
Throws ossimException on out of range rrds.
See also
setTargetRrds

Definition at line 81 of file ossimImageModel.cpp.

References r0ToRn(), and theTargetRrds.

82 {
83  r0ToRn(theTargetRrds, r0Pt, rnPt);
84 }
void r0ToRn(ossim_uint32 rrds, const ossimDpt &r0Pt, ossimDpt &rnPt) const
Get rn point from r0 point.
ossim_uint32 theTargetRrds

◆ rnToR0() [1/2]

void ossimImageModel::rnToR0 ( ossim_uint32  rrds,
const ossimDpt rnPt,
ossimDpt r0Pt 
) const

Get r0 point from rn point.

Parameters
rrdsSource (rnPt) reduced resolution data set.
rnPtThe image point to tranform.
r0Ptthe Point to initialize.
Note
Throws ossimException on out of range rrds.

Definition at line 45 of file ossimImageModel.cpp.

References theDecimationFactors, ossimDpt::x, and ossimDpt::y.

Referenced by rnToR0().

48 {
49  if ( rrds < theDecimationFactors.size() )
50  {
51  r0Pt.x = rnPt.x / theDecimationFactors[rrds].x;
52  r0Pt.y = rnPt.y / theDecimationFactors[rrds].y;
53  }
54  else
55  {
56  std::string e = "ossimImageModel::rnToR0 rrds out of range!";
57  throw ossimException(e);
58  }
59 }
std::vector< ossimDpt > theDecimationFactors
Decimation factors for each rrds level.
double y
Definition: ossimDpt.h:165
double x
Definition: ossimDpt.h:164

◆ rnToR0() [2/2]

void ossimImageModel::rnToR0 ( const ossimDpt rnPt,
ossimDpt r0Pt 
) const

Get r0 point from rn point.

This requires calling setTargetRrds(ossim_uint32 rrds) to the level for rnPt.

Parameters
rnPtThe image point to tranform.
r0Ptthe Point to initialize.
Note
Throws ossimException on out of range rrds.
See also
setTargetRrds

Definition at line 60 of file ossimImageModel.cpp.

References rnToR0(), and theTargetRrds.

61 {
62  rnToR0(theTargetRrds, rnPt, r0Pt);
63 }
ossim_uint32 theTargetRrds
void rnToR0(ossim_uint32 rrds, const ossimDpt &rnPt, ossimDpt &r0Pt) const
Get r0 point from rn point.

◆ setTargetRrds()

void ossimImageModel::setTargetRrds ( ossim_uint32  rrds)

Set theTargetRrds data member.

This is used by methods rnToR0 and r0ToRn that do not take a rrds argument.

Parameters
rrdsTarget reduced resolution data set.

Definition at line 143 of file ossimImageModel.cpp.

References theTargetRrds.

144 {
145  theTargetRrds = rrds;
146 }
ossim_uint32 theTargetRrds

Member Data Documentation

◆ theDecimationFactors

std::vector<ossimDpt> ossimImageModel::theDecimationFactors
protected

Decimation factors for each rrds level.

Definition at line 180 of file ossimImageModel.h.

Referenced by getBoundingRectangle(), getImageRectangle(), getNumberOfDecimationLevels(), getSubImageOffset(), initialize(), r0ToRn(), and rnToR0().

◆ theLines

ossim_uint32 ossimImageModel::theLines
protected

Definition at line 182 of file ossimImageModel.h.

Referenced by getBoundingRectangle(), getImageRectangle(), and initialize().

◆ theSamples

ossim_uint32 ossimImageModel::theSamples
protected

Definition at line 183 of file ossimImageModel.h.

Referenced by getBoundingRectangle(), getImageRectangle(), and initialize().

◆ theSubImageOffset

ossimDpt ossimImageModel::theSubImageOffset
protected

Offset from the full image.

Definition at line 177 of file ossimImageModel.h.

Referenced by getBoundingRectangle(), getSubImageOffset(), and initialize().

◆ theTargetRrds

ossim_uint32 ossimImageModel::theTargetRrds
protected

Definition at line 184 of file ossimImageModel.h.

Referenced by getTargetRrds(), r0ToRn(), rnToR0(), and setTargetRrds().


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