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


C++ DataElement::getMetadata方法代码示例

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


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

示例1: initialize

bool PropertiesWavelengths::initialize(SessionItem* pSessionItem)
{
   WavelengthsWidget* pWavelengthsPage = dynamic_cast<WavelengthsWidget*>(getWidget());
   if (pWavelengthsPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
      if (pDescriptor != NULL)
      {
         const DynamicObject* pMetadata = pElement->getMetadata();
         if (pMetadata != NULL)
         {
            mWavelengths.initializeFromDynamicObject(pMetadata, true);
            pWavelengthsPage->setWavelengths(pDescriptor->getBands(), &mWavelengths);
            return PropertiesShell::initialize(pSessionItem);
         }
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:26,代码来源:PropertiesWavelengths.cpp

示例2: applyChanges

bool PropertiesWavelengths::applyChanges()
{
   DataElement* pElement = dynamic_cast<DataElement*>(getSessionItem());
   if (pElement != NULL)
   {
      if (dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor()) != NULL)
      {
         DynamicObject* pMetadata = pElement->getMetadata();
         if (pMetadata != NULL)
         {
            return mWavelengths.applyToDynamicObject(pMetadata);
         }
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:17,代码来源:PropertiesWavelengths.cpp

示例3: execute

bool MetadataExporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   Progress* pProgress = NULL;
   FileDescriptor* pFileDescriptor = NULL;
   DataElement* pElement = NULL;

   StepResource pStep("Export metadata", "app", "{08701b89-565c-4e0a-92ef-9bf22395f902}");

   // get input arguments and log some useful info about them
   { // scope the MessageResource
      MessageResource pMsg("Input arguments", "app", "{5e921da0-6470-44f1-a910-ed12af1e5ebc}");

      pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
      pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));

      pFileDescriptor = pInArgList->getPlugInArgValue<FileDescriptor>(Exporter::ExportDescriptorArg());
      if (pFileDescriptor == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No file specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No file specified");
         return false;
      }
      pMsg->addProperty("Destination", pFileDescriptor->getFilename());

      pElement = pInArgList->getPlugInArgValue<DataElement>(Exporter::ExportItemArg());
      if (pElement == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No data element specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No data element specified");
         return false;
      }
      pMsg->addProperty("Name", pElement->getName());
   }

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Open output file", 10, NORMAL);
   }
   FILE* pFile = fopen(pFileDescriptor->getFilename().getFullPathAndName().c_str(), "w");
   if (pFile == NULL)
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("File can not be created", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "File can not be created");
      return false;
   }

   const DynamicObject* pMetadata = pElement->getMetadata();
   VERIFY(pMetadata);
   if (pProgress != NULL)
   {
      pProgress->updateProgress("Save metadata", 20, NORMAL);
   }
   if (pMetadata->getNumAttributes() == 0)
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Metadata is empty. A file will be created anyway.", 20, WARNING);
      }
      pStep->addMessage("Metadata is empty. A file will be created anyway.", "app", "{29274eb3-c899-4778-ae1e-d267ea0dd346}", true);
   }
   XMLWriter xml("Metadata", Service<MessageLogMgr>()->getLog());
   xml.pushAddPoint(NULL);
   if (!pMetadata->toXml(&xml))
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Error saving metadata", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "Error saving metadata");
      return false;
   }
   xml.popAddPoint();
   xml.writeToFile(pFile);
   fclose(pFile);

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Finished saving the metadata", 100, NORMAL);
   }
   pStep->finalize(Message::Success);
   return true;
}
开发者ID:,项目名称:,代码行数:91,代码来源:


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