rspfDrect::rspfDrect(const rspfDpt& p1, const rspfDpt& p2, const rspfDpt& p3, const rspfDpt& p4, rspfCoordSysOrientMode mode) : theOrientMode(mode) { if(p1.hasNans()||p2.hasNans()||p3.hasNans()||p4.hasNans()) { makeNan(); } else { double minx, miny; double maxx, maxy; minx = std::min( p1.x, std::min(p2.x, std::min(p3.x, p4.x))); miny = std::min( p1.y, std::min(p2.y, std::min(p3.y, p4.y))); maxx = std::max( p1.x, std::max(p2.x, std::max(p3.x, p4.x))); maxy = std::max( p1.y, std::max(p2.y, std::max(p3.y, p4.y))); if(mode == RSPF_LEFT_HANDED) { *this = rspfDrect(minx, miny, maxx, maxy, mode); } else { *this = rspfDrect(minx,maxy, maxx, miny, mode); } } }
//******************************************************************* // Public Constructor: //******************************************************************* rspfDpt::rspfDpt(const rspfIpt& pt) : x(pt.x), y(pt.y) { if(pt.hasNans()) { makeNan(); } }
//******************************************************************* // Public Constructor: //******************************************************************* ossimFpt::ossimFpt(const ossimDpt& pt) : x(pt.x), y(pt.y) { if(pt.hasNans()) { makeNan(); } }
rspfDpt3d::rspfDpt3d(const rspfIpt &aPt) :x(aPt.x), y(aPt.y), z(0) { if(aPt.isNan()) { makeNan(); } }
//******************************************************************* // Public Method: //******************************************************************* const ossimFpt& ossimFpt::operator=(const ossimIpt& pt) { x = pt.x; y = pt.y; if(pt.hasNans()) { makeNan(); } return *this; }
//******************************************************************* // Public Method: //******************************************************************* const rspfDpt& rspfDpt::operator=(const rspfIpt& pt) { if(pt.hasNans()) { makeNan(); } else { x = pt.x; y = pt.y; } return *this; }
//******************************************************************* // Public Constructor: rspfDrect // //******************************************************************* rspfDrect::rspfDrect(const rspfIrect& rect) : theUlCorner(rect.ul()), theUrCorner(rect.ur()), theLrCorner(rect.lr()), theLlCorner(rect.ll()), theOrientMode(rect.orientMode()) { if(rect.isNan()) { makeNan(); } }
bool rspfDrect::loadState(const rspfKeywordlist& kwl, const char* prefix) { const char* rect = kwl.find(prefix, "rect"); makeNan(); if(rect) { toRect(rect); } return true; }
const rspfDrect& rspfDrect::operator=(const rspfIrect& rect) { if(rect.isNan()) { makeNan(); } else { theUlCorner = rect.ul(); theUrCorner = rect.ur(); theLrCorner = rect.lr(); theLlCorner = rect.ll(); theOrientMode = rect.orientMode(); } return *this; }
//***************************************************************************** // CONSTRUCTOR: rspfDrect(const vector<rspfDpt>& points) // //***************************************************************************** rspfDrect::rspfDrect(const std::vector<rspfDpt>& points, rspfCoordSysOrientMode mode) : theOrientMode (mode) { if(points.size()) { unsigned long index; double minx, miny; double maxx, maxy; minx = points[0].x; miny = points[0].y; maxx = points[0].x; maxy = points[0].y; // find the bounds for(index = 1; index < points.size();index++) { minx = std::min(minx, points[index].x); miny = std::min(miny, points[index].y); maxx = std::max(maxx, points[index].x); maxy = std::max(maxy, points[index].y); } if(theOrientMode == RSPF_LEFT_HANDED) { *this = rspfDrect(minx, miny, maxx, maxy, mode); } else { *this = rspfDrect(minx,maxy, maxx, miny, mode); } } else { makeNan(); } }