本文整理汇总了C++中FactoryResource::getAttributeByPath方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::getAttributeByPath方法的具体用法?C++ FactoryResource::getAttributeByPath怎么用?C++ FactoryResource::getAttributeByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::getAttributeByPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFileAffinity
unsigned char LandsatGeotiffImporter::getFileAffinity(const std::string& filename)
{
if (filename.empty())
{
return CAN_NOT_LOAD;
}
bool originallyTiff = false;
std::string metadataFile = determineMetadataFile(filename, &originallyTiff);
bool readMetadata = false;
FactoryResource<DynamicObject> pImageMetadata = Landsat::parseMtlFile(metadataFile, readMetadata);
if (!readMetadata)
{
return CAN_NOT_LOAD;
}
std::string spacecraft = dv_cast<std::string>(
pImageMetadata->getAttributeByPath("LANDSAT_MTL/L1_METADATA_FILE/PRODUCT_METADATA/SPACECRAFT_ID"), "");
if (spacecraft != "Landsat5" && spacecraft != "Landsat7")
{
return CAN_NOT_LOAD;
}
if (originallyTiff)
{
return CAN_LOAD + 5; //override normal tiff importers
}
return CAN_LOAD;
}
示例2: determineMetadataFile
std::vector<ImportDescriptor*> LandsatGeotiffImporter::getImportDescriptors(const std::string& filename)
{
mErrors.clear();
mWarnings.clear();
std::vector<ImportDescriptor*> descriptors;
if (filename.empty())
{
return descriptors;
}
std::string metadataFile = determineMetadataFile(filename);
bool readMetadata = false;
FactoryResource<DynamicObject> pImageMetadata = Landsat::parseMtlFile(metadataFile, readMetadata);
if (!readMetadata)
{
return descriptors;
}
std::string spacecraft = dv_cast<std::string>(
pImageMetadata->getAttributeByPath("LANDSAT_MTL/L1_METADATA_FILE/PRODUCT_METADATA/SPACECRAFT_ID"), "");
if (spacecraft != "Landsat5" && spacecraft != "Landsat7")
{
return descriptors;
}
std::vector<ImportDescriptor*> vnirDescriptors = createImportDescriptors(metadataFile, pImageMetadata.get(),
Landsat::LANDSAT_VNIR);
std::vector<ImportDescriptor*> panDescriptors = createImportDescriptors(metadataFile, pImageMetadata.get(),
Landsat::LANDSAT_PAN);
std::vector<ImportDescriptor*> tirDescriptors = createImportDescriptors(metadataFile, pImageMetadata.get(),
Landsat::LANDSAT_TIR);
std::copy(vnirDescriptors.begin(), vnirDescriptors.end(), std::back_inserter(descriptors));
std::copy(panDescriptors.begin(), panDescriptors.end(), std::back_inserter(descriptors));
std::copy(tirDescriptors.begin(), tirDescriptors.end(), std::back_inserter(descriptors));
return descriptors;
}