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


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

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


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

示例1: setDisplayBands

void PropertiesRasterLayer::setDisplayBands(QAction* pAction)
{
   if (mpRasterLayer == NULL)
   {
      return;
   }

   RasterElement* pRasterElement = dynamic_cast<RasterElement*>(mpRasterLayer->getDataElement());
   if (pRasterElement == NULL)
   {
      return;
   }

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

   const std::string name = pAction->text().toStdString();
   DimensionDescriptor redBand;
   DimensionDescriptor greenBand;
   DimensionDescriptor blueBand;
   if (RasterUtilities::findColorCompositeDimensionDescriptors(
      pDescriptor, name, redBand, greenBand, blueBand) == false)
   {
      Service<DesktopServices>()->showSuppressibleMsgDlg("Error",
         "Unable to display " + name + ": required wavelengths do not exist for all bands. "
         "Broaden the wavelength region or specify band numbers in the Raster Layers section of the Options dialog.",
         MESSAGE_ERROR, PropertiesRasterLayer::getDisplayAsWarningDialogId());
   }

   // If at least one of red, green, or blue is valid set display mode to RGB and update the combo boxes appropriately
   if (redBand.isActiveNumberValid() || greenBand.isActiveNumberValid() || blueBand.isActiveNumberValid())
   {
      mpDisplayModeCombo->setCurrentIndex(1);
      mpRedBandCombo->setCurrentIndex(redBand.isActiveNumberValid() ? redBand.getActiveNumber() : -1);
      mpGreenBandCombo->setCurrentIndex(greenBand.isActiveNumberValid() ? greenBand.getActiveNumber() : -1);
      mpBlueBandCombo->setCurrentIndex(blueBand.isActiveNumberValid() ? blueBand.getActiveNumber() : -1);
   }
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:42,代码来源:PropertiesRasterLayer.cpp

示例2: updateDisplayedBandCombo

void PropertiesRasterLayer::updateDisplayedBandCombo(int index)
{
   // Get the selected raster element
   RasterElement* pElement = NULL;
   if ((index > -1) && (static_cast<int>(mRasterElements.size()) > index))
   {
      pElement = mRasterElements[index];
   }

   // Get the band names from the element
   QStringList strBandNames;
   if (pElement != NULL)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
      if (pDescriptor != NULL)
      {
         vector<string> bandNames = RasterUtilities::getBandNames(pDescriptor);
         for (vector<string>::iterator iter = bandNames.begin(); iter != bandNames.end(); ++iter)
         {
            strBandNames.append(QString::fromStdString(*iter));
         }
      }
   }

   // Update the display band combo
   QComboBox* pCombo = dynamic_cast<QComboBox*>(sender());
   if (pCombo == mpGrayElementCombo)
   {
      mpGrayBandCombo->clear();
      mpGrayBandCombo->addItems(strBandNames);

      if (strBandNames.isEmpty() == false)
      {
         mpGrayBandCombo->setCurrentIndex(0);
         if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
         {
            DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(GRAY);
            if (displayedBand.isActiveNumberValid() == true)
            {
               mpGrayBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
            }
         }
      }
   }
   else if (pCombo == mpRedElementCombo)
   {
      mpRedBandCombo->clear();
      mpRedBandCombo->addItems(strBandNames);

      if (strBandNames.isEmpty() == false)
      {
         mpRedBandCombo->setCurrentIndex(0);
         if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
         {
            DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(RED);
            if (displayedBand.isActiveNumberValid() == true)
            {
               mpRedBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
            }
         }
      }
   }
   else if (pCombo == mpGreenElementCombo)
   {
      mpGreenBandCombo->clear();
      mpGreenBandCombo->addItems(strBandNames);

      if (strBandNames.isEmpty() == false)
      {
         mpGreenBandCombo->setCurrentIndex(0);
         if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
         {
            DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(GREEN);
            if (displayedBand.isActiveNumberValid() == true)
            {
               mpGreenBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
            }
         }
      }
   }
   else if (pCombo == mpBlueElementCombo)
   {
      mpBlueBandCombo->clear();
      mpBlueBandCombo->addItems(strBandNames);

      if (strBandNames.isEmpty() == false)
      {
         mpBlueBandCombo->setCurrentIndex(0);
         if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
         {
            DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(BLUE);
            if (displayedBand.isActiveNumberValid() == true)
            {
               mpBlueBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
            }
         }
      }
   }
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:99,代码来源:PropertiesRasterLayer.cpp

示例3: 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

示例4: getPage

RasterPage* ConvertToBsqPager::getPage(DataRequest* pOriginalRequest, DimensionDescriptor startRow,
   DimensionDescriptor startColumn, DimensionDescriptor startBand)
{
   VERIFYRV(pOriginalRequest != NULL, NULL);
   if (pOriginalRequest->getWritable())
   {
      return NULL;
   }

   InterleaveFormatType requestedType = pOriginalRequest->getInterleaveFormat();
   DimensionDescriptor stopRow = pOriginalRequest->getStopRow();
   DimensionDescriptor stopColumn = pOriginalRequest->getStopColumn();
   DimensionDescriptor stopBand = pOriginalRequest->getStopBand();

   unsigned int concurrentRows = std::min(pOriginalRequest->getConcurrentRows(),
      stopRow.getActiveNumber() - startRow.getActiveNumber() + 1);
   unsigned int concurrentBands = pOriginalRequest->getConcurrentBands();

   VERIFY(requestedType == BSQ);
   VERIFY(startBand == stopBand && concurrentBands == 1);

   VERIFY(mpRaster != NULL);
   const RasterDataDescriptor* pDd = dynamic_cast<const RasterDataDescriptor*>(mpRaster->getDataDescriptor());
   VERIFY(pDd != NULL);
   InterleaveFormatType interleave = pDd->getInterleaveFormat();

   VERIFY(interleave == BIL || interleave == BIP);

   unsigned int numRows = pDd->getRowCount();
   unsigned int numCols = pDd->getColumnCount();
   unsigned int numBands = pDd->getBandCount();

   if (startRow.getActiveNumber() >= numRows || stopRow.getActiveNumber() >= numRows ||
      startColumn.getActiveNumber() >= numCols || stopColumn.getActiveNumber() >= numCols ||
      startBand.getActiveNumber() >= numBands || stopBand.getActiveNumber() >= numBands)
   {
      return NULL;
   }

   unsigned int cols = stopColumn.getActiveNumber() - startColumn.getActiveNumber() + 1;
   std::auto_ptr<ConvertToBsqPage> pPage(new ConvertToBsqPage(concurrentRows, cols, mBytesPerElement));
   unsigned char* pDst = reinterpret_cast<unsigned char*>(pPage->getRawData());
   if (pDst == NULL)
   {
      return NULL;
   }

   FactoryResource<DataRequest> pRequest;
   pRequest->setRows(startRow, stopRow);
   pRequest->setColumns(startColumn, stopColumn, cols);
   pRequest->setBands(startBand, startBand, 1);
   DataAccessor da = mpRaster->getDataAccessor(pRequest.release());

   if (interleave == BIP)
   {
      for (unsigned int row = 0; row < concurrentRows; ++row)
      {
         for (unsigned int col = 0; col < cols; ++col)
         {
            if (da.isValid() == false)
            {
               return NULL;
            }

            memcpy(pDst, da->getColumn(), mBytesPerElement);
            pDst += mBytesPerElement;
            da->nextColumn();
         }

         da->nextRow();
      }
   }
   else if (interleave == BIL)
   {
      for (unsigned int row = 0; row < concurrentRows; ++row)
      {
         if (da.isValid() == false)
         {
            return NULL;
         }

         memcpy(pDst, da->getRow(), mBytesPerElement * cols);
         pDst += mBytesPerElement * cols;
         da->nextRow();
      }
   }

   return pPage.release();
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:89,代码来源:ConvertToBsqPager.cpp


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