本文整理汇总了C++中SimObject::getParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ SimObject::getParameters方法的具体用法?C++ SimObject::getParameters怎么用?C++ SimObject::getParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimObject
的用法示例。
在下文中一共展示了SimObject::getParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createModel
void CustomModel::createModel(bool ignorePhysicsManager) {
QString pathName = "/";
pathName = pathName.append(getName());
for(QListIterator<SimObject*> i(mSimObjects); i.hasNext();) {
SimObject *object = i.next();
object->setName(object->getName().prepend("/"));
if(!ignorePhysicsManager) {
QList<Value*> parameters = object->getParameters();
for(QListIterator<Value*> j(parameters); j.hasNext();) {
StringValue *stringValue = dynamic_cast<StringValue*>(j.next());
if(stringValue != 0) {
if(stringValue->get().contains("$name$")) {
QString replacedString = stringValue->get().replace("$name$", pathName);
stringValue->set(replacedString);
}
}
}
}
mAgent->addObject(object);
}
if(!ignorePhysicsManager) {
Physics::getPhysicsManager()->addSimObjectGroup(mAgent);
}
else {
delete mAgent;
}
}
示例2: cleanUp
/**
* Called during the shutdown phase.
*/
bool PhysicsManager::cleanUp() {
ValueManager *vm = Core::getInstance()->getValueManager();
//remove all parameter values from the valuemanager.
for(QListIterator<SimObject*> i(mSimObjects); i.hasNext();) {
SimObject *obj = i.next();
obj->clear();
//TODO speed up! Iterate over hashtable instead of name and getParameter.
vm->removeValues(obj->getParameters());
}
return true;
}
示例3: addSimObjectPrefix
void CustomModel::addSimObjectPrefix(const QString &prefix) {
QList<StringValue*> stringValues;
QHash<QString, QString> nameLookup;
for(QListIterator<SimObject*> i(mSimObjects); i.hasNext();) {
SimObject *object = i.next();
QString name = object->getName();
object->setName(prefix + name);
Core::log("Renaming: " + name + " with " + prefix + " to " + object->getName(), true);
nameLookup.insert(name, object->getName());
QList<Value*> objectParameters = object->getParameters();
for(QListIterator<Value*> j(objectParameters); j.hasNext();) {
StringValue *sv = dynamic_cast<StringValue*>(j.next());
if(sv != 0) {
stringValues.append(sv);
}
}
}
//check if there are strings to change.
for(QListIterator<StringValue*> i(stringValues); i.hasNext();) {
StringValue *sv = i.next();
QString value = sv->get();
bool hasNameMacro = false;
if(value.startsWith("$name$")) {
hasNameMacro = true;
value = value.mid(6);
}
if(nameLookup.contains(value)) {
QString prefix = "";
if(hasNameMacro) {
prefix = "$name$/";
}
sv->set(prefix + nameLookup.value(value));
}
}
//TODO change variable names
}