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

#include <ossimGrect.h>

Public Member Functions

 ossimGrect ()
 Will default to 0,0,0,0. More...
 
 ossimGrect (const ossimGrect &rect)
 Copies the passed in rectangle to this object. More...
 
 ossimGrect (const ossimGpt &p1, const ossimGpt &p2)
 WIll take two ground points and fill the bounding rect appropriately. More...
 
 ossimGrect (double ulLat, double ulLon, double lrLat, double lrLon, const ossimDatum *aDatum=ossimDatumFactory::instance() ->wgs84())
 Takes the upper left and lower right ground points. More...
 
 ossimGrect (const ossimGpt &point, double latSpacingInDegrees, double lonSpacingInDegrees)
 
 ossimGrect (std::vector< ossimGpt > &points)
 
 ossimGrect (const ossimGpt &p1, const ossimGpt &p2, const ossimGpt &p3, const ossimGpt &p4)
 
const ossimGrectoperator= (const ossimGrect &rect)
 
ossimGpt midPoint () const
 
ossim_float64 height () const
 Returns the height of a rectangle in deg. More...
 
ossim_float64 width () const
 Returns the width of a rectangle in deg. More...
 
ossim_float64 heightMeters () const
 Returns the height of a rectangle in meters. More...
 
ossim_float64 widthMeters () const
 Returns the width of a rectangle in meters using the center lat for scaling EW direction. More...
 
const ossimGptul () const
 
const ossimGptlr () const
 
ossimGpt ur () const
 
ossimGpt ll () const
 
ossimGptul ()
 
ossimGptlr ()
 
void makeNan ()
 
bool isLonLatNan () const
 
bool hasNans () const
 
bool isNan () const
 
bool completely_within (const ossimGrect &rect) const
 
bool intersects (const ossimGrect &rect) const
 
ossimGrect clipToRect (const ossimGrect &rect) const
 
ossimGrect combine (const ossimGrect &rect) const
 
void expandToInclude (const ossimGpt &gpt)
 Expands existing rect to accommodate argument point. More...
 
void expandToInclude (const ossimGrect &rect)
 
bool pointWithin (const ossimGpt &gpt, bool considerHgt=false) const
 METHOD: pointWithin(ossimGpt) More...
 
ossimGrect stretchToEvenBoundary (double latSpacingInDegrees, double lonSpacingInDegrees) const
 
void computeEvenTiles (std::vector< ossimGrect > &result, double latSpacingInDegrees, double lonSpacingInDegrees, bool clipToGeographicBounds=true) const
 

Private Attributes

ossimGpt theUlCorner
 
ossimGpt theLrCorner
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &os, const ossimGrect &rect)
 

Detailed Description

Definition at line 23 of file ossimGrect.h.

Constructor & Destructor Documentation

◆ ossimGrect() [1/7]

ossimGrect::ossimGrect ( )
inline

Will default to 0,0,0,0.

Definition at line 31 of file ossimGrect.h.

Referenced by clipToRect(), combine(), computeEvenTiles(), and stretchToEvenBoundary().

32  :
33  theUlCorner(0.0, 0.0, 0.0),
34  theLrCorner(0.0, 0.0, 0.0)
35  {}
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ossimGrect() [2/7]

ossimGrect::ossimGrect ( const ossimGrect rect)
inline

Copies the passed in rectangle to this object.

Definition at line 41 of file ossimGrect.h.

42  :
43  theUlCorner(rect.ul()),
44  theLrCorner(rect.lr())
45  {}
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ ossimGrect() [3/7]

ossimGrect::ossimGrect ( const ossimGpt p1,
const ossimGpt p2 
)

WIll take two ground points and fill the bounding rect appropriately.

Definition at line 74 of file ossimGrect.cpp.

References ossimGpt::hgt, ossimGpt::lat, ossimGpt::lon, theLrCorner, and theUlCorner.

75 {
76  if(p1.lon < p2.lon)
77  {
78  theUlCorner.lon = p1.lon;
79  theLrCorner.lon = p2.lon;
80  }
81  else
82  {
83  theUlCorner.lon = p2.lon;
84  theLrCorner.lon = p1.lon;
85  }
86 
87  if(p1.lat > p2.lat)
88  {
89  theUlCorner.lat = p1.lat;
90  theLrCorner.lat = p2.lat;
91  }
92  else
93  {
94  theUlCorner.lat = p2.lat;
95  theLrCorner.lat = p1.lat;
96  }
97 
98  if(p1.hgt > p2.hgt)
99  {
100  theUlCorner.hgt = p1.hgt;
101  theLrCorner.hgt = p2.hgt;
102  }
103  else
104  {
105  theUlCorner.hgt = p2.hgt;
106  theLrCorner.hgt = p1.hgt;
107  }
108 }
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
ossim_float64 lon
Definition: ossimGpt.h:266
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossim_float64 lat
Definition: ossimGpt.h:265
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ossimGrect() [4/7]

ossimGrect::ossimGrect ( double  ulLat,
double  ulLon,
double  lrLat,
double  lrLon,
const ossimDatum aDatum = ossimDatumFactory::instance()->wgs84() 
)
inline

Takes the upper left and lower right ground points.

Definition at line 57 of file ossimGrect.h.

62  :
63  theUlCorner(ulLat, ulLon,0, aDatum),
64  theLrCorner(lrLat, lrLon, 0, aDatum)
65  {}
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ossimGrect() [5/7]

ossimGrect::ossimGrect ( const ossimGpt point,
double  latSpacingInDegrees,
double  lonSpacingInDegrees 
)
inline

Definition at line 66 of file ossimGrect.h.

69  :
70  theUlCorner(point),
71  theLrCorner(point)
72  {
73  std::vector<ossimGrect> v;
74  computeEvenTiles(v, latSpacingInDegrees, lonSpacingInDegrees);
75  if(v.size())
76  *this = v[0];
77  }
void computeEvenTiles(std::vector< ossimGrect > &result, double latSpacingInDegrees, double lonSpacingInDegrees, bool clipToGeographicBounds=true) const
Definition: ossimGrect.cpp:179
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ossimGrect() [6/7]

ossimGrect::ossimGrect ( std::vector< ossimGpt > &  points)

◆ ossimGrect() [7/7]

ossimGrect::ossimGrect ( const ossimGpt p1,
const ossimGpt p2,
const ossimGpt p3,
const ossimGpt p4 
)

Definition at line 110 of file ossimGrect.cpp.

References ossimGpt::hgt, ossimGpt::latd(), ossimGpt::lond(), theLrCorner, and theUlCorner.

114 {
115  unsigned long index;
116  double minHgt, maxHgt;
117 
118  std::vector<ossimGpt> points(4);
119  points[0] = p1;
120  points[1] = p2;
121  points[2] = p3;
122  points[3] = p4;
123 
124  // initialize everyone to the first point
125  theUlCorner = points[0];
127  minHgt = theUlCorner.hgt;
128  maxHgt = minHgt;
129 
130  // find the bounds
131  for(index = 1; index < points.size(); index++)
132  {
133  // find left most
134  if(theUlCorner.lond() > points[index].lond())
135  {
136  theUlCorner.lond(points[index].lond());
137  } // find right most
138  else if(theLrCorner.lond() < points[index].lond())
139  {
140  theLrCorner.lond(points[index].lond());
141  }
142  //find top most
143  if(points[index].latd() > theUlCorner.latd())
144  {
145  theUlCorner.latd(points[index].latd());
146  }// find bottom most
147  else if(points[index].latd() < theLrCorner.latd())
148  {
149  theLrCorner.latd(points[index].latd());
150  }
151 
152  if (points[index].hgt > maxHgt)
153  maxHgt = points[index].hgt;
154  else if (points[index].hgt < minHgt)
155  minHgt = points[index].hgt;
156  }
157  theUlCorner.hgt = maxHgt;
158  theLrCorner.hgt = minHgt;
159 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

Member Function Documentation

◆ clipToRect()

ossimGrect ossimGrect::clipToRect ( const ossimGrect rect) const
inline

Definition at line 190 of file ossimGrect.h.

References ossimGpt::datum(), ossimGpt::latd(), ossimGpt::lond(), lr(), ossim::max< ossim_float64 >(), ossim::min< ossim_float64 >(), ossimGrect(), and ul().

Referenced by ossimChipProcTool::setAoiToInputs(), and ossimGeographicAnnotationGrid::setViewProjectionInformation().

191 {
192  double ulx, uly, lrx, lry;
193 
194  ulx = ossim::max<ossim_float64>(rect.ul().lond(),ul().lond());
195  uly = ossim::min<ossim_float64>(rect.ul().latd(),ul().latd());
196  lrx = ossim::min<ossim_float64>(rect.lr().lond(),lr().lond());
197  lry = ossim::max<ossim_float64>(rect.lr().latd(),lr().latd());
198 
199  if( lrx < ulx || lry > uly )
200  {
201  return ossimGrect(ossimGpt(0,0,0),ossimGpt(0,0,0));
202  }
203  else
204  {
205  return ossimGrect(ossimGpt(uly, ulx, 0, rect.ul().datum()),
206  ossimGpt(lry, lrx, 0, rect.ul().datum()));
207  }
208 }
ossim_float64 max< ossim_float64 >(ossim_float64 a, ossim_float64 b)
Definition: ossimCommon.h:250
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossimGrect()
Will default to 0,0,0,0.
Definition: ossimGrect.h:31
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
const ossimGpt & ul() const
Definition: ossimGrect.h:252
const ossimGpt & lr() const
Definition: ossimGrect.h:269
ossim_float64 min< ossim_float64 >(ossim_float64 a, ossim_float64 b)
Definition: ossimCommon.h:223

◆ combine()

ossimGrect ossimGrect::combine ( const ossimGrect rect) const
inline

Definition at line 213 of file ossimGrect.h.

References isLonLatNan(), ossimGpt::lat, ossimGpt::lon, lr(), ossimGrect(), and ul().

Referenced by ossimImageElevationDatabase::getBoundingRect().

214 {
215  if (isLonLatNan())
216  return rect;
217 
218  ossimGpt ulCombine;
219  ossimGpt lrCombine;
220 
221  ulCombine.lon = ((ul().lon <= rect.ul().lon)?ul().lon:rect.ul().lon);
222  ulCombine.lat = ((ul().lat >= rect.ul().lat)?ul().lat:rect.ul().lat);
223  lrCombine.lon = ((lr().lon >= rect.lr().lon)?lr().lon:rect.lr().lon);
224  lrCombine.lat = ((lr().lat <= rect.lr().lat)?lr().lat:rect.lr().lat);
225 
226  return ossimGrect(ulCombine, lrCombine);
227 }
ossimGrect()
Will default to 0,0,0,0.
Definition: ossimGrect.h:31
ossim_float64 lon
Definition: ossimGpt.h:266
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossim_float64 lat
Definition: ossimGpt.h:265
bool isLonLatNan() const
Definition: ossimGrect.h:290
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ completely_within()

bool ossimGrect::completely_within ( const ossimGrect rect) const

Returns true if "this" rectangle is contained completely within the input rectangle "rect".

Definition at line 218 of file ossimGrect.cpp.

References isLonLatNan(), ossimGpt::lat, ossimGpt::lon, lr(), theLrCorner, theUlCorner, ul(), and ur().

219 {
220  if(rect.isLonLatNan() || isLonLatNan())
221  {
222  return false;
223  }
224 
225  /* --------------
226  | 1 |
227  | ---------- |
228  | | | |
229  | | | |
230  | | 2 | |
231  | | | |
232  | | | |
233  | ---------- |
234  | |
235  -------------- */
236 
237  bool rtn = true;
238 
239  if ((theUlCorner.lon < rect.ul().lon)||
240  (theUlCorner.lon > rect.ur().lon))
241  {
242  rtn = false;
243  }
244  else if ((theLrCorner.lon > rect.lr().lon)||
245  (theLrCorner.lon < rect.ul().lon))
246  {
247  rtn = false;
248  }
249  else if ((theUlCorner.lat > rect.ul().lat)||
250  (theUlCorner.lat < rect.lr().lat))
251  {
252  rtn = false;
253  }
254  else if ((theLrCorner.lat < rect.lr().lat)||
255  (theLrCorner.lat > rect.ul().lat))
256  {
257  rtn = false;
258  }
259 
260  return rtn;
261 }
ossim_float64 lon
Definition: ossimGpt.h:266
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt ur() const
Definition: ossimGrect.h:257
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossim_float64 lat
Definition: ossimGpt.h:265
ossimGpt theUlCorner
Definition: ossimGrect.h:168
bool isLonLatNan() const
Definition: ossimGrect.h:290
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ computeEvenTiles()

void ossimGrect::computeEvenTiles ( std::vector< ossimGrect > &  result,
double  latSpacingInDegrees,
double  lonSpacingInDegrees,
bool  clipToGeographicBounds = true 
) const

Definition at line 179 of file ossimGrect.cpp.

References ossimGpt::datum(), ossimGpt::latd(), ossimGpt::lond(), ossimGrect(), pointWithin(), stretchToEvenBoundary(), theUlCorner, and ul().

183 {
184  ossimGrect clipRect = ossimGrect(90, -180, -90, 180);
185  result.clear();
186  ossimGrect temp = stretchToEvenBoundary(latSpacingInDegrees,
187  lonSpacingInDegrees);
188 
189  ossimGpt point = temp.ul();
190 
191  while(temp.pointWithin(point))
192  {
193  while(temp.pointWithin(point))
194  {
195  ossimGrect rect(point.latd(),
196  point.lond(),
197  point.latd()-latSpacingInDegrees,
198  point.lond()+lonSpacingInDegrees);
199 
201  rect.theLrCorner.datum( theUlCorner.datum());
202  if(clipToGeographicBounds)
203  {
204  rect = rect.clipToRect(clipRect);
205  }
206  result.push_back(rect);
207 
208  point.lond(point.lond()+lonSpacingInDegrees);
209  }
210  point.lond(temp.ul().lond());
211  point.latd(point.latd()-latSpacingInDegrees);
212  }
213 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossimGrect stretchToEvenBoundary(double latSpacingInDegrees, double lonSpacingInDegrees) const
Definition: ossimGrect.cpp:161
ossimGrect()
Will default to 0,0,0,0.
Definition: ossimGrect.h:31
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
bool pointWithin(const ossimGpt &gpt, bool considerHgt=false) const
METHOD: pointWithin(ossimGpt)
Definition: ossimGrect.h:232
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ expandToInclude() [1/2]

void ossimGrect::expandToInclude ( const ossimGpt gpt)

Expands existing rect to accommodate argument point.

If this object contains NaNs (uninitialized), then the rect is set to 0-area with the arg point as both UL and LR – convenient for establishing bounds in a loop over collection of points. This method does not consider height.

Parameters
gptArgument point.

Definition at line 299 of file ossimGrect.cpp.

References isLonLatNan(), ossimGpt::lat, ossimGpt::lon, pointWithin(), theLrCorner, and theUlCorner.

Referenced by expandToInclude(), ossimRangeDomeTileSource::initialize(), and ossimChipProcTool::setAoiToInputs().

300 {
301  if (isLonLatNan())
302  {
303  theUlCorner = gpt;
304  theLrCorner = gpt;
305  }
306  else if (!pointWithin(gpt, false))
307  {
308  if (gpt.lat > theUlCorner.lat)
309  theUlCorner.lat = gpt.lat;
310  else if (gpt.lat < theLrCorner.lat)
311  theLrCorner.lat = gpt.lat;
312  if (gpt.lon < theUlCorner.lon)
313  theUlCorner.lon = gpt.lon;
314  else if (gpt.lon > theLrCorner.lon)
315  theLrCorner.lon = gpt.lon;
316  }
317 }
bool pointWithin(const ossimGpt &gpt, bool considerHgt=false) const
METHOD: pointWithin(ossimGpt)
Definition: ossimGrect.h:232
ossim_float64 lon
Definition: ossimGpt.h:266
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossim_float64 lat
Definition: ossimGpt.h:265
ossimGpt theUlCorner
Definition: ossimGrect.h:168
bool isLonLatNan() const
Definition: ossimGrect.h:290

◆ expandToInclude() [2/2]

void ossimGrect::expandToInclude ( const ossimGrect rect)

Definition at line 319 of file ossimGrect.cpp.

References expandToInclude(), lr(), and ul().

320 {
321  expandToInclude(rect.ul());
322  expandToInclude(rect.lr());
323 }
void expandToInclude(const ossimGpt &gpt)
Expands existing rect to accommodate argument point.
Definition: ossimGrect.cpp:299
const ossimGpt & ul() const
Definition: ossimGrect.h:252
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ hasNans()

bool ossimGrect::hasNans ( ) const
inline

◆ height()

ossim_float64 ossimGrect::height ( ) const
inline

Returns the height of a rectangle in deg.

Definition at line 242 of file ossimGrect.h.

References ossimGpt::latd(), theLrCorner, and theUlCorner.

Referenced by ossimGeographicAnnotationGrid::draw(), heightMeters(), ossimRangeDomeTileSource::initialize(), and midPoint().

243 {
244  return (theUlCorner.latd() - theLrCorner.latd());
245 }
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ heightMeters()

ossim_float64 ossimGrect::heightMeters ( ) const

Returns the height of a rectangle in meters.

Definition at line 286 of file ossimGrect.cpp.

References height(), midPoint(), and ossimDpt::y.

Referenced by ossimPointCloudImageHandler::getImageGeometry().

287 {
288  ossimDpt scale (midPoint().metersPerDegree());
289  return height()*scale.y;
290 }
ossimGpt midPoint() const
Definition: ossimGrect.h:178
ossim_float64 height() const
Returns the height of a rectangle in deg.
Definition: ossimGrect.h:242

◆ intersects()

bool ossimGrect::intersects ( const ossimGrect rect) const

Returns true if any portion of an input rectangle "rect" intersects "this" rectangle.

Definition at line 266 of file ossimGrect.cpp.

References isLonLatNan(), ossimGpt::lat, ossimGpt::lon, lr(), ossim::max(), ossim::min(), and ul().

Referenced by ossimHlzTool::PatchProcessorJob::level2Test().

267 {
268 
269  if(rect.isLonLatNan() || isLonLatNan())
270  {
271  return false;
272  }
273 
274  ossim_float64 ulx = ossim::max(rect.ul().lon, ul().lon);
275  ossim_float64 lrx = ossim::min(rect.lr().lon, lr().lon);
276  ossim_float64 uly, lry;
277  bool rtn;
278 
279  uly = ossim::min(rect.ul().lat, ul().lat);
280  lry = ossim::max(rect.lr().lat, lr().lat);
281  rtn = ((ulx <= lrx) && (uly >= lry));
282 
283  return (rtn);
284 }
T max(T a, T b)
Definition: ossimCommon.h:236
double ossim_float64
ossim_float64 lon
Definition: ossimGpt.h:266
const ossimGpt & ul() const
Definition: ossimGrect.h:252
T min(T a, T b)
Definition: ossimCommon.h:203
ossim_float64 lat
Definition: ossimGpt.h:265
bool isLonLatNan() const
Definition: ossimGrect.h:290
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ isLonLatNan()

bool ossimGrect::isLonLatNan ( ) const
inline

Definition at line 290 of file ossimGrect.h.

References ossim::isnan(), ossimGpt::lat, ossimGpt::lon, theLrCorner, and theUlCorner.

Referenced by combine(), completely_within(), expandToInclude(), ossimImageElevationDatabase::getBoundingRect(), intersects(), ossimTiledElevationDatabase::mapRegion(), and ossimTiledElevationDatabase::pointHasCoverage().

291 {
292  return ( ossim::isnan(theUlCorner.lat) ||
296 }
ossim_float64 lon
Definition: ossimGpt.h:266
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossim_float64 lat
Definition: ossimGpt.h:265
ossimGpt theUlCorner
Definition: ossimGrect.h:168
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ isNan()

bool ossimGrect::isNan ( ) const
inline

Definition at line 304 of file ossimGrect.h.

References ossimGpt::hasNans(), theLrCorner, and theUlCorner.

305 {
306  return ( theUlCorner.hasNans() &&
307  theLrCorner.hasNans() );
308 }
bool hasNans() const
Definition: ossimGpt.h:135
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ll()

ossimGpt ossimGrect::ll ( ) const
inline

◆ lr() [1/2]

const ossimGpt & ossimGrect::lr ( ) const
inline

◆ lr() [2/2]

ossimGpt & ossimGrect::lr ( )
inline

Definition at line 279 of file ossimGrect.h.

References theLrCorner.

280 {
281  return theLrCorner;
282 }
ossimGpt theLrCorner
Definition: ossimGrect.h:169

◆ makeNan()

void ossimGrect::makeNan ( )
inline

◆ midPoint()

ossimGpt ossimGrect::midPoint ( ) const
inline

Definition at line 178 of file ossimGrect.h.

References height(), ll(), lr(), ul(), and ur().

Referenced by heightMeters(), ossimRangeDomeTileSource::initialize(), ossimViewshedTool::initializeAOI(), and widthMeters().

179 {
180  return ossimGpt((ul().latd() + ur().latd() + ll().latd() + lr().latd())*.25,
181  (ul().lond() + ur().lond() + ll().lond() + lr().lond())*.25,
182  (ul().height()+ur().height()+ll().height()+
183  lr().height())*.25,
184  ul().datum() );
185 }
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt ur() const
Definition: ossimGrect.h:257
ossim_float64 height() const
Returns the height of a rectangle in deg.
Definition: ossimGrect.h:242
const ossimGpt & lr() const
Definition: ossimGrect.h:269
ossimGpt ll() const
Definition: ossimGrect.h:263

◆ operator=()

const ossimGrect& ossimGrect::operator= ( const ossimGrect rect)
inline

Definition at line 85 of file ossimGrect.h.

References lr(), and ul().

86  {
87  theUlCorner = rect.ul();
88  theLrCorner = rect.lr();
89  return *this;
90  }
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ pointWithin()

bool ossimGrect::pointWithin ( const ossimGpt gpt,
bool  considerHgt = false 
) const
inline

METHOD: pointWithin(ossimGpt)

Parameters
gptPoint to test for withinness.
considerHgttrue if the height is to be compared to be between ul.hgt and lr.hgt
Returns
true if argument is inside rectangle (or cuboid when hgt considered)
Note
There is no datum shift applied if gpt is of a different datum than this datum.

Definition at line 232 of file ossimGrect.h.

References ossimGpt::hgt, ossimGpt::lat, ossimGpt::lon, theLrCorner, and theUlCorner.

Referenced by computeEvenTiles(), expandToInclude(), ossimPointCloudHandler::getBlock(), ossimUsgsQuad::getQuadList(), ossimPointCloudImageHandler::getTile(), ossimViewshedTool::optimizeFOV(), ossimElevCellHandler::pointHasCoverage(), and ossimTiledElevationDatabase::pointHasCoverage().

233 {
234  bool within = (gpt.lat <= theUlCorner.lat) && (gpt.lat >= theLrCorner.lat) &&
235  (gpt.lon >= theUlCorner.lon) && (gpt.lon <= theLrCorner.lon);
236  if (considerHgt)
237  within &= (gpt.hgt <= theUlCorner.hgt) && (gpt.hgt >= theLrCorner.hgt);
238 
239  return within;
240 }
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
ossim_float64 lon
Definition: ossimGpt.h:266
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossim_float64 lat
Definition: ossimGpt.h:265
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ stretchToEvenBoundary()

ossimGrect ossimGrect::stretchToEvenBoundary ( double  latSpacingInDegrees,
double  lonSpacingInDegrees 
) const

Definition at line 161 of file ossimGrect.cpp.

References ossimGpt::datum(), ossimGpt::hgt, ossimGpt::latd(), ossimGpt::lond(), lr(), ossimGrect(), theLrCorner, theUlCorner, and ul().

Referenced by computeEvenTiles().

163 {
164  double ulLat = ((long)ceil(theUlCorner.latd()/latSpacingInDegrees))*
165  latSpacingInDegrees;
166  double ulLon = ((long)floor(theUlCorner.lond()/lonSpacingInDegrees))*
167  lonSpacingInDegrees;
168  double lrLat = ((long)floor(theLrCorner.latd()/latSpacingInDegrees))*
169  latSpacingInDegrees;
170  double lrLon = ((long)ceil(theLrCorner.lond()/lonSpacingInDegrees))*
171  lonSpacingInDegrees;
172 
173  ossimGpt ul (ulLat, ulLon, theUlCorner.hgt, theUlCorner.datum());
174  ossimGpt lr (lrLat, lrLon, theLrCorner.hgt, theLrCorner.datum());
175 
176  return ossimGrect(ul, lr);
177 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossimGrect()
Will default to 0,0,0,0.
Definition: ossimGrect.h:31
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
const ossimGpt & ul() const
Definition: ossimGrect.h:252
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168
const ossimGpt & lr() const
Definition: ossimGrect.h:269

◆ ul() [1/2]

const ossimGpt & ossimGrect::ul ( ) const
inline

◆ ul() [2/2]

ossimGpt & ossimGrect::ul ( )
inline

Definition at line 274 of file ossimGrect.h.

References theUlCorner.

275 {
276  return theUlCorner;
277 }
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ ur()

ossimGpt ossimGrect::ur ( ) const
inline

◆ width()

ossim_float64 ossimGrect::width ( ) const
inline

Returns the width of a rectangle in deg.

Definition at line 247 of file ossimGrect.h.

References ossimGpt::lond(), theLrCorner, and theUlCorner.

Referenced by ossimGeographicAnnotationGrid::draw(), ossimRangeDomeTileSource::initialize(), and widthMeters().

248 {
249  return (theLrCorner.lond() - theUlCorner.lond());
250 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossimGpt theLrCorner
Definition: ossimGrect.h:169
ossimGpt theUlCorner
Definition: ossimGrect.h:168

◆ widthMeters()

ossim_float64 ossimGrect::widthMeters ( ) const

Returns the width of a rectangle in meters using the center lat for scaling EW direction.

Definition at line 292 of file ossimGrect.cpp.

References midPoint(), width(), and ossimDpt::x.

Referenced by ossimPointCloudImageHandler::getImageGeometry().

293 {
294  ossimDpt scale (midPoint().metersPerDegree());
295  return width()*scale.x;
296 }
ossim_float64 width() const
Returns the width of a rectangle in deg.
Definition: ossimGrect.h:247
ossimGpt midPoint() const
Definition: ossimGrect.h:178

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  os,
const ossimGrect rect 
)
friend

Member Data Documentation

◆ theLrCorner

ossimGpt ossimGrect::theLrCorner
private

◆ theUlCorner

ossimGpt ossimGrect::theUlCorner
private

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