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


C++ PlugInArg::setActualValue方法代码示例

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


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

示例1: ensureStatisticsReadProperly

bool SioImporter::ensureStatisticsReadProperly(Progress *pProgress, std::ostream& failure)
{
   bool success = true;
   success &= setBatch();
   PlugInArgList* pInList = NULL;
   PlugInArgList* pOutList = NULL;
   isseas(getInputSpecification(pInList) != false, failure);
   isseas(getOutputSpecification(pOutList) != false, failure);
   PlugInArg* pRasterElementArg = NULL;
   isseas(pInList->getArg(Importer::ImportElementArg(), pRasterElementArg) != false, failure);

   string testFilePath = TestUtilities::getTestDataPath() + "tipjul5bands.sio";

   RasterElement* pRasterElement = NULL;
   if (success)
   {
      vector<ImportDescriptor*> descriptors = getImportDescriptors(testFilePath);
      if (descriptors.empty() == false)
      {
         ImportDescriptor* pImportDescriptor = descriptors.front();
         if (pImportDescriptor != NULL)
         {
            DataDescriptor* pDescriptor = pImportDescriptor->getDataDescriptor();
            if (pDescriptor != NULL)
            {
               Service<ModelServices> pModel;
               pRasterElement = dynamic_cast<RasterElement*>(pModel->createElement(pDescriptor));
               if (pRasterElement != NULL)
               {
                  pRasterElementArg->setActualValue(pRasterElement);
               }
            }
         }
      }
   }

   isseas(execute(pInList, pOutList) != false, failure);
   isseas(pRasterElement != NULL, failure);
   if (success)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
      isseas(pDescriptor != NULL, failure);

      const vector<DimensionDescriptor>& loadedBands = pDescriptor->getBands();
      isseas(loadedBands.size() == 5, failure);
      int iNumBandsWithStats = 0;
      for (int i = 0; i < 5; ++i)
      {
         // we don't want to do an assert yet... only when we know 4 bands have computed statistics
         Statistics* pStatistics = pRasterElement->getStatistics(loadedBands[i]);
         if (pStatistics != NULL)
         {
            if (pStatistics->areStatisticsCalculated() == true)
            {
               if (success)
               {
                  iNumBandsWithStats++;
               }
            }
         }
      }

      // success of the band computation is dependent on 4 bands with statistics
      isseas(iNumBandsWithStats == 3, failure);
   }
   if (pRasterElement != NULL)
   {
      Service<ModelServices> pModel;
      pModel->destroyElement(pRasterElement);
      pRasterElement = NULL;
   }
   Service<PlugInManagerServices> pPim;
   if (pInList)
   {
      pPim->destroyPlugInArgList(pInList);
   }

   if (pOutList)
   {
      pPim->destroyPlugInArgList(pOutList);
   }

   return success;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:84,代码来源:SioImporter.cpp

示例2: execute


//.........这里部分代码省略.........
         char* mutableExpression = new char[mExpression.size() + 1];
         strcpy(mutableExpression, mExpression.c_str());

         errorCode = eval(mpProgress, accessors, types, mCubeRows, mCubeColumns,
            mCubeBands, mutableExpression, returnDa, mbDegrees, errorVal, mbCubeMath, mbInteractive);

         delete [] mutableExpression;
      }
      else // cube math
      {
         EncodingType type = pDescriptor->getDataType();

         vector<DataAccessor> accessors;
         vector<EncodingType> dataTypes;
         for (unsigned int i = 0; i < mCubesList.size(); ++i)
         {
            FactoryResource<DataRequest> pRequest;
            pRequest->setInterleaveFormat(BIP);
            DataAccessor daCube = mCubesList[i]->getDataAccessor(pRequest.release());
            accessors.push_back(daCube);
            const RasterDataDescriptor* pDdCube = dynamic_cast<RasterDataDescriptor*>(mCubesList.at(i)->
               getDataDescriptor());
            if (pDdCube != NULL)
            {
               dataTypes.push_back(pDdCube->getDataType());
            }
            else
            {
               mstrProgressString = "Could not get data description for cube.";
               meGabbiness = ERRORS;
               displayErrorMessage();
               return false;
            }
         }

         char* mutableExpression = new char[mExpression.size() + 1];
         strcpy(mutableExpression, mExpression.c_str());

         errorCode = eval(mpProgress, accessors, dataTypes, mCubeRows,
            mCubeColumns, mCubeBands, mutableExpression, returnDa,
            mbDegrees, errorVal, mbCubeMath, mbInteractive);

         delete [] mutableExpression;
      }

      if (errorCode != 0)
      {
         mbError = true;
         if (errorCode == -1)
         {
            mstrProgressString = errorVal;
            meGabbiness = ERRORS;
         }
         else if (errorCode == -2)
         {
            mstrProgressString = "BandMath was cancelled due to an error in the input expression.";
            meGabbiness = ABORT;
         }
         else
         {
            mstrProgressString = "Unknown error has occured while executing BandMath.";
            meGabbiness = ERRORS;
         }
         displayErrorMessage();
         return false;
      }

      pResultStep->finalize(Message::Success);
   }
   mpStep = pStep.get();

   if (!createReturnGuiElement())
   {
      mstrProgressString = "Could not create GUI element.";
      meGabbiness = ERRORS;
      displayErrorMessage();
      return false;
   }     

   // Fill output arg list
   if (pOutputArgList != NULL)
   {
      PlugInArg* pArg = NULL;
      pOutputArgList->getArg("Band Math Result", pArg);

      VERIFY(pArg != NULL);
      pArg->setActualValue(mpResultData);
   }

   mpResultData->updateData();

   if (mpProgress != NULL)
   {
      mpProgress->updateProgress("Algorithm completed successfully", 100, meGabbiness);
   }

   pStep->finalize(Message::Success);
   mpStep = NULL;
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:BandMath.cpp


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