Пример #1
0
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);
      }
   }
}
Пример #2
0
//*******************************************************************
// Public Constructor:
//*******************************************************************
rspfDpt::rspfDpt(const rspfIpt& pt)
   :
      x(pt.x), y(pt.y)
{
   if(pt.hasNans())
   {
      makeNan();
   }
}
Пример #3
0
//*******************************************************************
// Public Constructor:
//*******************************************************************
ossimFpt::ossimFpt(const ossimDpt& pt)
   :
      x(pt.x), y(pt.y)
{
   if(pt.hasNans())
   {
      makeNan();
   }
}
Пример #4
0
rspfDpt3d::rspfDpt3d(const rspfIpt &aPt)
   :x(aPt.x),
    y(aPt.y),
    z(0)
{
   if(aPt.isNan())
   {
      makeNan();
   }
}
Пример #5
0
//*******************************************************************
// Public Method:
//*******************************************************************
const ossimFpt& ossimFpt::operator=(const ossimIpt& pt)
{
   x = pt.x;
   y = pt.y;
   if(pt.hasNans())
   {
      makeNan();
   }
   
   return *this;
}
Пример #6
0
//*******************************************************************
// Public Method:
//*******************************************************************
const rspfDpt& rspfDpt::operator=(const rspfIpt& pt)
{
   if(pt.hasNans())
   {
      makeNan();
   }
   else
   {
      x = pt.x;
      y = pt.y;
   }
   return *this;
}
Пример #7
0
//*******************************************************************
// 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();
   }
}
Пример #8
0
bool rspfDrect::loadState(const rspfKeywordlist& kwl,
                           const char* prefix)
{
  const char* rect = kwl.find(prefix, "rect");
  makeNan();

  if(rect)
  {
      toRect(rect);
  }
   
   return true;
}
Пример #9
0
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;
}
Пример #10
0
//*****************************************************************************
//  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();
   }
}