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


C++ DimensionDescriptor::getOnDiskNumber方法代码示例

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


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

示例1: UnitPtr

CachedPage::UnitPtr Jpeg2000Pager::fetchUnit(DataRequest* pOriginalRequest)
{
   if (pOriginalRequest == NULL)
   {
      return CachedPage::UnitPtr();
   }

   // Check for interleave conversions, which are not supported by this pager
   const RasterElement* pRaster = getRasterElement();
   VERIFYRV(pRaster != NULL, CachedPage::UnitPtr());

   const RasterDataDescriptor* pDescriptor = dynamic_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor());
   VERIFYRV(pDescriptor != NULL, CachedPage::UnitPtr());

   const RasterFileDescriptor* pFileDescriptor =
      dynamic_cast<const RasterFileDescriptor*>(pDescriptor->getFileDescriptor());
   VERIFYRV(pFileDescriptor != NULL, CachedPage::UnitPtr());

   if (pFileDescriptor->getBandCount() > 1)
   {
      InterleaveFormatType requestedInterleave = pOriginalRequest->getInterleaveFormat();
      InterleaveFormatType fileInterleave = pFileDescriptor->getInterleaveFormat();
      if (requestedInterleave != fileInterleave)
      {
         return CachedPage::UnitPtr();
      }

      VERIFYRV(requestedInterleave == BIP, CachedPage::UnitPtr());   // The JPEG2000 data is stored BIP
   }

   // Get and validate the extents of the data to be loaded
   DimensionDescriptor startRow = pOriginalRequest->getStartRow();
   DimensionDescriptor stopRow = pOriginalRequest->getStopRow();
   unsigned int concurrentRows = pOriginalRequest->getConcurrentRows();

   DimensionDescriptor startColumn = pOriginalRequest->getStartColumn();
   DimensionDescriptor stopColumn = pOriginalRequest->getStopColumn();
   unsigned int concurrentColumns = pOriginalRequest->getConcurrentColumns();

   DimensionDescriptor startBand = pOriginalRequest->getStartBand();
   DimensionDescriptor stopBand = pOriginalRequest->getStopBand();

   if ((startRow.isOnDiskNumberValid() == false) || (stopRow.isOnDiskNumberValid() == false) ||
      (startColumn.isOnDiskNumberValid() == false) || (stopColumn.isOnDiskNumberValid() == false) ||
      (startBand.isOnDiskNumberValid() == false) || (stopBand.isOnDiskNumberValid() == false))
   {
      return CachedPage::UnitPtr();
   }

   if ((startRow.getOnDiskNumber() > stopRow.getOnDiskNumber()) ||
      (startColumn.getOnDiskNumber() > stopColumn.getOnDiskNumber()) ||
      (startBand.getOnDiskNumber() > stopBand.getOnDiskNumber()))
   {
      return CachedPage::UnitPtr();
   }

   if ((startRow.getActiveNumber() + concurrentRows - 1) > stopRow.getActiveNumber())
   {
      concurrentRows = stopRow.getActiveNumber() - startRow.getActiveNumber() + 1;
   }

   if ((startColumn.getActiveNumber() + concurrentColumns - 1) > stopColumn.getActiveNumber())
   {
      concurrentColumns = stopColumn.getActiveNumber() - startColumn.getActiveNumber() + 1;
   }

   // Populate the image data based on the output data type
   EncodingType outputDataType = pDescriptor->getDataType();
   switch (outputDataType)
   {
   case INT1UBYTE:
      return populateImageData<unsigned char>(startRow, startColumn, concurrentRows, concurrentColumns);

   case INT1SBYTE:
      return populateImageData<signed char>(startRow, startColumn, concurrentRows, concurrentColumns);

   case INT2UBYTES:
      return populateImageData<unsigned short>(startRow, startColumn, concurrentRows, concurrentColumns);

   case INT2SBYTES:
      return populateImageData<signed short>(startRow, startColumn, concurrentRows, concurrentColumns);

   case INT4UBYTES:
      return populateImageData<unsigned int>(startRow, startColumn, concurrentRows, concurrentColumns);

   case INT4SBYTES:
      return populateImageData<signed int>(startRow, startColumn, concurrentRows, concurrentColumns);

   case FLT4BYTES:
      return populateImageData<float>(startRow, startColumn, concurrentRows, concurrentColumns);

   case FLT8BYTES:
      return populateImageData<double>(startRow, startColumn, concurrentRows, concurrentColumns);

   default:
      break;
   }

   return CachedPage::UnitPtr();
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:100,代码来源:Jpeg2000Pager.cpp

示例2: createGcpList

GcpList* RasterElementImporterShell::createGcpList() const
{
   if (mpRasterElement == NULL)
   {
      return NULL;
   }

   const RasterDataDescriptor* pDescriptor =
      dynamic_cast<const RasterDataDescriptor*>(mpRasterElement->getDataDescriptor());
   if (pDescriptor == NULL)
   {
      return NULL;
   }

   const RasterFileDescriptor* pFileDescriptor =
      dynamic_cast<const RasterFileDescriptor*>(pDescriptor->getFileDescriptor());
   if (pFileDescriptor == NULL)
   {
      return NULL;
   }

   const list<GcpPoint>& gcps = pFileDescriptor->getGcps();
   if (gcps.empty() == true)
   {
      return NULL;
   }

   // Create the GCP list
   GcpList* pGcpList = static_cast<GcpList*>(mpModel->createElement("Corner Coordinates", "GcpList", mpRasterElement));
   if (pGcpList != NULL)
   {
      unsigned int onDiskStartRow = 0;
      unsigned int onDiskStartColumn = 0;

      unsigned int numActiveRows = pDescriptor->getRowCount();
      unsigned int numActiveColumns = pDescriptor->getColumnCount();
      unsigned int numOnDiskRows = pFileDescriptor->getRowCount();
      unsigned int numOnDiskColumns = pFileDescriptor->getColumnCount();

      if ((numActiveRows != numOnDiskRows) || (numActiveColumns != numOnDiskColumns))
      {
         const vector<DimensionDescriptor>& activeRows = pDescriptor->getRows();
         if (activeRows.empty() == false)
         {
            DimensionDescriptor rowDim = activeRows.front();
            if (rowDim.isOnDiskNumberValid())
            {
               onDiskStartRow = rowDim.getOnDiskNumber();
            }
         }

         const vector<DimensionDescriptor>& activeColumns = pDescriptor->getColumns();
         if (activeColumns.empty() == false)
         {
            DimensionDescriptor columnDim = activeColumns.front();
            if (columnDim.isOnDiskNumberValid())
            {
               onDiskStartColumn = columnDim.getOnDiskNumber();
            }
         }
      }

      // Add the GCPs to the GCP list
      list<GcpPoint> adjustedGcps;

      list<GcpPoint>::const_iterator iter;
      for (iter = gcps.begin(); iter != gcps.end(); ++iter)
      {
         GcpPoint gcp = *iter;
         gcp.mPixel.mX = gcp.mPixel.mX - onDiskStartColumn;
         gcp.mPixel.mY = gcp.mPixel.mY - onDiskStartRow;

         adjustedGcps.push_back(gcp);
      }

      pGcpList->addPoints(adjustedGcps);
   }

   return pGcpList;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:80,代码来源:RasterElementImporterShell.cpp


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