コード例 #1
0
void ossimTiledElevationDatabase::getBoundingRect(
   ossimRefPtr<ossimImageGeometry> geom, ossimGrect& boundingRect) const
{
   if ( geom.valid() )
   {
      std::vector<ossimGpt> corner(4);
      if ( geom->getCornerGpts(corner[0], corner[1], corner[2], corner[3]) )
      {
         ossimGpt ulGpt(corner[0]);
         ossimGpt lrGpt(corner[0]);
         for ( ossim_uint32 i = 1; i < 4; ++i )
         {
            if ( corner[i].lon < ulGpt.lon ) ulGpt.lon = corner[i].lon;
            if ( corner[i].lat > ulGpt.lat ) ulGpt.lat = corner[i].lat;
            if ( corner[i].lon > lrGpt.lon ) lrGpt.lon = corner[i].lon;
            if ( corner[i].lat < lrGpt.lat ) lrGpt.lat = corner[i].lat;
         }
         boundingRect = ossimGrect(ulGpt, lrGpt);
      }
      else
      {
         boundingRect.makeNan();
      }
   }
}
コード例 #2
0
void ossimImageElevationDatabase::getBoundingRect(ossimGrect& rect) const
{
   // The bounding rect is the North up rectangle.  So if the underlying image projection is not
   // a geographic projection and there is a rotation this will include null coverage area.
   rect.makeNan();
   std::map<ossim_uint64, ossimImageElevationFileEntry>::const_iterator i = m_entryMap.begin();
   ossimGrect subRect;
   while ( i != m_entryMap.end() )
   {
      subRect = i->second.m_rect;
      if (subRect.isLonLatNan())
      {
         // The DEM source was not yet initialized:
         ossimRefPtr<ossimImageElevationHandler> h = new ossimImageElevationHandler();
         if ( h->open( i->second.m_file ) )
            subRect = h->getBoundingGndRect();
         else
         {
            ++i;
            continue;
         }
      }
      if (rect.isLonLatNan())
         rect = subRect;
      else
         rect = rect.combine(subRect);
      ++i;
   }
}