26 #define d_MAX(a,b) (((a)>(b)) ? a : b) 40 m = (*y1 - *y0) / (
double) (*x1 - *x0);
47 *y1 += m * (maxdim - *x1);
57 m = (*y1 - *y0) / (
double) (*x1 - *x0);
58 *y0 += m * (maxdim - *x0);
72 m = (*y1 - *y0) / (
double) (*x1 - *x0);
73 *y1 += m * (maxdim - *x1);
79 m = (*y1 - *y0) / (
double) (*x1 - *x0);
94 theUlCorner(rect.ul()),
95 theUrCorner(rect.ur()),
96 theLrCorner(rect.lr()),
97 theLlCorner(rect.ll()),
98 theOrientMode(rect.orientMode())
116 std::vector<ossimDpt> vertices;
119 while (polygon.
vertex(index, point))
121 vertices.push_back(point);
149 for(index = 1; index < points.size();index++)
160 *
this =
ossimDrect(minx, miny, maxx, maxy, mode);
164 *
this =
ossimDrect(minx,maxy, maxx, miny, mode);
177 : theOrientMode(mode)
195 *
this =
ossimDrect(minx, miny, maxx, maxy, mode);
199 *
this =
ossimDrect(minx,maxy, maxx, miny, mode);
209 const double& size_x,
210 const double& size_y,
212 : theOrientMode(mode)
214 double dx = fabs(size_x);
215 double dy = fabs(size_y);
217 double minx = center.
x - dx/2.0;
218 double maxx = minx + dx;
220 double miny = center.
y - dy/2.0;
221 double maxy = miny + dy;
224 *
this =
ossimDrect(minx, miny, maxx, maxy, mode);
226 *
this =
ossimDrect(minx,maxy, maxx, miny, mode);
238 if(points.size() > 0)
247 for(index = 1; index < points.size();index++)
306 rtn = ((ulx <= lrx) && (uly <= lry));
312 rtn = ((ulx <= lrx) && (uly <= lry));
407 ul.
x = ((long)(
ul.
x / widthHeight.
x))*widthHeight.
x;
410 ul.
x -= widthHeight.
x;
416 ul.
y = ((long)(
ul.
y / widthHeight.
y))*widthHeight.
y;
419 ul.
y -= widthHeight.
y;
427 lr.
x = ((long)((
lr.
x)/widthHeight.
x)) * widthHeight.
x;
430 lr.
x += widthHeight.
x;
438 lr.
y = ((long)(
lr.
y/widthHeight.
y)) * widthHeight.
y;
441 lr.
y += widthHeight.
y;
451 ul.
x = ((long)(
ul.
x/ widthHeight.
x))*widthHeight.
x;
454 ul.
x -= widthHeight.
x;
459 ul.
y = ((long)(
ul.
y / widthHeight.
y))*widthHeight.
y;
462 ul.
y += widthHeight.
y;
470 lr.
x = ((long)(
lr.
x/widthHeight.
x)) * widthHeight.
x;
473 lr.
x += widthHeight.
x;
481 lr.
y = ((long)(
lr.
y/widthHeight.
y)) * widthHeight.
y;
485 lr.
y -= widthHeight.
y;
551 charString[1] =
'\0';
556 while((in.peek() !=
')')&&
557 (in.peek() !=
'\n') &&
560 charString[0] = in.get();
561 interior += charString;
570 std::vector<ossimString> splitArray;
571 interior.
split(splitArray,
",");
574 if(splitArray.size() >= 4)
581 if(splitArray.size() == 5)
583 orientation = splitArray[4].
downcase();
585 if(orientation ==
"lh")
606 const char* prefix)
const 621 const char* rect = kwl.
find(prefix,
"rect");
664 double maxW =
width()-1;
666 if (clip_1d (&tempShiftP1.
x, &tempShiftP1.
y,
667 &tempShiftP2.
x, &tempShiftP2.
y,
672 if(clip_1d (&tempShiftP1.
y,
675 &tempShiftP2.
x, maxH) == 0)
679 p1 = tempShiftP1-shift;
680 p2 = tempShiftP2-shift;
692 if( (aPoint.
x > clipRect.
lr().
x) )
694 else if( (aPoint.
x < clipRect.
ul().
x) )
699 if( (aPoint.
y < clipRect.
ul().
y) )
701 else if( (aPoint.
y > clipRect.
lr().
y) )
706 if( (aPoint.
y > clipRect.
ul().
y) )
708 else if( (aPoint.
y < clipRect.
lr().
y) )
790 if( (x1 < x0) || (y1 < y0) )
803 if( (x1 < x0) || (y1 < y0) )
846 if (dXleft*dXright < 0.0)
847 edge_point.
x = arg_point.
x;
848 else if (fabs(dXleft) < fabs(dXright))
851 if (dYupper*dYlower < 0.0)
852 edge_point.
y = arg_point.
y;
853 else if (fabs(dYupper) < fabs(dYlower))
void set_uly(ossim_float64 y)
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
void set_ulx(ossim_float64 x)
ossim_float64 width() const
void print(std::ostream &os) const
Represents serializable keyword/value map.
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
const char * find(const char *key) const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
const ossimDpt & ul() const
void initBoundingRect(const std::vector< ossimDpt > &points)
static ossimString toString(bool aValue)
Numeric to string methods.
const ossimIpt & ul() const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
const ossimDrect & operator=(const ossimDrect &rect)
const ossimIpt & ll() const
bool vertex(int index, ossimDpt &tbd_vertex) const
METHOD: vertex(index) Returns the ossimDpt vertex given the index.
const ossimDrect & expand(const ossimDpt &padding)
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimCoordSysOrientMode orientMode() const
ossimDrect clipToRect(const ossimDrect &rect) const
void set_lry(ossim_float64 y)
bool completely_within(const ossimDrect &rect) const
std::ostream & operator<<(std::ostream &os, const ossimDrect &rect)
OSSIM_DLL std::istream & skipws(std::istream &in)
ossimDpt findClosestEdgePointTo(const ossimDpt &arg_point) const
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
void splitToQuad(ossimDrect &ulRect, ossimDrect &urRect, ossimDrect &lrRect, ossimDrect &llRect)
bool toRect(const ossimString &rectString)
expected Format: form 1: ( 30, -90, 512, 512, [LH|RH] ) -x- -y- -w- -h- -Right or left handed- ...
bool intersects(const ossimDrect &rect) const
ossim_float64 height() const
const ossimIpt & ur() const
ossimCoordSysOrientMode theOrientMode
bool clip(ossimDpt &p1, ossimDpt &p2) const
void stretchToTileBoundary(const ossimDpt &widthHeight)
ossimDpt midPoint() const
const ossimDpt & ur() const
static long getCode(const ossimDpt &aPoint, const ossimDrect &clipRect)
const ossimDpt & ll() const
std::basic_istringstream< char > istringstream
Class for char input memory streams.
void set_lrx(ossim_float64 x)
const ossimDpt & lr() const
ossimString toString() const
std::basic_ostream< char > ostream
Base class for char output streams.