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


C++ ossimKeywordlist::findKey方法代码示例

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


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

示例1: loadState

bool ossimHdfGridModel::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
    bool result = false;

    std::string myPrefix = ( prefix ? prefix: "" );

    // Look for type key:
    std::string typeKey = "type";
    std::string value = kwl.findKey( myPrefix, typeKey );
    if ( value == "ossimHdfGridModel" )
    {
        // Look for "is_hdf4" key:
        std::string key   = "is_hdf4";
        value = kwl.findKey( myPrefix, key );
        if ( value.size() )
        {
            m_isHdf4 = ossimString(value).toBool();
        }

        // Make a copy of kwl so we can change type.
        ossimKeywordlist myKwl = kwl;
        value = "ossimCoarseGridModel";
        myKwl.addPair( myPrefix, typeKey, value, true );

        // Load the state of base class.
        result = ossimCoarseGridModel::loadState( myKwl, prefix );
    }

    return result;
}
开发者ID:rb-rialto,项目名称:ossim,代码行数:30,代码来源:ossimHdfGridModel.cpp

示例2: createProjection

bool ossimH5GridModel::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
   bool result = false;
   
   std::string myPrefix = ( prefix ? prefix: "" );

   // Look for type key:
   std::string key = "type";
   std::string value = kwl.findKey( myPrefix, key );

   if ( value.size() )
   {
      // ossimHdfGridModel included for backward compatibility.
      if ( ( value == "ossimH5GridModel" ) || ( value == "ossimHdfGridModel" ) )
      {
         //---
         // theSeedFunction: This is in the base class ossimSensorModel but is not
         // in the ossimSensorModel::loadState so do it here.
         //---
         std::string seedPrefix = myPrefix;
         seedPrefix += "seed_projection.";
         value = kwl.findKey( seedPrefix, key );
         if ( value.size() )
         {
            // Only do expensive factory call if key is found...
            theSeedFunction = ossimProjectionFactoryRegistry::instance()->
               createProjection(kwl, seedPrefix.c_str());         
         }
         
         // m_crossesDateline:
         value = kwl.findKey( myPrefix, CROSSES_DATELINE_KW );
         if ( value.size() )
         {
            m_crossesDateline = ossimString(value).toBool();
         }

         // m_boundGndPolygon:
         std::string polyPrefix = myPrefix;
         polyPrefix += GROUND_POLYGON_KW;
         polyPrefix += ".";
         m_boundGndPolygon.clear();
         m_boundGndPolygon.loadState( kwl, polyPrefix.c_str() );
      
         // Make a copy of kwl so we can change type.
         ossimKeywordlist myKwl = kwl;
         value = "ossimCoarseGridModel";
         myKwl.addPair( myPrefix, key, value, true );

         // Load the state of base class.
         result = ossimCoarseGridModel::loadState( myKwl, prefix );
      }
   }
   
   return result;
   
} // End: ossimH5GridModel::loadState( ... )
开发者ID:bradh,项目名称:ossim-plugins,代码行数:56,代码来源:ossimH5GridModel.cpp

示例3: loadState

bool ossimNitfRsmModel::loadState( const ossimKeywordlist& kwl,
                                   const char* prefix ) 
{
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimNitfRsmModel::loadState(): entering..." << std::endl;
   }

   bool status = false;

   // Check for type match before preceeding:
   std::string myPrefix = ( prefix ? prefix : "" );
   std::string type = kwl.findKey( myPrefix, std::string(ossimKeywordNames::TYPE_KW) );

   if ( type == "ossimNitfRsmModel" )
   {
      // Pass on to the base-class for parsing first:
      status = ossimRsmModel::loadState(kwl, prefix);
   }
   
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimNitfRsmModel::loadState(): exit status: "
         << ( status ? "true" : "false" ) << std::endl;
   }
   
   return status;
}
开发者ID:harryjfowen,项目名称:ossim,代码行数:30,代码来源:ossimNitfRsmModel.cpp

示例4: encode

bool ossimCodecFactory::encode( const ossimKeywordlist& options,
                                const ossimRefPtr<ossimImageData>& in,
                                std::vector<ossim_uint8>& out ) const
{
   bool result = false;

   std::string value = options.findKey( TYPE_KW );
   if ( value.size() )
   {
      if ( value == "jpeg" )
      {
         ossim_uint32 quality = (ossim_uint32)ossimCodecFactory::DEFAULT_JPEG_QUALITY;
         value = options.findKey( std::string(ossimKeywordNames::COMPRESSION_QUALITY_KW) );
         if ( value.size() )
         {
            quality = ossimString(value).toUInt32();
         }

         result = encodeJpeg( quality, in, out );
      }  
   }
   
   return result;
}
开发者ID:Dukeke,项目名称:ossim,代码行数:24,代码来源:ossimCodecFactory.cpp

示例5: while

void ossimPiecewiseRemapper::ossimBandRemap::loadState( const ossimKeywordlist& kwl,
                                                        const std::string& prefix,
                                                        ossim_uint32 band )
{
   //---
   // Band Remap set example:
   // band0.remap0:((0, 127, 0, 127), (128, 255, 128, 382))
   // band0.remap1:((0, 382, 0, 255))
   //---

   // Clear the sets:
   m_remap.clear();
   
   // Get the number of remaps for this band.
   std::string keyBase = "band";
   keyBase += ossimString::toString(band).string();
   keyBase += ".";
   keyBase += REMAP_KW;
   
   ossim_uint32 NUMBER_REMAPS = kwl.numberOf(prefix.c_str(), keyBase.c_str());
   ossim_uint32 found = 0;
   ossim_uint32 index = 0;
   
   // Loop to find band remaps.  This allows for skipping indexes. 
   while ( found < NUMBER_REMAPS )
   {
      std::string key = keyBase + ossimString::toString(index).string();
      std::string value = kwl.findKey( prefix, key );
      if ( value.size() )
      {
         ossimPiecewiseRemapper::ossimRemapSet set;
         if ( initRemapSetFromString( value, set ) )
         {
            m_remap.push_back( set );
         }
         ++found;
      }
      
      ++index;
      if ( index > (NUMBER_REMAPS+100) )
      {
         break;
      }
   }
   
} // End: ossimPiecewiseRemapper::ossimBandRemap::loadState
开发者ID:hunterfu,项目名称:ossim,代码行数:46,代码来源:ossimPiecewiseRemapper.cpp

示例6: loadState

bool ossimPngReader::loadState(const ossimKeywordlist& kwl,
                               const char* prefix)
{
   bool result = false;
   if (ossimImageHandler::loadState(kwl, prefix))
   {
      // this was causing core dumps.  Mainly because if prefix is null then
      // standard string core dumps.  So wrapped with OSSIM string that checks
      // for this and inits with empty string if null
      //
      ossimString value = kwl.findKey( ossimString(prefix).c_str(), USE_ALPHA_KW );
      if ( value.size() )
      {
         ossimString s = value;
         m_useAlphaChannelFlag = s.toBool();
      }
      result = open();
  }
   return result;
}
开发者ID:Dukeke,项目名称:ossim,代码行数:20,代码来源:ossimPngReader.cpp

示例7: loadState

//*******************************************************************
// Public method:
//*******************************************************************
bool ossimGeneralRasterTileSource::loadState(const ossimKeywordlist& kwl,
                                             const char* prefix)
{
   bool result = false;
   m_outputBandList.clear();

   if ( ossimImageHandler::loadState(kwl, prefix) )
   {  
      // Set the band list if key is present.
      std::string pfx = ( prefix ? prefix : "" );
      std::string key = ossimKeywordNames::BANDS_KW;
      ossimString value;
      value.string() = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         ossim::toSimpleVector( m_outputBandList, value );
      }
      result = open();
   }
   return result;
}
开发者ID:ossimlabs,项目名称:ossim,代码行数:24,代码来源:ossimGeneralRasterTileSource.cpp

示例8: loadState

bool ossimGeneralRasterInfo::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
   static const char MODULE[] = "ossimGeneralRasterInfo::loadState";
   if ( traceDebug() )
   {
      CLOG << "DEBUG: entered..."
           << "\nprefix:  " << (prefix ? prefix : "")
           << "\nInput keyword list:\n"
           << kwl
           << std::endl;
   }   

   bool result = false;

   //---
   // Look for required and option keyword.  Break from loop if required
   // keyword is not found.
   //---
   while( 1 )
   {
      // Check for errors in the ossimKeywordlist.
      if(kwl.getErrorStatus() == ossimErrorCodes::OSSIM_ERROR)
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << MODULE << " ERROR:\n"
            << "Detected an error in the keywordlist:  " << kwl
            << std::endl;
         break;
      }

      std::string key;
      ossimString value; // Use for keyword list lookups.
      ossim_int32 lines = 0;
      ossim_int32 samples = 0;

      // Lines (required):
      key = NUMBER_LINES;
      value.string() = kwl.findKey( key );  // Required to have this.
      if ( value.size() )
      {
         lines = value.toInt32();
         if ( !lines )
         {
            if (traceDebug())
            {
               ossimNotify(ossimNotifyLevel_WARN)
                  << " ERROR:\n"
                  << "Required number of lines is 0!" << std::endl;
            }
            break;
         } 
      }
      else
      {
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_WARN)
               << " ERROR:\n"
               << "Required keyword not found:  " << key << std::endl;
         }
         break;
      }

      // Samples (required):
      key = NUMBER_SAMPLES;
      value.string() = kwl.findKey( key );  // Required to have this.
      if ( value.size() )
      {
         samples = value.toInt32();
         if ( !samples )
         {
            if (traceDebug())
            {
               ossimNotify(ossimNotifyLevel_WARN)
                  << " ERROR:\n"
                  << "Required number of samples is 0!" << std::endl;
            }
            break;
         }          
      }
      else
      {
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_WARN)
               << " ERROR:\n"
               << "Required keyword not found:  " << key << std::endl;
         }
         break;
      }
      
      // Bands ossimImageMetaData::loadState checks for required bands:
      if(!theMetaData.loadState(kwl, prefix))
      {
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_WARN)
               << " Error loading meta data!\n" << std::endl;
         }
         break;
//.........这里部分代码省略.........
开发者ID:star-labs,项目名称:star_ossim,代码行数:101,代码来源:ossimGeneralRasterInfo.cpp

示例9: loadState

/**
 * Method to the load (recreate) the state of an object from a keyword
 * list.  Return true if ok or false on error.
 */
bool ossimElevManager::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
      << "DEBUG ossimElevManager::loadState: Entered..."
      << std::endl;
   }
   if(!ossimElevSource::loadState(kwl, prefix))
   {
      return false;
   }
   ossimString copyPrefix(prefix);
   ossimString elevationOffset = kwl.find(copyPrefix, "elevation_offset");
   ossimString defaultHeightAboveEllipsoid = kwl.find(copyPrefix, "default_height_above_ellipsoid");
   ossimString useGeoidIfNull = kwl.find(copyPrefix, "use_geoid_if_null");
   ossimString elevRndRbnSize = kwl.find(copyPrefix, "threads");

   if(!elevationOffset.empty())
   {
      m_elevationOffset = elevationOffset.toDouble();
   }
   if(!defaultHeightAboveEllipsoid.empty())
   {
      m_defaultHeightAboveEllipsoid = defaultHeightAboveEllipsoid.toDouble();
   }
   if(!useGeoidIfNull.empty())
   {
      m_useGeoidIfNullFlag = useGeoidIfNull.toBool();
   }

   ossim_uint32 numThreads = 1;
   if(!elevRndRbnSize.empty())
   {
      if (elevRndRbnSize.contains("yes") || elevRndRbnSize.contains("true"))
         numThreads = ossim::getNumberOfThreads();
      else if (elevRndRbnSize.contains("no") || elevRndRbnSize.contains("false"))
         numThreads = 1;
      else
      {
         numThreads = elevRndRbnSize.toUInt32();
         numThreads = numThreads > 0 ? numThreads : 1;
      }
   }
   setRoundRobinMaxSize(numThreads);

   ossimString regExpression =  ossimString("^(") + copyPrefix + "elevation_source[0-9]+.)";
   vector<ossimString> keys = kwl.getSubstringKeyList( regExpression );
   long numberOfSources = (long)keys.size();
   ossim_uint32 offset = (ossim_uint32)(copyPrefix+"elevation_source").size();
   ossim_uint32 idx = 0;
   std::vector<int> theNumberList(numberOfSources);
   for(idx = 0; idx < theNumberList.size();++idx)
   {
      ossimString numberStr(keys[idx].begin() + offset,
                            keys[idx].end());
      theNumberList[idx] = numberStr.toInt();
   }
   std::sort(theNumberList.begin(), theNumberList.end());
   
   for(idx=0;idx < theNumberList.size();++idx)
   {
      ossimString newPrefix = copyPrefix;
      newPrefix += ossimString("elevation_source");
      newPrefix += ossimString::toString(theNumberList[idx]);
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimElevManager::loadState:"
         << "\nLooking for key:  " << newPrefix
         << std::endl;
      }

      //---
      // Check for enabled key first.  Default, if not found is true for
      // legacy compatibility.
      //---
      bool enabled = true;
      std::string key = newPrefix.string();
      key += ".";
      key += ossimKeywordNames::ENABLED_KW;
      std::string value = kwl.findKey( key );
      if ( value.size() )
      {
         enabled = ossimString(value).toBool();
      }

      if ( enabled )
      {
         // first check if new way is supported
         ossimRefPtr<ossimElevationDatabase> database =
            ossimElevationDatabaseRegistry::instance()->createDatabase(kwl, newPrefix+".");
         if(database.valid())
         {
            if (traceDebug())
            {
//.........这里部分代码省略.........
开发者ID:rb-rialto,项目名称:ossim,代码行数:101,代码来源:ossimElevManager.cpp

示例10: testIpts

void testIpts( ossimRefPtr<ossimNitfRsmModel>& model, const ossimKeywordlist& kwl )
{
   if ( model.valid() )
   {
      cout << std::setfill(' ') << setiosflags(ios::left);

      const std::string  ID_KW      = "itest_id";
      const std::string  IPT_KW     = "itest_ipt";
      const std::string  IPT_GT_KW  = "itest_gt"; // ground truth      
      const std::string  IPT_HGT_KW = "itest_hgt";
      const ossim_uint32 POINTS     = kwl.numberOf( ID_KW.c_str() );
   
      // Test data height values can be in feet.
      ossimUnitType heightUnits = OSSIM_METERS;
      std::string key = "itest_height_units";
      std::string value = kwl.findKey( key );
      if ( value.size() )
      {
         cout << key << ": " << value << "\n";
         if ( value == "feet" )
         {
            heightUnits = OSSIM_FEET;
         }
      }

      // Test the pixel type.
      ossim_float64 iptShift = 0.0;
      key = "pixel_type";
      value = kwl.findKey( key );
      if ( value.size() )
      {
         if ( value == "area" )
         {
            iptShift = -0.5;
            cout << key << ": " << value << "\n";
            cout << "input_line_sample_shift: " << iptShift << "\n";
         }
      }     
      
      cout << "\nitest begin ********************************\n\n"
           << "number_of_line_sample_points: " << POINTS << "\n";
      
      ossim_uint32 foundPts = 0;
      ossim_uint32 i = 0;

      while ( foundPts < POINTS )
      {
         // ID:
         key = ID_KW + ossimString::toString( i ).string();
         value = kwl.findKey( key );
         if ( value.size() )
         {
            cout << "itest_id" << std::setw(9) << i << ":  " << value << "\n";
         }
      
         // Image point, sample, line:
         key = IPT_KW + ossimString::toString( i ).string();
         value = kwl.findKey( key );
      
         if ( value.size() )
         {
            ossimDpt ipt; // image point
            ossimGpt wpt; // world point
            ossimGpt gt;  // ground truth
            ossimDpt gtd; // wpt to gt delta
            ossimDpt rtp; // round trip point
            ossimDpt rtd; // round trip delta;
         
            ipt.toPoint( value );
            ipt.x += iptShift;
            ipt.y += iptShift;
         
            cout << "itest_ipt" << std::setw(8) << i << ":  " << value << "\n";
         
            // Get the height above ellipsoid:
            ossim_float64 hgt = 0.0;
            key = IPT_HGT_KW + ossimString::toString( i ).string();
            value = kwl.findKey( key );
            if ( value.size() )
            {
               ossimString os ( value );
               hgt = os.toFloat64();
            
               if ( heightUnits == OSSIM_FEET )
               {
                  hgt *= MTRS_PER_FT;
               }
            }
            else
            {
               cerr << "missing height above ellipsoid for point!  Using 0.0."
                    << endl;
            }
         
            cout << "itest_hgt" << std::setw(8) << i << ":  " << value << "\n";
         
            model->lineSampleHeightToWorld( ipt, hgt, wpt );

            cout << "itest_wpt" << std::setw(8) << i << ":  " << wpt << "\n";
            
//.........这里部分代码省略.........
开发者ID:LucHermitte,项目名称:ossim,代码行数:101,代码来源:ossim-nitf-rsm-model-test.cpp

示例11: testGpts

void testGpts( ossimRefPtr<ossimNitfRsmModel>& model, const ossimKeywordlist& kwl )
{
   if ( model.valid() )
   {
      cout << std::setfill(' ') << setiosflags(ios::left);
      
      const std::string  ID_KW  = "gtest_id";
      const std::string  GPT_KW = "gtest_gpt";
      const ossim_uint32 POINTS = kwl.numberOf( ID_KW.c_str() );
      
      cout << "\ngtest begin ********************************\n\n"
           << "number_of_points_world_points: " << POINTS << "\n";
      
      ossim_uint32 foundPts = 0;
      ossim_uint32 i = 0;
      
      std::string key;
      std::string value;
      
      while ( foundPts < POINTS )
      {
         // ID:
         key = ID_KW + ossimString::toString( i ).string();
         value = kwl.findKey( key );
         if ( value.size() )
         {
            cout << "gtest_id" << std::setw(6) << i << ":  " << value << "\n";
         }
      
         // World point :
         key = GPT_KW + ossimString::toString( i ).string();
         value = kwl.findKey( key );
      
         if ( value.size() )
         {
            ossimDpt ipt; // image point
            ossimGpt wpt; // world point
            ossimGpt rtp; // round trip point
            ossimDpt rtd; // round trip delta;
         
            wpt.toPoint( value );

            cout << "gtest_gpt" << std::setw(5) << i << ":  " << wpt << "\n";

            model->worldToLineSample( wpt, ipt );

            if ( wpt.hasNans() == false )
            {
               model->lineSampleHeightToWorld( ipt, wpt.hgt, rtp );
            
               rtd.x = wpt.lon - rtp.lon;
               rtd.y = wpt.lat - rtp.lat;
            
               cout << "gtest_ipt" << std::setw(5) << i << ":  " << ipt << "\n"
                    << "gtest_rtp" << std::setw(5) << i << ":  " << rtp << "\n"
                    << "gtest_rtd" << std::setw(5) << i << ":  " << rtd << "\n\n";  
            }
            else
            {
               cerr << "model->worldToLineSample(...) result has nans!\n"
                    << wpt << endl;
            }
         
            ++foundPts;
         }
      
         ++i;
      
         if ( i > POINTS+100 )
         {
            break;
         }
      }

      cout << "\ngtest end **********************************\n\n";
   }
   
} // End: testGpts
开发者ID:LucHermitte,项目名称:ossim,代码行数:78,代码来源:ossim-nitf-rsm-model-test.cpp

示例12: loadState

bool ossimRsmida::loadState( const ossimKeywordlist& kwl,
                             const std::string& prefix )
{
   static const char MODULE[] = "ossimRsmida::loadState";
   std::string pfx = prefix + std::string("rsmida.");
   std::string key;
   std::string value;
   
   bool result = false; // Set to true on last key.
      
   while( 1 ) // Break out on error.
   {
      key = IID_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_iid = value;
      }
      else
      {
         break;
      }

      key = EDITION_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_edition = value;
      }
      else
      {
         break;
      }

      key = ISID_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_isid = value;
      }
      else // Not required at this time.  Blank in nitf test data.
      {
         m_isid.clear();
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_NOTICE)
               << MODULE << " NOTICE: " << ISID_KW << "was not found or is blank.\n";
         }
      }

      key = SID_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_sid = value;
      }
      else // Not required at this time.  Blank in nitf test data.
      {
         m_sid.clear();
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_NOTICE)
               << MODULE << " NOTICE: " << ISID_KW << "was not found or is blank.\n";
         }
      }

      key = STID_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_stid = value;
      }
      else
      {
         break;
      }

      key = YEAR_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_year = ossimString(value).toUInt32();
      }
      else
      {
         break;
      }

      key = MONTH_KW;
      value = kwl.findKey( pfx, key );
      if ( value.size() )
      {
         m_month = ossimString(value).toUInt32();
      }
      else
      {
         break;
      }

      key = DAY_KW;
//.........这里部分代码省略.........
开发者ID:LucHermitte,项目名称:ossim,代码行数:101,代码来源:ossimRsmida.cpp


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