Exemplo n.º 1
0
void oms::SingleImageChain::setViewCut(const ossimGrect& grect)
{
   std::vector<ossimGpt> pointList(4);
   pointList[0] = grect.ul();
   pointList[1] = grect.ur();
   pointList[2] = grect.lr();
   pointList[3] = grect.ll();
   setViewCut(pointList);
};
void ossimDtedElevationImageSource::snap(const ossimGrect& rect,
                                         const ossimDpt& postSpacing,
                                         ossimGrect& clipRect) const
{
   ossim_float64 d;

   // upper left latitude
   d = (rect.ul().lat - clipRect.ul().lat) / postSpacing.y;
   if (d != 0.0)
   {
      clipRect.ul().lat = floor(d) * postSpacing.y;
   }

   // upper left longitude
   d = (rect.ul().lon - clipRect.ul().lon) / postSpacing.x;
   if (d != 0.0)
   {
      clipRect.ul().lon = ceil(d) * postSpacing.x;
   }

   // upper right latitude
   d = (rect.ul().lat - clipRect.ur().lat) / postSpacing.y;
   if (d != 0.0)
   {
      clipRect.ur().lat = floor(d) * postSpacing.y;
   }

   // upper right longitude
   d = (rect.ul().lon - clipRect.ur().lon) / postSpacing.x;
   if (d != 0.0)
   {
      clipRect.ul().lon = floor(d) * postSpacing.x;
   }

   // lower right latitude
   d = (rect.ul().lat - clipRect.lr().lat) / postSpacing.y;
   if (d != 0.0)
   {
      clipRect.lr().lat = ceil(d) * postSpacing.y;
   }

   // lower right longitude
   d = (rect.ul().lon - clipRect.lr().lon) / postSpacing.x;
   if (d != 0.0)
   {
      clipRect.ul().lon = floor(d) * postSpacing.x;
   }

   // lower left latitude
   d = (rect.ul().lat - clipRect.ll().lat) / postSpacing.y;
   if (d != 0.0)
   {
      clipRect.ll().lat = ceil(d) * postSpacing.y;
   }

   // lower left longitude
   d = (rect.ul().lon - clipRect.ll().lon) / postSpacing.x;
   if (d != 0.0)
   {
      clipRect.ul().lon = ceil(d) * postSpacing.x;
   }
}