本文整理汇总了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;
}
示例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;
}
示例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;
}