bool ossimPointCloudImageHandler::setPointCloudHandler(ossimPointCloudHandler* pch)
{
   close();

   // Need to utilize the Point Cloud handler registry to open the PC file:
   m_pch = pch;
   if (!m_pch.valid())
      return false;

   getImageGeometry();
   ossimImageHandler::completeOpen();

   // Needed here after open to make sure that min/max pixels are set for active component/entry
   setCurrentEntry((ossim_uint32)m_activeComponent);

   return true;
}
void ossimSingleImageChain::addGeoPolyCutter()
{
   if(!m_geoPolyCutter.valid())
   {
      m_geoPolyCutter = new ossimGeoPolyCutter();

      //---
      // ossimGeoPolyCutter requires a view geometry to transform the points.
      // So set prior to adding to end of chain if valid.  If not, user is
      // responsible for setting.
      //---
      ossimRefPtr<ossimImageGeometry> geom = getImageGeometry();
      if ( geom.valid() )
      {
         m_geoPolyCutter->setView( geom.get() );
      }
      
      addFirst( m_geoPolyCutter.get() );
   }
}
Example #3
0
ossimRefPtr<ossimImageData> ossimMrSidReader::getTile(
   const ossimIrect& rect, ossim_uint32 resLevel)
{
   LT_STATUS sts = LT_STS_Uninit;

   // This tile source bypassed, or invalid res level, return null tile.
   if(!isSourceEnabled() || !isOpen() || !isValidRLevel(resLevel))
   {
      return ossimRefPtr<ossimImageData>();
   }

   ossimIrect imageBound = getBoundingRect(resLevel);
   if(!rect.intersects(imageBound))
   {
      return ossimRefPtr<ossimImageData>();
   }

   // Check for overview.
   if( resLevel > theMinDwtLevels )
   {
      if(theOverview.valid())
      {
         ossimRefPtr<ossimImageData> tileData = theOverview->getTile(rect, resLevel);
         tileData->setScalarType(getOutputScalarType());
         return tileData;
      }
   }

   theTile->setImageRectangle(rect);

   // Compute clip rectangle with respect to the image bounds.
   ossimIrect clipRect   = rect.clipToRect(imageBound);

   if (rect.completely_within(clipRect) == false)
   {
      // Not filling whole tile so blank it out first.
      theTile->makeBlank();
   }

   lt_uint16 anOssimBandIndex = 0;

   LTIPixel pixel(theReader->getColorSpace(), theNumberOfBands, theReader->getDataType());
   LTISceneBuffer sceneBuffer(pixel, clipRect.width(), clipRect.height(), NULL);

   if (!theGeometry.valid())
   {
      theGeometry = getImageGeometry();
   }
   double mag = theGeometry->decimationFactor(resLevel).lat;
   sts = theImageNavigator->setSceneAsULWH(clipRect.ul().x,
                                           clipRect.ul().y,
                                           clipRect.lr().x - clipRect.ul().x + 1,
                                           clipRect.lr().y - clipRect.ul().y + 1, mag);

   LTIScene scene = theImageNavigator->getScene();
   sts = theReader->read(scene, sceneBuffer);

   if (LT_SUCCESS(sts) == true)
   {
      for(anOssimBandIndex = 0; anOssimBandIndex < theNumberOfBands; anOssimBandIndex++)
      {
         theTile->loadBand(sceneBuffer.getTotalBandData(anOssimBandIndex),
                           clipRect, anOssimBandIndex);
      }
   }

   theTile->validate();
   return theTile;
}