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


C++ RasterElement::getDataDescriptor方法代码示例

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


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

示例1: addSourcePage

void ReplaceBandInputWizard::addSourcePage()
{
   QWizardPage* pPage = new QWizardPage(this);
   pPage->setTitle("Select source data element");
   QLabel* pPageLabel = new QLabel("Select the source data element.", pPage);
   pPageLabel->setWordWrap(true);
   mpSource = new QComboBox(pPage);
   mpSource->setEditable(false);

   const RasterDataDescriptor* pDestDesc = static_cast<const RasterDataDescriptor*>(mpDest->getDataDescriptor());
   std::vector<DataElement*> rasters = Service<ModelServices>()->getElements(TypeConverter::toString<RasterElement>());
   for(std::vector<DataElement*>::iterator raster = rasters.begin(); raster != rasters.end(); ++raster)
   {
      RasterElement* pRaster = static_cast<RasterElement*>(*raster);
      if (pRaster == mpDest)
      {
         continue;
      }
      const RasterDataDescriptor* pDesc = static_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor());
      if (pDesc->getRowCount() == pDestDesc->getRowCount() &&
          pDesc->getColumnCount() == pDestDesc->getColumnCount() &&
          pDesc->getDataType() == pDestDesc->getDataType())
      {
         mpSource->addItem(QString::fromStdString(pRaster->getName()), reinterpret_cast<qulonglong>(pRaster));
      }
   }

   QVBoxLayout* pLayout = new QVBoxLayout();
   pLayout->addWidget(pPageLabel);
   pLayout->addWidget(mpSource);
   pPage->setLayout(pLayout);

   addPage(pPage);
}
开发者ID:Siddharthk,项目名称:coan,代码行数:34,代码来源:ReplaceBandInputWizard.cpp

示例2: createDataAccessor

   DataAccessorImpl* createDataAccessor(DataElement* pElement, DataAccessorArgs* pArgs)
   {
      RasterElement* pRasterElement = dynamic_cast<RasterElement*>(pElement);
      if (pRasterElement == NULL)
      {
         setLastError(SIMPLE_BAD_PARAMS);
         return NULL;
      }

      FactoryResource<DataRequest> pRequest;
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
      if (pArgs != NULL)
      {
         pRequest->setRows(pDescriptor->getActiveRow(pArgs->rowStart),
            pDescriptor->getActiveRow(pArgs->rowEnd),pArgs->concurrentRows);
         pRequest->setColumns(pDescriptor->getActiveColumn(pArgs->columnStart),
            pDescriptor->getActiveColumn(pArgs->columnEnd),pArgs->concurrentColumns);
         pRequest->setBands(pDescriptor->getActiveBand(pArgs->bandStart),
            pDescriptor->getActiveBand(pArgs->bandEnd),pArgs->concurrentBands);
         pRequest->setInterleaveFormat(static_cast<InterleaveFormatTypeEnum>(pArgs->interleaveFormat));
         pRequest->setWritable(pArgs->writable != 0);
      }

      DataAccessor dataAccessor(pRasterElement->getDataAccessor(pRequest.release()));
      if (!dataAccessor.isValid())
      {
         setLastError(SIMPLE_BAD_PARAMS);
         return NULL;
      }
      DataAccessorImpl* pRval = dataAccessor.operator->();
      pRval->incrementRefCount();

      setLastError(SIMPLE_NO_ERROR);
      return pRval;
   }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: Image

    Image(SpatialDataView* iPView) : pView(iPView) {
        LayerList* pLayerList = pView->getLayerList(); VERIFYNRV(pLayerList != NULL);
        pRaster = dynamic_cast<RasterElement*>(pLayerList->getPrimaryRasterElement()); VERIFYNRV(pRaster != NULL);
        pDataDescriptor = dynamic_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor()); VERIFYNR(pDataDescriptor != NULL);
/*        Service<DesktopServices> pDesktop;
        VERIFYNRV(pDesktop.get() != NULL);
        SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(pDesktop->getWindow(pRaster->getName(), SPATIAL_DATA_WINDOW));
        VERIFYNRV(pWindow != NULL);
        VERIFYNRV(pDesktop->setCurrentWorkspaceWindow(pWindow));*/
    }
开发者ID:SvenDeSmet,项目名称:ESTL-OX,代码行数:10,代码来源:QDialogConvolutionFFT.cpp

示例4: copyDataToRasterElement

 int copyDataToRasterElement(DataElement* pElement, DataPointerArgs* pArgs, void* pData)
 {
    RasterElement* pRaster = dynamic_cast<RasterElement*>(pElement);
    if (pRaster == NULL || pData == NULL)
    {
       setLastError(SIMPLE_BAD_PARAMS);
       return 1;
    }
    const RasterDataDescriptor* pDesc = static_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor());
    void* pRawData = pRaster->getRawData();
    if (pArgs == NULL && pRawData != NULL)
    {
       size_t len = pDesc->getRowCount() * pDesc->getColumnCount() * pDesc->getBandCount()
                  * pDesc->getBytesPerElement();
       memcpy(pRawData, pData, len);
       setLastError(SIMPLE_NO_ERROR);
       return 0;
    }
    DataPointerArgs args = {
       0, pDesc->getRowCount() - 1,
       0, pDesc->getColumnCount() - 1,
       0, pDesc->getBandCount() - 1,
       0 };
    switch (pDesc->getInterleaveFormat())
    {
    case BSQ:
       args.interleaveFormat = 0;
       break;
    case BIP:
       args.interleaveFormat = 1;
       break;
    case BIL:
       args.interleaveFormat = 2;
       break;
    }
    if (pArgs == NULL)
    {
       pArgs = &args;
    }
    bool success = true;
    switchOnComplexEncoding(pDesc->getDataType(), copySubcube, pData, pRaster,
       pArgs->rowStart, pArgs->rowEnd,
       pArgs->columnStart, pArgs->columnEnd,
       pArgs->bandStart, pArgs->bandEnd, true, success);
    if (!success)
    {
       setLastError(SIMPLE_OTHER_FAILURE);
       return 1;
    }
    setLastError(SIMPLE_NO_ERROR);
    return 0;
 }
开发者ID:,项目名称:,代码行数:52,代码来源:

示例5: getExtents

bool PseudocolorLayerImp::getExtents(double& x1, double& y1, double& x4, double& y4)
{
   RasterElement* pRasterElement = dynamic_cast<RasterElement*>(getDataElement());
   VERIFY(pRasterElement != NULL);

   const RasterDataDescriptor* pDescriptor =
      dynamic_cast<const RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
   VERIFY(pDescriptor != NULL);

   translateDataToWorld(0, 0, x1, y1);
   translateDataToWorld(pDescriptor->getColumnCount(), pDescriptor->getRowCount(), x4, y4);

   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:14,代码来源:PseudocolorLayerImp.cpp

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

示例7: setRasterLayerDisplayedBand

 int setRasterLayerDisplayedBand(Layer* pLayer, uint32_t channel, uint32_t band, DataElement* pElement)
 {
    RasterLayer* pRaster = dynamic_cast<RasterLayer*>(pLayer);
    RasterChannelType chan(static_cast<RasterChannelTypeEnum>(channel));
    if (pRaster == NULL || !chan.isValid())
    {
       setLastError(SIMPLE_BAD_PARAMS);
       return 1;
    }
    RasterElement* pRasterElement =
       (pElement == NULL) ? pRaster->getDisplayedRasterElement(chan) : dynamic_cast<RasterElement*>(pElement);
    if (pRasterElement == NULL)
    {
       setLastError(SIMPLE_BAD_PARAMS);
       return 1;
    }
    DimensionDescriptor bandDD(static_cast<const RasterDataDescriptor*>(
       pRasterElement->getDataDescriptor())->getActiveBand(band));
    pRaster->setDisplayedBand(chan, bandDD, pRasterElement);
    setLastError(SIMPLE_NO_ERROR);
    return 0;
 }
开发者ID:Siddharthk,项目名称:opticks,代码行数:22,代码来源:SimpleViews.cpp

示例8: createDataInfo

   DataInfo* createDataInfo(DataElement* pElement)
   {
      RasterElement* pRasterElement = dynamic_cast<RasterElement*>(pElement);
      if (pRasterElement == NULL)
      {
         setLastError(SIMPLE_BAD_PARAMS);
         return NULL;
      }

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

      DataInfo* pDataInfo = new DataInfo;
      pDataInfo->numRows = pDescriptor->getRowCount();
      pDataInfo->numColumns = pDescriptor->getColumnCount();
      pDataInfo->numBands = pDescriptor->getBandCount();
      pDataInfo->encodingType = static_cast<uint32_t>(pDescriptor->getDataType());
      pDataInfo->encodingTypeSize = RasterUtilities::bytesInEncoding(pDescriptor->getDataType());
      pDataInfo->interleaveFormat = static_cast<uint32_t>(pDescriptor->getInterleaveFormat());
      const std::vector<int>& badValues = pDescriptor->getBadValues();
      pDataInfo->numBadValues = badValues.size();
      if (pDataInfo->numBadValues == 0)
      {
         pDataInfo->pBadValues = NULL;
      }
      else
      {
         pDataInfo->pBadValues = new int32_t[pDataInfo->numBadValues];
         memcpy(pDataInfo->pBadValues, &badValues[0], pDataInfo->numBadValues * sizeof(int32_t));
      }

      setLastError(SIMPLE_NO_ERROR);
      return pDataInfo;
   }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例9: saveAnimationTimes

bool TimelineWidget::saveAnimationTimes(Animation  *pAnim)
{
   if(pAnim == NULL)
   {
      return false;
   }
   bool success = false;
   const std::vector<AnimationFrame> frames = pAnim->getFrames();
   std::vector<double> times(frames.size(), 0.0);
   for(unsigned int idx = 0; idx < frames.size(); idx++)
   {
      times[idx] = frames[idx].mTime;
   }

   std::vector<Window*> windows;
   Service<DesktopServices>()->getWindows(SPATIAL_DATA_WINDOW, windows);
   for(std::vector<Window*>::iterator window = windows.begin(); window != windows.end(); ++window)
   {
      SpatialDataView *pView = static_cast<SpatialDataWindow*>(*window)->getSpatialDataView();
      std::vector<Layer*> layers;
      pView->getLayerList()->getLayers(RASTER, layers);
      for(std::vector<Layer*>::iterator layer = layers.begin(); layer != layers.end(); ++layer)
      {
         RasterLayer *pLayer = static_cast<RasterLayer*>(*layer);
         if(pLayer->getAnimation() == pAnim)
         {
            RasterElement *pElement = static_cast<RasterElement*>(pLayer->getDataElement());
            DynamicObject *pMetadata = static_cast<RasterDataDescriptor*>(pElement->getDataDescriptor())->getMetadata();
            if(pMetadata != NULL)
            {
               success = success || pMetadata->setAttributeByPath(FRAME_TIMES_METADATA_PATH, times);
            }
         }
      }
   }
   return success;
}
开发者ID:Siddharthk,项目名称:coan,代码行数:37,代码来源:TimelineWidget.cpp

示例10: getExportOptionsWidget

QWidget* ResultsExporter::getExportOptionsWidget(const PlugInArgList *pInArgList)
{
    const DataDescriptor* pDescriptor = NULL;
    if (pInArgList != NULL)
    {
        RasterElement* pElement = pInArgList->getPlugInArgValue<RasterElement>(Exporter::ExportItemArg());
        if (pElement != NULL)
        {
            pDescriptor = pElement->getDataDescriptor();
        }
    }
    if (mpOptionsWidget == NULL)
    {
        Service<DesktopServices> pDesktop;
        VERIFY(pDesktop.get() != NULL);

        mpOptionsWidget = new ResultsOptionsWidget(pDesktop->getMainWidget());
    }

    if (mpOptionsWidget != NULL)
    {
        const string& name = pDescriptor->getName();
        const string& type = pDescriptor->getType();
        DataElement* pParent = pDescriptor->getParent();

        RasterElement* pResults = dynamic_cast<RasterElement*>(mpModel->getElement(name, type, pParent));
        if (pResults != NULL)
        {
            PassArea passArea = MIDDLE;
            double dFirstThreshold = 0.0;
            double dSecondThreshold = 0.0;

            SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(mpDesktop->getCurrentWorkspaceWindow());
            if (pWindow != NULL)
            {
                SpatialDataView* pView = pWindow->getSpatialDataView();
                if (pView != NULL)
                {
                    LayerList* pLayerList = pView->getLayerList();
                    if (pLayerList != NULL)
                    {
                        ThresholdLayer* pThresholdLayer =
                            static_cast<ThresholdLayer*>(pLayerList->getLayer(THRESHOLD, pResults));
                        if (pThresholdLayer != NULL)
                        {
                            passArea = pThresholdLayer->getPassArea();
                            dFirstThreshold = pThresholdLayer->getFirstThreshold();
                            dSecondThreshold = pThresholdLayer->getSecondThreshold();
                        }
                        else
                        {
                            Statistics* pStatistics = pResults->getStatistics();
                            if (pStatistics != NULL)
                            {
                                dFirstThreshold = pStatistics->getMin();
                                dSecondThreshold = pStatistics->getMax();
                            }
                        }
                    }

                    LatLonLayer* pLatLonLayer = static_cast<LatLonLayer*>(pView->getTopMostLayer(LAT_LONG));
                    if (pLatLonLayer != NULL)
                    {
                        GeocoordType geocoordType = pLatLonLayer->getGeocoordType();
                        mpOptionsWidget->setGeocoordType(geocoordType);
                    }
                }
            }

            mpOptionsWidget->setPassArea(passArea);
            mpOptionsWidget->setFirstThreshold(dFirstThreshold);
            mpOptionsWidget->setSecondThreshold(dSecondThreshold);
        }
    }

    return mpOptionsWidget;
}
开发者ID:,项目名称:,代码行数:77,代码来源:

示例11: execute

bool HIGHPASS::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   StepResource pStep("Tutorial 5", "app", "219F1882-A59F-4835-BE2A-E83C0C8111EB");
   if (pInArgList == NULL || pOutArgList == NULL)
   {
      return false;
   }
   Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
   RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());

   if (pCube == NULL)
   {
      std::string msg = "A raster cube must be specified.";
      pStep->finalize(Message::Failure, msg);
      if (pProgress != NULL) 
      {
         pProgress->updateProgress(msg, 0, ERRORS);
      }
      return false;
   }
   RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
   VERIFY(pDesc != NULL);

   FactoryResource<DataRequest> pRequest;
   pRequest->setInterleaveFormat(BSQ);
   DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());

   ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
      "DResult", pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType()));

   if (pResultCube.get() == NULL)
   {
      std::string msg = "A raster cube could not be created.";
      pStep->finalize(Message::Failure, msg);
      if (pProgress != NULL) 
      {
         pProgress->updateProgress(msg, 0, ERRORS);
      }
      return false;
   }
   FactoryResource<DataRequest> pResultRequest;
   pResultRequest->setWritable(true);
   DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
   int rowSize= pDesc->getRowCount();
   int colSize = pDesc->getColumnCount();
   int zero=0;
   int prevCol = 0;
      int prevRow = 0;
      int nextCol = 0;
      int nextRow = 0;

	  int prevCol1 = 0;
	  int prevRow1= 0;
	  int nextCol1= 0;
	  int nextRow1= 0;

   for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Calculating result", row * 100 / pDesc->getRowCount(), NORMAL);
      }
      if (isAborted())
      {
         std::string msg = getName() + " has been aborted.";
         pStep->finalize(Message::Abort, msg);
         if (pProgress != NULL)
         {
            pProgress->updateProgress(msg, 0, ABORT);
         }
         return false;
      }
      if (!pDestAcc.isValid())
      {
         std::string msg = "Unable to access the cube data.";
         pStep->finalize(Message::Failure, msg);
         if (pProgress != NULL) 
         {
            pProgress->updateProgress(msg, 0, ERRORS);
         }
         return false;
      }
      for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
      {
		  
		  double value=edgeDetection7(pSrcAcc, row, col, pDesc->getRowCount(), pDesc->getColumnCount());
          switchOnEncoding(pDesc->getDataType(), conversion, pDestAcc->getColumn(), value);
          pDestAcc->nextColumn();
		  
      }

      pDestAcc->nextRow();
   }

   if (!isBatch())
   {
      Service<DesktopServices> pDesktop;

      SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
         SPATIAL_DATA_WINDOW));
//.........这里部分代码省略.........
开发者ID:pMav5,项目名称:Ship-Detection-Applet-for-Opticks,代码行数:101,代码来源:highpass.cpp

示例12: createView

void ChippingWindow::createView()
{
   if (mpChippingWidget == NULL)
   {
      return;
   }

   RasterElement* pRaster = getRasterElement();
   if (pRaster == NULL)
   {
      return;
   }

   // Create the new raster element from the primary element of the source.
   // Note that this does not chip displayed elements if they differ from the primary element.
   // This causes a special case below where the stretch values are being applied to the chipped layer.
   RasterElement* pRasterChip = pRaster->createChip(pRaster->getParent(), "_chip",
      mpChippingWidget->getChipRows(), mpChippingWidget->getChipColumns(), mpChippingWidget->getChipBands());
   if (pRasterChip == NULL)
   {
      QMessageBox::critical(this, windowTitle(), "Unable to create a new cube!");
      return;
   }

   const RasterDataDescriptor* pDescriptor =
      dynamic_cast<const RasterDataDescriptor*>(pRasterChip->getDataDescriptor());
   VERIFYNRV(pDescriptor != NULL);

   // Create a view for the new chip
   SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(
      Service<DesktopServices>()->createWindow(pRasterChip->getName(), SPATIAL_DATA_WINDOW));
   if (pWindow == NULL)
   {
      return;
   }

   SpatialDataView* pView = pWindow->getSpatialDataView();
   if (pView == NULL)
   {
      Service<DesktopServices>()->deleteWindow(pWindow);
      return;
   }

   UndoLock lock(pView);
   if (pView->setPrimaryRasterElement(pRasterChip) == false)
   {
      Service<DesktopServices>()->deleteWindow(pWindow);
      return;
   }

   // RasterLayerImp is needed for the call to setCurrentStretchAsOriginalStretch().
   RasterLayerImp* pLayer = dynamic_cast<RasterLayerImp*>(pView->createLayer(RASTER, pRasterChip));
   if (pLayer == NULL)
   {
      Service<DesktopServices>()->deleteWindow(pWindow);
      return;
   }

   string origName = pRaster->getName();

   SpatialDataWindow* pOrigWindow = dynamic_cast<SpatialDataWindow*>(
      Service<DesktopServices>()->getWindow(origName, SPATIAL_DATA_WINDOW));
   if (pOrigWindow != NULL)
   {
      SpatialDataView* pOrigView = pOrigWindow->getSpatialDataView();
      if (pOrigView != NULL)
      {
         LayerList* pLayerList = pOrigView->getLayerList();
         if (pLayerList != NULL)
         {
            RasterLayer* pOrigLayer = static_cast<RasterLayer*>(pLayerList->getLayer(RASTER, pRaster));
            if (pOrigLayer != NULL)
            {
               // Set the stretch type first so that stretch values are interpreted correctly.
               pLayer->setStretchType(GRAYSCALE_MODE, pOrigLayer->getStretchType(GRAYSCALE_MODE));
               pLayer->setStretchType(RGB_MODE, pOrigLayer->getStretchType(RGB_MODE));
               pLayer->setDisplayMode(pOrigLayer->getDisplayMode());

               // Set the properties of the cube layer in the new view.
               // For each channel, display the first band if the previously displayed band was chipped.
               vector<RasterChannelType> channels = StringUtilities::getAllEnumValues<RasterChannelType>();
               for (vector<RasterChannelType>::const_iterator iter = channels.begin(); iter != channels.end(); ++iter)
               {
                  bool bandCopied = true;
                  DimensionDescriptor newBand;
                  DimensionDescriptor oldBand = pOrigLayer->getDisplayedBand(*iter);
                  if (oldBand.isOriginalNumberValid() == true)
                  {
                     newBand = pDescriptor->getOriginalBand(oldBand.getOriginalNumber());
                  }

                  if (newBand.isValid() == false)
                  {
                     bandCopied = false;
                     newBand = pDescriptor->getBands().front();
                  }

                  // No need to explicitly set the RasterElement here since the new view only has one RasterElement.
                  pLayer->setDisplayedBand(*iter, newBand);

//.........这里部分代码省略.........
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:101,代码来源:ChippingWindow.cpp

示例13: fileInfo

ExportOptionsDlg::ExportOptionsDlg(ExporterResource& pExporter, QWidget* pParent) :
   QDialog(pParent),
   mpExporter(pExporter),
   mpTabWidget(NULL),
   mpSubsetPage(NULL),
   mpExporterPage(NULL)
{
   // Options widget
   QStackedWidget* pStack = new QStackedWidget(this);

   // Subset page
   RasterElement* pRasterElement = dynamic_cast<RasterElement*>(mpExporter->getItem());
   RasterFileDescriptor* pRasterWholeCubeFileDescriptor = NULL;
   RasterDataDescriptor* pRasterOrgDataDescriptor = NULL;
   if (pRasterElement != NULL)
   {
      pRasterOrgDataDescriptor = dynamic_cast<RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
      if (pRasterOrgDataDescriptor != NULL)
      {
         // we are creating a file descriptor for export from the original cube, because the SubsetWidget
         // uses DimensionDescriptor::operator= compare's to determine selection which dictate that on-disk,
         // original and active numbers need to be identical, this guarantees that DimensionDescriptors will
         // compare correctly.
         pRasterWholeCubeFileDescriptor = dynamic_cast<RasterFileDescriptor*>(
            RasterUtilities::generateFileDescriptorForExport(pRasterOrgDataDescriptor, "foobar"));
      }
   }
   RasterFileDescriptor* pRasterFileDescriptor = dynamic_cast<RasterFileDescriptor*>(mpExporter->getFileDescriptor());
   if ((pRasterFileDescriptor != NULL) && (pRasterWholeCubeFileDescriptor != NULL) &&
      (pRasterOrgDataDescriptor != NULL))
   {
      mpSubsetPage = new SubsetWidget();
      mpSubsetPage->setExportMode(true);

      // Rows
      const vector<DimensionDescriptor>& orgRows = pRasterWholeCubeFileDescriptor->getRows();
      const vector<DimensionDescriptor>& selectedRows = pRasterFileDescriptor->getRows();
      mpSubsetPage->setRows(orgRows, selectedRows);

      // Columns
      const vector<DimensionDescriptor>& orgColumns = pRasterWholeCubeFileDescriptor->getColumns();
      const vector<DimensionDescriptor>& selectedColumns = pRasterFileDescriptor->getColumns();
      mpSubsetPage->setColumns(orgColumns, selectedColumns);

      // Bands
      const vector<DimensionDescriptor>& orgBands = pRasterWholeCubeFileDescriptor->getBands();
      const vector<DimensionDescriptor>& selectedBands = pRasterFileDescriptor->getBands();
      vector<string> bandNames = RasterUtilities::getBandNames(pRasterOrgDataDescriptor);
      mpSubsetPage->setBands(orgBands, bandNames, selectedBands);

      // Initial bad band file directory
      QString strDirectory;

      string filename = pRasterFileDescriptor->getFilename();
      if (filename.empty() == false)
      {
         QFileInfo fileInfo(QString::fromStdString(filename));
         strDirectory = fileInfo.absolutePath();
      }

      mpSubsetPage->setBadBandFileDirectory(strDirectory);
   }

   // Exporter page
   if (mpExporter->getPlugIn() != NULL)
   {
      mpExporterPage = mpExporter->getExportOptionsWidget();
   }

   // Horizontal line
   QFrame* pLine = new QFrame(this);
   pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

   // Buttons
   QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
      Qt::Horizontal, this);

   // Layout
   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(10);
   pLayout->setSpacing(10);
   pLayout->addWidget(pStack, 10);
   pLayout->addWidget(pLine);
   pLayout->addWidget(pButtonBox);

   // Initialization
   QString strWindowTitle = "Export Options";

   SessionItem* pSessionItem = mpExporter->getItem();
   if (pSessionItem != NULL)
   {
      string name = pSessionItem->getDisplayName();
      if (name.empty() == true)
      {
         name = pSessionItem->getName();
      }

      if (name.empty() == false)
      {
         strWindowTitle += ": " + QString::fromStdString(name);
//.........这里部分代码省略.........
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:ExportOptionsDlg.cpp

示例14: addLayer

bool Kml::addLayer(Layer* pLayer, const Layer* pGeoLayer, const SpatialDataView* pView, int totalLayers)
{
   if (pLayer == NULL)
   {
      return false;
   }
   switch (pLayer->getLayerType())
   {
   case ANNOTATION:
   case AOI_LAYER:
   case GRAPHIC_LAYER:
      // These are polygonal layers
      generatePolygonalLayer(dynamic_cast<GraphicLayer*>(pLayer),
         pView->isLayerDisplayed(pLayer), totalLayers - pView->getLayerDisplayIndex(pLayer), pGeoLayer);
      break;
   case RASTER:
      {
         RasterLayer* pRasterLayer = dynamic_cast<RasterLayer*>(pLayer);
         RasterElement* pRasterElement = pRasterLayer->getDisplayedRasterElement(GRAY);
         if (pRasterElement != NULL)
         {
            bool layerIsDisplayed = pView->isLayerDisplayed(pLayer);
            int order = totalLayers - pView->getLayerDisplayIndex(pLayer) - 1;
            if (pView->getAnimationController() == NULL)
            {
               generateGroundOverlayLayer(pLayer, layerIsDisplayed, order, pGeoLayer, -1);
            }
            else
            {
               mXml.pushAddPoint(mXml.addElement("Folder"));
               mXml.addText("Frame Data", mXml.addElement("name"));
               vector<DimensionDescriptor> frames =
                  static_cast<RasterDataDescriptor*>(pRasterElement->getDataDescriptor())->getBands();
               for (vector<DimensionDescriptor>::const_iterator frame = frames.begin(); frame != frames.end(); ++frame)
               {
                  generateGroundOverlayLayer(pLayer, layerIsDisplayed, order, pGeoLayer, frame->getActiveNumber());
               }
               mXml.popAddPoint();
            }
            break;
         }
         // fall through...if there is no displayed raster element, export the flattened layer
      }
   case PSEUDOCOLOR:
   case THRESHOLD:
      // These are image layers
      generateGroundOverlayLayer(pLayer, pView->isLayerDisplayed(pLayer),
         totalLayers - pView->getLayerDisplayIndex(pLayer), pGeoLayer);
      break;
   case CONTOUR_MAP:
   case LAT_LONG:
   case TIEPOINT_LAYER:
   default:
      // These are unsupported layers
      if (mpProgress != NULL)
      {
         mpProgress->updateProgress("Unable to export unsupported layer " + pLayer->getName(), 0, WARNING);
      }
      return false;
   }
   return true;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:62,代码来源:Kml.cpp

示例15: createFile

void ChippingWindow::createFile()
{
   if (mpChippingWidget == NULL)
   {
      return;
   }

   RasterElement* pRaster = getRasterElement();
   if (pRaster == NULL)
   {
      return;
   }

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

   // Rows
   const vector<DimensionDescriptor>& rows = mpChippingWidget->getChipRows();
   const DimensionDescriptor startRow = rows.front();
   const DimensionDescriptor stopRow = rows.back();

   // Columns
   const vector<DimensionDescriptor>& columns = mpChippingWidget->getChipColumns();
   const DimensionDescriptor startCol = columns.front();
   const DimensionDescriptor stopCol = columns.back();

   // Create a file descriptor based on the data with the chip rows and columns
   FactoryResource<FileDescriptor> fileDescriptor(RasterUtilities::generateFileDescriptorForExport(pDescriptor,
      string(), startRow, stopRow, 0, startCol, stopCol, 0, mpChippingWidget->getChipBands()));

   Service<DesktopServices>()->exportSessionItem(pRaster, fileDescriptor.get());
}
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:35,代码来源:ChippingWindow.cpp


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