bool buildChains(const ossimKeywordlist& kwl, ossimConnectableObject::ConnectableObjectList& chains) { ossim_int32 index = 0; ossim_int32 result = kwl.getNumberOfSubstringKeys("file[0-9]+\\.filename"); const char* lookup = NULL; ossim_int32 numberOfMatches = 0; vector<ossimFilename> fileList; while(numberOfMatches < result) { ossimString searchValue = "file" + ossimString::toString(index); ossimString filename = searchValue + ".filename"; lookup = kwl.find(filename.c_str()); if(lookup) { fileList.push_back(ossimFilename(lookup)); ++numberOfMatches; } ++index; } return buildChains(fileList, chains); }
bool ossimBlendMosaic::loadState(const ossimKeywordlist& kwl, const char* prefix) { bool result = ossimImageMosaic::loadState(kwl, prefix); ossim_uint32 count = 0; theWeights.clear(); if(result) { ossimString copyPrefix = prefix; ossimString regExpression = ossimString("^(") + copyPrefix + "weight[0-9]+)"; ossim_uint32 result = kwl.getNumberOfSubstringKeys(regExpression); ossim_uint32 numberOfMatches = 0; while(numberOfMatches < result) { ossimString value = ossimString("weight") + ossimString::toString(count); const char* lookup = kwl.find(copyPrefix.c_str(), value.c_str()); if(lookup) { ++numberOfMatches; theWeights.push_back(ossimString(lookup).toDouble()); } ++count; } } return result; }
bool ossimQuadTreeWarp::loadState(const ossimKeywordlist& kwl, const char* prefix) { clear(); ossimString newPrefix = ossimString(prefix); // load the vertices first // ossimString regExpression = ossimString("^(") + newPrefix + "v[0-9]+\\.)"; ossim_uint32 result = kwl.getNumberOfSubstringKeys(regExpression); ossim_uint32 numberOfMatches = 0; ossim_uint32 count = 0; while(numberOfMatches < result) { ossimString newPrefix = ossimString(prefix)+ossimString("v") + ossimString::toString(count) +"."; ossimQuadTreeWarpVertex* vert = new ossimQuadTreeWarpVertex; if(!vert->loadState(kwl, newPrefix.c_str())) { ossimNotify(ossimNotifyLevel_FATAL) << "FATAL: "<< " ossimQuadTreeWarp::loadState, invalid load on vertex\n"; delete vert; clear(); return false; } else { ++numberOfMatches; theVertexList.push_back(vert); } ++count; } theTree = new ossimQuadTreeWarpNode; if(!theTree->loadState(kwl, prefix)) { clear(); return false; } if(!recursiveLoad(theTree, kwl, prefix)) { clear(); return false; } if(!ossim2dTo2dTransform::loadState(kwl, prefix)) { clear(); return false; } return true; }