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


C++ FactoryResource::getAttributeByPath方法代码示例

本文整理汇总了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;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:26,代码来源:LandsatGeotiffImporter.cpp

示例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;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:37,代码来源:LandsatGeotiffImporter.cpp


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