本文整理汇总了C++中ossimKeywordlist::getSubstringKeyList方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimKeywordlist::getSubstringKeyList方法的具体用法?C++ ossimKeywordlist::getSubstringKeyList怎么用?C++ ossimKeywordlist::getSubstringKeyList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimKeywordlist
的用法示例。
在下文中一共展示了ossimKeywordlist::getSubstringKeyList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadState
bool ossimVpfAnnotationCoverageInfo::loadState(const ossimKeywordlist& kwl,
const char* prefix)
{
deleteAllFeatures();
if(!theLibrary)
{
return false;
}
theName = kwl.find(prefix, "name");
ossimVpfCoverage coverage;
if(theLibrary->getCoverage(theName, coverage))
{
ossimString regExpression = ossimString("^(") + ossimString(prefix) + "feature[0-9]+.)";
vector<ossimString> keys =
kwl.getSubstringKeyList( regExpression );
std::vector<int> theNumberList(keys.size());
int offset = (int)(ossimString(prefix)+"feature").size();
int idx = 0;
for(idx = 0; idx < (int)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 < (int)keys.size(); ++idx)
{
ossimString newPrefix = ossimString(prefix);
newPrefix += ossimString("feature");
newPrefix += ossimString::toString(theNumberList[idx]);
newPrefix += ossimString(".");
ossimVpfAnnotationFeatureInfo* featureInfo = new ossimVpfAnnotationFeatureInfo;
featureInfo->setCoverage(coverage);
theFeatureInfoArray.push_back(featureInfo);
if(!featureInfo->loadState(kwl,
newPrefix))
{
return false;
}
}
}
else
{
return false;
}
return true;
}
示例2: addAllDataManagerObjects
void ossimQtVceCanvasWidget::addAllDataManagerObjects(const ossimKeywordlist& kwl,
const QPoint& location,
const char* prefix)
{
QPoint locationPoint = location;
if((locationPoint.x() == -1)&&
(locationPoint.y() == -1))
{
locationPoint.setX(0);
locationPoint.setY(0);
}
ossimQtGetDataManagerEvent tempEvt;
ossimQtApplicationUtility::sendEventToRoot(this, &tempEvt);
if(tempEvt.getDataManager())
{
ossimString regExpression = ossimString("^(") + ossimString(prefix)+ "object[0-9]+.)";
std::vector<ossimString> keys =
kwl.getSubstringKeyList( regExpression );
int numberOfObjects = keys.size();
int idx = 0;
for(idx = 0; idx < numberOfObjects; ++idx)
{
const char* id = kwl.find(keys[idx]+"id");
if(id)
{
ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject,
tempEvt.getDataManager()->getObject(ossimId(ossimString(id).toInt())));
if(addDataManagerObject(obj,
locationPoint))
{
locationPoint.setY(locationPoint.y() + 74);
}
}
}
}
}
示例3: addAllObjects
void ossimQtVceCanvasWidget::addAllObjects(const ossimKeywordlist& kwl,
const QPoint& location,
const char* prefix)
{
unselectItems();
QPoint locationPoint = location;
ossimString copyPrefix = prefix;
std::vector<QCanvasItem*> newItemList;
ossimString regExpression = ossimString("^(") + copyPrefix + "object[0-9]+.)";
vector<ossimString> keys =
kwl.getSubstringKeyList( regExpression );
long numberOfObjets = keys.size();//kwl.getNumberOfSubstringKeys(regExpression);
int offset = (copyPrefix+"object").size();
int idx = 0;
std::vector<int> theNumberList(numberOfObjets);
for(idx = 0; idx < (int)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 < (int)theNumberList.size();++idx)
{
ossimString newPrefix = copyPrefix;
newPrefix += ossimString("object");
newPrefix += ossimString::toString(theNumberList[idx]);
newPrefix += ossimString(".");
ossimString objType = kwl.find(newPrefix,
ossimKeywordNames::TYPE_KW);
QCanvasItem* item = NULL;
if(objType == "ossimQtImageWindow")
{
item = new ossimQtVceImageDisplayObject(canvas(),
this);
item->setX(locationPoint.x());
item->setY(locationPoint.y());
item->show();
emit itemAdded(item);
}
else if(objType == "ossimImageHandler")
{
QStringList filenames = QFileDialog::getOpenFileNames("Images (*.adf *.ccf *.dem *.DEM *.dt1 *.dt0 *.dt2 *.hdr *.hgt *.jpg *.jpeg *.img *.doqq *.fst *.FST *.nitf *.NTF *.ntf *.ras *.sid *.tif *.tiff *.toc *.TOC);;Vectors(*.shp dht *.tab);;All Files(*)",
QString::null,
this,
"open file dialog",
"Choose a file to open");
QStringList::Iterator it;
for(it = filenames.begin(); it != filenames.end(); ++it)
{
std::vector<QCanvasItem*> newItems;
openImageFile((*it).ascii(),
locationPoint,
newItems);
if(newItems.size())
{
// QRect bounds = newItems[newItems.size()-1]->boundingRect();
// locationPoint.setY(locationPoint.y() + bounds.height() + 10);
newItemList.insert(newItemList.end(),
newItems.begin(),
newItems.end());
}
}
// we will make sure that we don't adjust the location point any further
//
item = NULL;
}
else
{
ossimObject* object = ossimObjectFactoryRegistry::instance()->createObject(objType);
if(object)
{
item = addObject(object, locationPoint);
}
}
if(item)
{
newItemList.push_back(item);
QRect bounds = item->boundingRect();
locationPoint.setY(locationPoint.y() + bounds.height() + 10);
emit itemAdded(item);
}
}
if(newItemList.size() > 0)
{
for(idx = 0; idx < (int)newItemList.size(); ++idx)
{
newItemList[idx]->setSelected(true);
theSelectedItems.push_back(newItemList[idx]);
emit itemSelected(newItemList[idx]);
}
//.........这里部分代码省略.........
示例4: 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())
{
//.........这里部分代码省略.........
示例5: 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");
if(!elevationOffset.empty())
{
m_elevationOffset = elevationOffset.toDouble();
}
if(!defaultHeightAboveEllipsoid.empty())
{
m_defaultHeightAboveEllipsoid = defaultHeightAboveEllipsoid.toDouble();
}
if(!useGeoidIfNull.empty())
{
m_useGeoidIfNullFlag = useGeoidIfNull.toBool();
}
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;
}
// first check if new way is supported
//
ossimRefPtr<ossimElevationDatabase> database = ossimElevationDatabaseRegistry::instance()->createDatabase(kwl, newPrefix+".");
if(database.valid())
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimElevManager::loadState:"
<< "\nadding elevation database: "
<< database->getClassName()
<< ": " << database->getConnectionString()
<< std::endl;
}
addDatabase(database.get());
}
else
{
// if not new elevation load verify the old way by
// looking at the filename
//
ossimString fileKey = newPrefix;
fileKey += ".";
fileKey += ossimKeywordNames::FILENAME_KW;
ossimString lookup = kwl.find(prefix, fileKey.c_str());
if (!lookup.empty())
{
loadElevationPath(ossimFilename(lookup));
} // end if lookup
}
} // end for loop
return true;
}