Example #1
0
void ossimShapeObject::getBoundingRect(ossimDrect& result,
                                       ossimCoordSysOrientMode orient)const
{
   double minx, miny, maxx, maxy;
   
   if(theShape)
   {
      getBounds(minx, miny, maxx, maxy);
      
      if(orient == OSSIM_RIGHT_HANDED)
      {
         result = ossimDrect(minx, maxy, maxx, miny, orient);
      }
      else
      {
         result = ossimDrect(minx, miny, maxx, maxy, orient);         
      }
   }
   else
   {
      result = ossimDrect(0,0,0,0,orient);
      result.makeNan();
   }
}
Example #2
0
void ossimFgdcXmlDoc::getBoundingBox(ossimDrect& rect) const
{
   rect.makeNan();
   
   if (isOpen())
   {
      double ll_lat = 0.0;
      double ll_lon = 0.0;
      double lr_lat = 0.0;
      double lr_lon = 0.0;
      double ul_lat = 0.0;
      double ul_lon = 0.0;
      double ur_lat = 0.0;
      double ur_lon = 0.0;
     
      ossimString xpath = "/metadata/idinfo/spdom/lboundng/leftbc";
      bool result = getPath(xpath, ul_lon);
      if (!result)
      {
         xpath = "/metadata/idinfo/spdom/bounding/westbc";
         result = getPath(xpath, ul_lon);
         m_boundInDegree = true;
      }
      if (result)
      {
         ll_lon = ul_lon;
      }
      
      xpath = "/metadata/idinfo/spdom/lboundng/rightbc";
      result = getPath(xpath, ur_lon);
      if (!result)
      {
         xpath = "/metadata/idinfo/spdom/bounding/eastbc";
         result = getPath(xpath, ur_lon);
         m_boundInDegree = true;
      }
      if (result)
      {
         lr_lon = ur_lon;
      }

      xpath = "/metadata/idinfo/spdom/lboundng/bottombc";
      result = getPath(xpath, ll_lat);
      if (!result)
      {
         xpath = "/metadata/idinfo/spdom/bounding/southbc";
         result = getPath(xpath, ll_lat);
         m_boundInDegree = true;
      }
      if (result)
      {
         lr_lat = ll_lat;
      }

      xpath = "/metadata/idinfo/spdom/lboundng/topbc";
      result = getPath(xpath, ul_lat);
      if (!result)
      {
         xpath = "/metadata/idinfo/spdom/bounding/northbc";
         result = getPath(xpath, ul_lat);
         m_boundInDegree = true;
      }
      if (result)
      {
         ur_lat = ul_lat;
      }
      
      rect = ossimDrect(ossimDpt(ul_lon, ul_lat),
                        ossimDpt(ur_lon, ur_lat),
                        ossimDpt(lr_lon, lr_lat),
                        ossimDpt(ll_lon, ll_lat), OSSIM_RIGHT_HANDED); 
   }
}