当前位置: 首页>>代码示例>>C++>>正文


C++ ossimIrect::width方法代码示例

本文整理汇总了C++中ossimIrect::width方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimIrect::width方法的具体用法?C++ ossimIrect::width怎么用?C++ ossimIrect::width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ossimIrect的用法示例。


在下文中一共展示了ossimIrect::width方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: computeLevels

ossim_uint32 ossim::computeLevels(const ossimIrect& rect)
{
   ossim_uint32 result = 0;
   ossim_uint32 stopDimension = 0;
      
   // Get the stop dimension from ossim preferences.
   const char* lookup = ossimPreferences::instance()->
      findPreference(ossimKeywordNames::OVERVIEW_STOP_DIMENSION_KW);
   if (lookup)
   {
      stopDimension = ossimString(lookup).toUInt32();
   }
   
   if (stopDimension == 0)
   {
      // Use the smallest default tile size.
      ossimIpt tileSize;
      ossim::defaultTileSize(tileSize);
      stopDimension = tileSize.x < tileSize.y ? tileSize.x : tileSize.y;
   }
      
   ossim_uint32 largestImageDimension =
      rect.width() > rect.height() ? rect.width() : rect.height();
   
   while(largestImageDimension > stopDimension)
   {
      largestImageDimension /= 2;
      ++result;
   }
   
   return result;
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:32,代码来源:ossimCommon.cpp

示例2: getDims

void ossim::getDims(const ossimIrect& rect, kdu_core::kdu_dims& dims)
{
   dims.pos.x = rect.ul().x;
   dims.pos.y = rect.ul().y;
   dims.size.x = static_cast<int>(rect.width());
   dims.size.y = static_cast<int>(rect.height());
}
开发者ID:bradh,项目名称:ossim-plugins,代码行数:7,代码来源:ossimKakaduCommon.cpp

示例3: fit

   void ImageViewManipulator::fit(const ossimIrect& inputRect,
                                  const ossimIrect& targetRect)
   {
      ossimImageGeometry* geom = asGeometry();
      double scaleX = static_cast<double>(inputRect.width())/static_cast<double>(targetRect.width());
      double scaleY = static_cast<double>(inputRect.height())/static_cast<double>(targetRect.height());
      double largestScale = ossim::max(scaleX, scaleY);
      ossimDpt saveCenter = m_centerPoint;

      if(geom)
      {
         if(geom->getProjection())
         {
            ossimDpt mpp = geom->getProjection()->getMetersPerPixel();
	         
            mpp.x*=largestScale;
            mpp.y*=largestScale;
            ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(geom->getProjection());
            if(mapProj)
            {
               mapProj->setMetersPerPixel(mpp);
            }

         }
      }
      else 
      {
         ossimImageViewAffineTransform* ivat = getObjectAs<ossimImageViewAffineTransform>();
         if(ivat)
         {
            ossimDpt tempCenter;

            double x = 1.0/largestScale;
            double y = x;
            ivat->scale(x,y);
         }
      }
      m_centerPoint = saveCenter;
      setViewToChains();
		      
      m_scrollView->zoomAnnotation();
   }
开发者ID:Dukeke,项目名称:ossim,代码行数:42,代码来源:ImageViewManipulator.cpp

示例4:

ossim_int32 ossimGui::StaticTileImageCache::computeTileId(const ossimIpt& origin,
						       const ossimIrect& tileBounderyRect,
						       const ossimIpt&   tileSize)
{
  ossim_uint32 numberOfTilesX = tileBounderyRect.width()/tileSize.x;
  
  ossimIpt ul = tileBounderyRect.ul();
  ossimIpt delta = origin - ul;
  
  if((delta.x < 0) ||
     (delta.y < 0) ||
     (delta.x >= (int)tileBounderyRect.width())||
     (delta.y >= (int)tileBounderyRect.height()))
    {
      return -1;
    }
  delta.x /= tileSize.x;
  delta.y /= tileSize.y;
  
  return delta.y*numberOfTilesX + delta.x;
}
开发者ID:star-labs,项目名称:star_ossim,代码行数:21,代码来源:StaticTileImageCache.cpp

示例5: runFilterTemplate

void ossimScaleFilter::runFilterTemplate(T dummy,
                                         const ossimIrect& imageRect,
                                         const ossimIrect& viewRect)
{
   ossimRefPtr<ossimImageData> inputData =
      theInputConnection->getTile(imageRect);

   if(!inputData.valid()   ||
      !inputData->getBuf() ||
      (inputData->getDataObjectStatus() == OSSIM_EMPTY))
   {
      return;
   }

   ossim_int32 h = imageRect.height();
   ossimRefPtr<ossimImageData> tempData =
      ossimImageDataFactory::instance()->create(NULL,
                                                inputData->getScalarType(),
                                                inputData->getNumberOfBands(),
                                                viewRect.width(),
                                                h);
   tempData->setOrigin(ossimIpt(viewRect.ul().x,
                                imageRect.ul().y));
   
   tempData->initialize();
   
   if((m_ScaleFactor.x != 1.0)||
      (m_BlurFactor != 1.0))
   {
      runHorizontalFilterTemplate(dummy,
                                  inputData,
                                  tempData);
      tempData->validate();
   }
   else
   {
      tempData->loadTile(inputData.get());
   }
   
   if((m_ScaleFactor.y != 1.0)||
      (m_BlurFactor != 1.0))
   {
      runVerticalFilterTemplate(dummy,
                                tempData,
                                m_Tile);
   }
   else
   {
      m_Tile->loadTile(tempData.get());
   }
   
   m_Tile->validate();
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:53,代码来源:ossimScaleFilter.cpp

示例6: allocate

void ossimTableRemapper::allocate(const ossimIrect& rect)
{
   //---
   // It's either first getTile or we've had either a resize, so allocate
   // needed stuff...
   //---
   destroy();

   if (theInputConnection)
   {
      ossim_uint32 width  = rect.width();
      ossim_uint32 height = rect.height();
    
      theTile =  ossimImageDataFactory::instance()->create(this,this);
      theTile->setImageRectangle(rect); 
     // theTile =
     //    ossimImageDataFactory::instance()->create(this,
     //                                              getOutputScalarType(),
     //                                              getNumberOfOutputBands(),
     //                                              width,x
     //                                              height);
      theTile->initialize();


      if (theInputScalarType !=  getOutputScalarType() &&
          theTableType == ossimTableRemapper::NATIVE)
      {
         //---
         // We need a temp tile so we can do two remaps
         // inputTile->remapTable->tmpTile then
         // tmpTile->normalize->theTile(unnormalize to new scalar)...
         //---
         theTmpTile 
         = ossimImageDataFactory::instance()->create(this,
                                                     theInputScalarType,
                                                     getNumberOfOutputBands(),
                                                     width,
                                                     height);
         theTmpTile->setMinPix(theTile->getMinPix(), theTile->getNumberOfBands());
         theTmpTile->initialize();

      }

      if (theTableType == ossimTableRemapper::NORMALIZED ||
          theInputScalarType != theOutputScalarType)
      {
         theNormBuf = new ossim_float64[theTile->getSize()];
      }
   }
}
开发者ID:hunterfu,项目名称:ossim,代码行数:50,代码来源:ossimTableRemapper.cpp

示例7: scaleRect

//**************************************************************************************************
ossimIrect ossimScaleFilter::scaleRect(const ossimIrect input,
                                       const ossimDpt& scaleFactor)const
{
   ossimIpt origin(ossim::round<int>(input.ul().x*scaleFactor.x),
                   ossim::round<int>(input.ul().y*scaleFactor.y));
   ossim_int32 w = ossim::round<int>(input.width()*scaleFactor.x);
   ossim_int32 h = ossim::round<int>(input.height()*scaleFactor.y);

   if(w < 1) w = 1;
   if(h < 1) h = 1;
   
   return ossimIrect(origin.x,
                     origin.y,
                     origin.x + (w-1),
                     origin.y + (h-1));
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:17,代码来源:ossimScaleFilter.cpp

示例8: getTile

ossimRefPtr<ossimImageData> ossimFftFilter::getTile(const ossimIrect& rect,
                                                    ossim_uint32 resLevel)
{
   if(!isSourceEnabled())
      return ossimImageSourceFilter::getTile(rect, resLevel);
   
   ossimIrect tempRequest = rect;

   ossim_uint32 w = rect.width();
   ossim_uint32 h = rect.height();
   
   if(w & 1)
      ++w;
   if(h&1)
      ++h;

   tempRequest = ossimIrect(rect.ul().x,         rect.ul().y,
                            rect.ul().x + (w-1), rect.ul().y + (h-1));
   
   ossimRefPtr<ossimImageData> inTile = theScalarRemapper->getTile(tempRequest, resLevel);
   if(!inTile.valid())
      return inTile;
   if(!theTile.valid())
      initialize();
   if(!theTile.valid() || !inTile->getBuf())
      return theTile;
   
   theTile->setImageRectangle(rect);
   ossimRefPtr<ossimImageData> tempTile = theTile;
   
   if(rect != tempRequest)
   {
      tempTile = (ossimImageData*)theTile->dup();
      tempTile->setImageRectangle(tempRequest);
   }

   runFft(inTile, tempTile);
          
   if(tempTile != theTile)
   {
      theTile->loadTile(tempTile.get());
   }
   
   theTile->validate();
   return theTile;
}
开发者ID:Srprsr,项目名称:ossim,代码行数:46,代码来源:ossimFftFilter.cpp

示例9: ossimIpt

ossim_int32 ossimGui::StaticTileImageCache::getTileIndex(const ossimIrect& rect,
                                                      const ossimIpt& numberOfTiles,
                                                      ossim_int32 x,
                                                      ossim_int32 y)const
{
   ossimIpt ul = rect.ul();
   ossimIpt delta = ossimIpt(x,y) - ul;

   if((delta.x < 0) ||
      (delta.y < 0) ||
      (delta.x >= (int)rect.width())||
      (delta.y >= (int)rect.height()))
   {
      return -1;
   }
   delta.x /= m_tileSize.x;
   delta.y /= m_tileSize.y;

   return delta.y*numberOfTiles.x + delta.x;
}
开发者ID:star-labs,项目名称:star_ossim,代码行数:20,代码来源:StaticTileImageCache.cpp

示例10: getCompressionRate

ossimString ossimNitfCommon::getCompressionRate(const ossimIrect& rect,
                                                ossim_uint32 bands,
                                                ossimScalarType scalar,
                                                ossim_uint64 lengthInBytes)
{
   ossimString result("");
   
   ossim_float64 uncompressedSize =
      ossim::scalarSizeInBytes(scalar) * rect.width() * rect.height() * bands;
   ossim_float64 bitsPerPix = ossim::getBitsPerPixel(scalar);
   ossim_float64 rate = ( bitsPerPix *
                          (static_cast<ossim_float64>(lengthInBytes) /
                           uncompressedSize) );

   // Multiply by ten as there is an implied decimal point.
   rate *= 10.0;

   // Convert to string with zero precision.
   ossimString s = ossimString::toString(rate, 0);

   if (s.size())
   {
      if (s.size() <= 3)
      {
         result = "N";
         if (s.size() == 2)
         {
            result += "0";
         }
         else if (s.size() == 1)
         {
            result += "00";
         }
         result += s;
      }
   }
   return result;
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:38,代码来源:ossimNitfCommon.cpp

示例11: gridSize

void ossimH5GridModel::initializeModelParams(ossimIrect imageBounds)
{
   theLatGrid.enableExtrapolation();
   theLonGrid.enableExtrapolation();
   theHeightEnabledFlag = false;

   // NOTE: it is assumed that the grid size and spacing is the same for ALL grids:
   ossimIpt gridSize (theLatGrid.size());
   ossimDpt spacing  (theLatGrid.spacing());
   ossimDpt v[4];
   v[0].lat = theLatGrid.getNode(0,0);
   v[0].lon = theLonGrid.getNode(0,0);
   v[1].lat = theLatGrid.getNode(gridSize.x-1, 0);
   v[1].lon = theLonGrid.getNode(gridSize.x-1, 0);
   v[2].lat = theLatGrid.getNode(gridSize.x-1, gridSize.y-1);
   v[2].lon = theLonGrid.getNode(gridSize.x-1, gridSize.y-1);
   v[3].lat = theLatGrid.getNode(0, gridSize.y-1);
   v[3].lon = theLonGrid.getNode(0, gridSize.y-1);

   if ( m_crossesDateline )
   {
      // Longitude values between 0 and 360.
      m_boundGndPolygon = ossimPolygon(4, v);
   }
   
   // Guaranty longitude values are -180 to 180
   for (int i=0; i<4; ++i)
   {
      if (v[i].lon > 180.0) v[i].lon -= 360.0;
   }

   theBoundGndPolygon = ossimPolygon(4, v);

   if ( !m_crossesDateline )
   {
      // Longitude values between -180 and 180.
      m_boundGndPolygon = theBoundGndPolygon;
   }
   
   theImageSize  = ossimDpt(imageBounds.width(), imageBounds.height());
   theRefImgPt   = imageBounds.midPoint();
   theRefGndPt.lat = theLatGrid(theRefImgPt);
   theRefGndPt.lon = theLonGrid(theRefImgPt);
   
   ossimDpt ref_ip_dx (theRefImgPt.x+1.0, theRefImgPt.y    );
   ossimDpt ref_ip_dy (theRefImgPt.x    , theRefImgPt.y+1.0);
   ossimGpt ref_gp_dx (theLatGrid(ref_ip_dx), theLonGrid(ref_ip_dx));
   ossimGpt ref_gp_dy (theLatGrid(ref_ip_dy), theLonGrid(ref_ip_dy));

   theGSD.x   = theRefGndPt.distanceTo(ref_gp_dx);
   theGSD.y   = theRefGndPt.distanceTo(ref_gp_dy);

   theMeanGSD = (theGSD.line + theGSD.samp)/2.0;
   theImageClipRect  = imageBounds;

   // Image is clipped to valid rect so no sub image offset.
   theSubImageOffset = ossimDpt(0.0, 0.0); //imageBounds.ul();

   theRefGndPt.limitLonTo180();

   // debugDump();
   
} // End: initializeModelParams
开发者ID:bradh,项目名称:ossim-plugins,代码行数:63,代码来源:ossimH5GridModel.cpp

示例12: getTile

ossimRefPtr<ossimImageData> ossimClosestToCenterCombiner::getTile(const ossimIrect& rect,
                                                                  ossim_uint32 resLevel)
{
   ossim_uint32 layerIdx = 0;
   if(!isSourceEnabled())
   {
      return ossimImageMosaic::getTile(rect, resLevel);
   }
   if(!theTile.valid())
   {
      allocate();
      if(!theTile.valid())
      {
         return 0;
      }
   }
   theTile->setImageRectangle(rect);
   theTile->makeBlank();
   std::vector<ossimClosestToCenterCombinerInfo > normTileList;
   ossimRefPtr<ossimImageData> currentTile = getNextNormTile(layerIdx, 0, rect);
   while(currentTile.valid())
   {
      normTileList.push_back(ossimClosestToCenterCombinerInfo((ossimImageData*)currentTile->dup(),
                                                              layerIdx));
      currentTile = getNextNormTile(layerIdx, rect, resLevel);
   }

   
   if(normTileList.size() == 1)
   {
      theTile->copyNormalizedBufferToTile((ossim_float32*)normTileList[0].theTile->getBuf());
   }
   else if(normTileList.size() > 1)
   {
      ossimRefPtr<ossimImageData> copyTile    = ossimImageDataFactory::instance()->create(0,
                                                                                          OSSIM_NORMALIZED_FLOAT);
      copyTile->setImageRectangleAndBands(rect,
                                          getNumberOfOutputBands());
      copyTile->initialize();
                                                                                          
      ossim_int32 idx   = 0;
      ossim_uint32 w     = rect.width();
      ossim_uint32 h     = rect.height();
      ossim_uint32 idxW  = 0;
      ossim_uint32 idxH  = 0;
      ossimIpt origin    = rect.ul();
      ossimIpt ulPt      = rect.ul();
      ossim_uint32 band  = 0;
      ossim_uint32 bands = copyTile->getNumberOfBands();
      ossim_uint32 srcBandIdx = 0;
      std::vector<ossim_float32*> bandList(bands);

      for(band = 0; band < bands; ++band)
      {
         bandList[band] = (ossim_float32*)copyTile->getBuf(band);
      }
      ossim_uint32 offset   = 0;
      origin.y = ulPt.y;
      for(idxH = 0; idxH < h; ++idxH)
      {
         origin.x = ulPt.x;
         for(idxW = 0; idxW < w;++idxW)
         {
            idx = findIdx(normTileList, origin, offset);

            if(idx >=0)
            {
               ossim_uint32 tileBands = normTileList[idx].theTile->getNumberOfBands();
               if (tileBands > 0)
               {
                  tileBands -= 1;
                  for(band = 0; band < bands; ++band)
                  {
                     srcBandIdx = ossim::min( tileBands, band );
                     bandList[band][offset] = *(((ossim_float32*)normTileList[idx].theTile->getBuf(srcBandIdx))+offset);
                  }
               }
            }
            ++offset;
            ++origin.x;
         }
         ++origin.y;
      }
      theTile->copyNormalizedBufferToTile((ossim_float32*)copyTile->getBuf());
   }

   theTile->validate();
   
   return theTile;

}
开发者ID:ossimlabs,项目名称:ossim,代码行数:91,代码来源:ossimClosestToCenterCombiner.cpp

示例13: getTile

bool ossimPointCloudImageHandler::getTile(ossimImageData* result, ossim_uint32 resLevel)
{
   // check for all systems go and valid args:
   if (!m_pch.valid() || !result || (result->getScalarType() != OSSIM_FLOAT32)
       || (result->getDataObjectStatus() == OSSIM_NULL) || m_gsd.hasNans())
   {
      return false;
   }

   // Overviews achieved with GSD setting. This may be too slow.
   ossimDpt gsd (m_gsd);
   if (resLevel > 0)
      getGSD(gsd, resLevel);

   // Establish the ground and image rects for this tile:
   const ossimIrect img_tile_rect = result->getImageRectangle();
   const ossimIpt tile_offset (img_tile_rect.ul());
   const ossim_uint32 tile_width = img_tile_rect.width();
   const ossim_uint32 tile_height = img_tile_rect.height();
   const ossim_uint32 tile_size = img_tile_rect.area();

   ossimGpt gnd_ul, gnd_lr;
   ossimDpt dpt_ul (img_tile_rect.ul().x - 0.5, img_tile_rect.ul().y - 0.5);
   ossimDpt dpt_lr (img_tile_rect.lr().x + 0.5, img_tile_rect.lr().y + 0.5);
   theGeometry->rnToWorld(dpt_ul, resLevel, gnd_ul);
   theGeometry->rnToWorld(dpt_lr, resLevel, gnd_lr);
   const ossimGrect gnd_rect (gnd_ul, gnd_lr);

   // Create array of buckets to store accumulated point data.
   ossim_uint32 numBands = result->getNumberOfBands();
   if (numBands > getNumberOfInputBands())
   {
      // This should never happen;
      ossimNotify(ossimNotifyLevel_FATAL)
            << "ossimPointCloudImageHandler::getTile() ERROR: \n"
            << "More bands were requested than was available from the point cloud source. Returning "
            << "blank tile." << endl;
      result->makeBlank();
      return false;
   }
   std::map<ossim_int32, PcrBucket*> accumulator;

   // initialize a point block with desired fields as requested in the reader properties
   ossimPointBlock pointBlock (this);
   pointBlock.setFieldCode(componentToFieldCode());
   m_pch->rewind();

   ossimDpt ipt;
   ossimGpt pos;

#define USE_GETBLOCK
#ifdef USE_GETBLOCK
   m_pch->getBlock(gnd_rect, pointBlock);
   for (ossim_uint32 id=0; id<pointBlock.size(); ++id)
   {
      pos = pointBlock[id]->getPosition();
      theGeometry->worldToRn(pos, resLevel, ipt);
      ipt.x = ossim::round<double,double>(ipt.x) - tile_offset.x;
      ipt.y = ossim::round<double,double>(ipt.y) - tile_offset.y;

      ossim_int32 bucketIndex = ipt.y*tile_width + ipt.x;
      if ((bucketIndex >= 0) && (bucketIndex < (ossim_int32)tile_size))
         addSample(accumulator, bucketIndex, pointBlock[id]);
   }

#else // using getFileBlock
   ossim_uint32 numPoints = m_pch->getNumPoints();
   if (numPoints > ossimPointCloudHandler::DEFAULT_BLOCK_SIZE)
      numPoints = ossimPointCloudHandler::DEFAULT_BLOCK_SIZE;

   // Loop to read all point blocks:
   do
   {
      pointBlock.clear();
      m_pch->getNextFileBlock(pointBlock, numPoints);
      //m_pch->normalizeBlock(pointBlock);

      for (ossim_uint32 id=0; id<pointBlock.size(); ++id)
      {
         // Check that each point in read block is inside the ROI before accumulating it:
         pos = pointBlock[id]->getPosition();
         if (gnd_rect.pointWithin(pos))
         {
            theGeometry->worldToRn(pos, resLevel, ipt);
            ipt.x = ossim::round<double,double>(ipt.x) - tile_offset.x;
            ipt.y = ossim::round<double,double>(ipt.y) - tile_offset.y;

            ossim_int32 bucketIndex = ipt.y*tile_width + ipt.x;
            if ((bucketIndex >= 0) && (bucketIndex < (ossim_int32)tile_size))
               addSample(accumulator, bucketIndex, pointBlock[id]);
         }
      }
   } while (pointBlock.size() == numPoints);
#endif

   // Finished accumulating, need to normalize and fill the tile.
   // We must always blank out the tile as we may not have a point for every pixel.
   normalize(accumulator);
   ossim_float32** buf = new ossim_float32*[numBands];
   std::map<ossim_int32, PcrBucket*>::iterator accum_iter;
//.........这里部分代码省略.........
开发者ID:Srprsr,项目名称:ossim,代码行数:101,代码来源:ossimPointCloudImageHandler.cpp

示例14: getTile

bool ossimLasReader::getTile(ossimImageData* result, ossim_uint32 resLevel)
{
   // static const char MODULE[] = "ossimLibLasReader::getTile(ossimImageData*, level)";

   bool status = false;


   if ( m_hdr && result && (result->getScalarType() == OSSIM_FLOAT32) &&
        (result->getDataObjectStatus() != OSSIM_NULL) &&
        !m_ul.hasNans() && !m_scale.hasNans() )
   {
      status = true;
      
      const ossimIrect  TILE_RECT   = result->getImageRectangle();
      const ossim_int32 TILE_HEIGHT = static_cast<ossim_int32>(TILE_RECT.height());
      const ossim_int32 TILE_WIDTH  = static_cast<ossim_int32>(TILE_RECT.width());
      const ossim_int32 TILE_SIZE   = static_cast<ossim_int32>(TILE_RECT.area());

      const ossim_uint16 ENTRY = m_entry+1;

      // Get the scale for this resLevel:
      ossimDpt scale;
      getScale(scale, resLevel);
      
      // Set the starting upper left of upper left pixel for this tile.
      const ossimDpt UL_PROG_PT( m_ul.x - scale.x / 2.0 + TILE_RECT.ul().x * scale.x,
                                 m_ul.y + scale.y / 2.0 - TILE_RECT.ul().y * scale.y);

      //---
      // Set the lower right to the edge of the tile boundary.  This looks like an
      // "off by one" error but it's not.  We want the ossimDrect::pointWithin to
      // catch any points in the last line sample.
      //---
      const ossimDpt LR_PROG_PT( UL_PROG_PT.x + TILE_WIDTH  * scale.x,
                                 UL_PROG_PT.y - TILE_HEIGHT * scale.y);
      
      const ossimDrect PROJ_RECT(UL_PROG_PT, LR_PROG_PT, OSSIM_RIGHT_HANDED);

#if 0  /* Please leave for debug. (drb) */
      cout << "m_ul: " << m_ul
           << "\nm_scale: " << m_scale
           << "\nscale:   " << scale
           << "\nresult->getScalarType(): " << result->getScalarType()
           << "\nresult->getDataObjectStatus(): " << result->getDataObjectStatus()
           << "\nPROJ_RECT: " << PROJ_RECT
           << "\nTILE_RECT: " << TILE_RECT
           << "\nUL_PROG_PT: " << UL_PROG_PT << endl;
#endif

      const ossim_float64 SCALE_X  = m_hdr->getScaleFactorX();
      const ossim_float64 SCALE_Y  = m_hdr->getScaleFactorY();
      const ossim_float64 SCALE_Z  = m_hdr->getScaleFactorZ();
      const ossim_float64 OFFSET_X = m_hdr->getOffsetX();
      const ossim_float64 OFFSET_Y = m_hdr->getOffsetY();
      const ossim_float64 OFFSET_Z = m_hdr->getOffsetZ();

      // Create array of buckets.
      std::vector<ossimLasReader::Bucket> bucket( TILE_SIZE );

      // Loop through the point data.
      ossimLasPointRecordInterface* lasPtRec = getNewPointRecord();
      ossimDpt lasPt;

      m_str.clear();
      m_str.seekg(m_hdr->getOffsetToPointData());

      while ( m_str.good() )
      {
         // m_str.read((char*)lasPtRec, 28);
         lasPtRec->readStream( m_str );

         if ( lasPtRec->getReturnNumber() == ENTRY )
         {
            lasPt.x = lasPtRec->getX() * SCALE_X + OFFSET_X;
            lasPt.y = lasPtRec->getY() * SCALE_Y + OFFSET_Y;
            if ( m_unitConverter )
            {
               convertToMeters(lasPt.x);
               convertToMeters(lasPt.y);
            }
            if ( PROJ_RECT.pointWithin( lasPt ) )
            {
               // Compute the bucket index:
               ossim_int32 line = static_cast<ossim_int32>((UL_PROG_PT.y - lasPt.y) / scale.y);
               ossim_int32 samp = static_cast<ossim_int32>((lasPt.x - UL_PROG_PT.x) / scale.x );
               ossim_int32 bucketIndex = line * TILE_WIDTH + samp;
               
               // Range check and add if in there.
               if ( ( bucketIndex >= 0 ) && ( bucketIndex < TILE_SIZE ) )
               {
                  ossim_float64 z = lasPtRec->getZ() * SCALE_Z + OFFSET_Z;
                  if (  m_unitConverter ) convertToMeters(z);
                  bucket[bucketIndex].add( z ); 
               }
            }
         }
         if ( m_str.eof() ) break;
      }
      delete lasPtRec;
      lasPtRec = 0;
//.........这里部分代码省略.........
开发者ID:LucHermitte,项目名称:ossim,代码行数:101,代码来源:ossimLasReader.cpp

示例15: getTile

ossimRefPtr<ossimImageData> ossimFeatherMosaic::getTile(const ossimIrect& tileRect,
                                            ossim_uint32 resLevel)
{
   long w = tileRect.width();
   long h = tileRect.height();
   ossimIpt origin = tileRect.ul();
   
   if(!isSourceEnabled())
   {
      return ossimImageMosaic::getTile(tileRect, resLevel);
   }
   if(!theTile||!theAlphaSum||!theResult||!theInputFeatherInformation)
   {
      initialize();

      if(!theTile||!theAlphaSum||!theResult||!theInputFeatherInformation)
      {
         return ossimImageMosaic::getTile(tileRect, resLevel);
      }
   }
   ossim_uint32 size = getNumberOfInputs();
   theAlphaSum->setImageRectangle(tileRect);
   theResult->setImageRectangle(tileRect);
   
   if(size == 0)
   {
      return ossimRefPtr<ossimImageData>();
   }

   if(size == 1)
   {
      return ossimImageMosaic::getTile(tileRect, resLevel);
   }

   long tileW = theTile->getWidth();
   long tileH = theTile->getHeight();
   if((w != tileW)||
      (h != tileH))
   {
      theTile->setWidth(w);
      theTile->setHeight(h);
      if((w*h)!=(tileW*tileH))
      {
         theTile->initialize();
      }
   }
   theTile->setOrigin(origin);
   theTile->makeBlank();
      
   switch(theTile->getScalarType())
   {
      case OSSIM_UCHAR:
      {
         return combine(static_cast<ossim_uint8>(0),
                        tileRect, resLevel);
      }
      case OSSIM_USHORT16:
      case OSSIM_USHORT11:
      {
         return combine(static_cast<ossim_uint16>(0),
                        tileRect, resLevel);
      }
      case OSSIM_SSHORT16:
      {
         return combine(static_cast<ossim_sint16>(0),
                        tileRect, resLevel);
      }
      case OSSIM_DOUBLE:
      case OSSIM_NORMALIZED_DOUBLE:
      {
         return combine(static_cast<double>(0),
                        tileRect, resLevel);
      }
      case OSSIM_FLOAT:
      case OSSIM_NORMALIZED_FLOAT:
      {
         return combine(static_cast<float>(0),
                        tileRect, resLevel);
      }
      case OSSIM_SCALAR_UNKNOWN:
      default:
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimFeatherMosaic::getTile: error, unknown scalar type!!!"
            << std::endl;
      }
   }
   return ossimRefPtr<ossimImageData>();
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:89,代码来源:ossimFeatherMosaic.cpp


注:本文中的ossimIrect::width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。