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


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

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


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

示例1: populateMetaData

void LandsatEtmPlusImporter::populateMetaData(DynamicObject* pMetadata, RasterFileDescriptor* pFileDescriptor, BandSetType bandSet)
{
   vector<string> &field = (bandSet == PANCHROMATIC) ? mFieldHPN : mFieldHRF;

   if (bandSet != PANCHROMATIC)
   {
      vector<double> startWavelengths;
      startWavelengths += 0.45, 0.525, 0.63, 0.75, 1.55, 10.4, 2.09;
      pMetadata->setAttributeByPath(START_WAVELENGTHS_METADATA_PATH, startWavelengths);

      vector<double> centerWavelengths;
      centerWavelengths += 0.483, 0.565, 0.66, 0.825, 1.65, 11.45, 2.22;
      pMetadata->setAttributeByPath(CENTER_WAVELENGTHS_METADATA_PATH, centerWavelengths);

      vector<double> endWavelengths;
      endWavelengths += 0.515, 0.605, 0.69, 0.9, 1.75, 12.5, 2.35;
      pMetadata->setAttributeByPath(END_WAVELENGTHS_METADATA_PATH, endWavelengths);
   }

   pMetadata->setAttribute("Product", field[PRODUCT]);
   pMetadata->setAttribute("LOC", field[LOC]);
   pMetadata->setAttribute("Satellite", field[SATELLITE]);
   pMetadata->setAttribute("Sensor", field[INSTRUMENT]);
   pMetadata->setAttribute("Sensor Mode", field[SENSOR_MODE]);
   pMetadata->setAttribute("Orientation Angle", StringUtilities::fromDisplayString<double>(field[LOOK_ANGLE]));
   pMetadata->setAttribute("Location", field[LOCATION]);
   pMetadata->setAttribute("Product Type", field[PRODUCT_TYPE]);
   pMetadata->setAttribute("Product Size", field[PRODUCT_SIZE]);
   pMetadata->setAttribute("Geodetic Processing", field[TYPE_OF_PROCESSING]);
   pMetadata->setAttribute("Resampling", field[RESAMPLING]);
   pMetadata->setAttribute("Volume Number/Number in Set", field[VOLUME_NUMBER]);
   pMetadata->setAttribute("Start Line", StringUtilities::fromDisplayString<unsigned int>(field[START_LINE]));
   pMetadata->setAttribute("Blocking Factor", StringUtilities::fromDisplayString<unsigned int>(field[BLOCKING_FACTOR]));
   pMetadata->setAttribute("Record Length", StringUtilities::fromDisplayString<unsigned int>(field[REC_SIZE]));
   pMetadata->setAttribute("Output Bits per Pixel", StringUtilities::fromDisplayString<unsigned int>(field[OUTPUT_BITS_PER_PIXEL]));
   pMetadata->setAttribute("Acquired Bits per Pixel", StringUtilities::fromDisplayString<unsigned int>(field[ACQUIRED_BITS_PER_PIXEL]));
   vector<double> gain;
   vector<double> bias;
   gain += StringUtilities::fromDisplayString<double>(field[GAIN_1]);
   bias += StringUtilities::fromDisplayString<double>(field[BIAS_1]);
   if (bandSet != PANCHROMATIC)
   {
      gain += StringUtilities::fromDisplayString<double>(field[GAIN_2]),
              StringUtilities::fromDisplayString<double>(field[GAIN_3]),
              StringUtilities::fromDisplayString<double>(field[GAIN_4]),
              StringUtilities::fromDisplayString<double>(field[GAIN_5]),
              StringUtilities::fromDisplayString<double>(mFieldHTM[(bandSet == LOW_GAIN) ? GAIN_1 : GAIN_2]),
              StringUtilities::fromDisplayString<double>(field[GAIN_6]);
      bias += StringUtilities::fromDisplayString<double>(field[BIAS_2]),
              StringUtilities::fromDisplayString<double>(field[BIAS_3]),
              StringUtilities::fromDisplayString<double>(field[BIAS_4]),
              StringUtilities::fromDisplayString<double>(field[BIAS_5]),
              StringUtilities::fromDisplayString<double>(mFieldHTM[(bandSet == LOW_GAIN) ? BIAS_1 : BIAS_2]),
              StringUtilities::fromDisplayString<double>(field[BIAS_6]);
   }
   pMetadata->setAttributeByPath("Radiance Adjust/Gain", gain);
   pMetadata->setAttributeByPath("Radiance Adjust/Bias", bias);
   pMetadata->setAttribute("Geometric Data Map Projection", field[GEOMETRIC_MAP_PROJECTION]);
   pMetadata->setAttribute("Earth Ellipsoid", field[ELLIPSOID]);
   pMetadata->setAttribute("Datum", field[DATUM]);
   vector<double> projParam;
   projParam += StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_1]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_2]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_3]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_4]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_5]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_6]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_7]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_8]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_9]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_10]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_11]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_12]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_13]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_14]),
                StringUtilities::fromDisplayString<double>(field[USGS_PROJECTION_PARAMETER_15]);
   pMetadata->setAttribute("USGS Projection Parameters", projParam);
   pMetadata->setAttribute("USGS Map Zone", StringUtilities::fromDisplayString<int>(field[USGS_MAP_ZONE]));
   pMetadata->setAttribute("UL Easting", StringUtilities::fromDisplayString<double>(field[UL_EASTING]));
   pMetadata->setAttribute("UL Northing", StringUtilities::fromDisplayString<double>(field[UL_NORTHING]));
   pMetadata->setAttribute("UR Easting", StringUtilities::fromDisplayString<double>(field[UR_EASTING]));
   pMetadata->setAttribute("UR Northing", StringUtilities::fromDisplayString<double>(field[UR_NORTHING]));
   pMetadata->setAttribute("LR Easting", StringUtilities::fromDisplayString<double>(field[LR_EASTING]));
   pMetadata->setAttribute("LR Northing", StringUtilities::fromDisplayString<double>(field[LR_NORTHING]));
   pMetadata->setAttribute("LL Easting", StringUtilities::fromDisplayString<double>(field[LL_EASTING]));
   pMetadata->setAttribute("LL Northing", StringUtilities::fromDisplayString<double>(field[LL_NORTHING]));
   pMetadata->setAttribute("Center Easting", StringUtilities::fromDisplayString<double>(field[CENTER_EASTING]));
   pMetadata->setAttribute("Center Northing", StringUtilities::fromDisplayString<double>(field[CENTER_NORTHING]));
   pMetadata->setAttribute("Scene Center Pixel Number", StringUtilities::fromDisplayString<int>(field[SCENE_CENTER_PIXEL_NUMBER]));
   pMetadata->setAttribute("Scene Center Line Number", StringUtilities::fromDisplayString<int>(field[SCENE_CENTER_LINE_NUMBER]));
   pMetadata->setAttribute("Offset", StringUtilities::fromDisplayString<int>(field[OFFSET]));
   pMetadata->setAttribute("Orientation Angle", StringUtilities::fromDisplayString<double>(field[ORIENTATION]));
   if (field[INSTRUMENT].substr(0, 2) == "TM")
   {
      pMetadata->setAttribute("Sensor Name", string("LandSat ETM+"));
      pMetadata->setAttribute("Change Detection Format", string("ETM"));
   }
   int yyyy = StringUtilities::fromDisplayString<int>(field[ACQUISITION_DATE].substr(0, 4));
   int mm = StringUtilities::fromDisplayString<int>(field[ACQUISITION_DATE].substr(4, 2));
   int dd = StringUtilities::fromDisplayString<int>(field[ACQUISITION_DATE].substr(6));
//.........这里部分代码省略.........
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:101,代码来源:LandsatEtmPlusImporter.cpp

示例2: setClassification

bool ClassificationImp::setClassification(const string& classificationText)
{
   if (classificationText.empty() == true)
   {
      return false;
   }

   Service<UtilityServices> pUtilities;
   FactoryResource<Classification> pClassification;
   const string delimiter = "//";

   // Level
   QString field = QString::fromStdString(classificationText);

   string::size_type pos = classificationText.find(delimiter);
   if (pos != string::npos)
   {
      field = QString::fromStdString(classificationText.substr(0, pos));
   }

   pClassification->setLevel(field.toStdString());

   // All other fields
   while (pos != string::npos)
   {
      // Get the next field
      pos += delimiter.length();

      string::size_type nextPos = classificationText.find(delimiter, pos);
      if (nextPos != string::npos)
      {
         field = QString::fromStdString(classificationText.substr(pos, nextPos - pos));
      }
      else
      {
         field = QString::fromStdString(classificationText.substr(pos));
      }

      pos = nextPos;

      if (field.isEmpty() == true)
      {
         continue;
      }

      QStringList fieldList = field.split("/", QString::SkipEmptyParts);

      // Codewords
      bool codewordsField = true;

      const vector<string>& codewords = pUtilities->getCodewords();
      for (int i = 0; i < fieldList.count(); ++i)
      {
         if (std::find(codewords.begin(), codewords.end(), fieldList[i].toStdString()) == codewords.end())
         {
            codewordsField = false;
            break;
         }
      }

      if (codewordsField == true)
      {
         field.replace("/", " ");
         pClassification->setCodewords(field.toStdString());
         continue;
      }

      // System
      bool systemField = true;

      const vector<string>& systems = pUtilities->getSystems();
      for (int i = 0; i < fieldList.count(); ++i)
      {
         if (std::find(systems.begin(), systems.end(), fieldList[i].toStdString()) == systems.end())
         {
            systemField = false;
            break;
         }
      }

      if (systemField == true)
      {
         field.replace("/", " ");
         pClassification->setSystem(field.toStdString());
         continue;
      }

      // File releasing
      bool fileReleasingField = true;
      const QString relTo = "REL TO";

      const vector<string>& fileReleasings = pUtilities->getFileReleasing();
      for (int i = 0; i < fieldList.count(); ++i)
      {
         QString fileReleasing = fieldList[i];
         if (fileReleasing.indexOf(relTo) == 0)
         {
            fileReleasing = relTo;
         }

//.........这里部分代码省略.........
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:ClassificationImp.cpp


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