本文整理汇总了C++中SoNode::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ SoNode::getName方法的具体用法?C++ SoNode::getName怎么用?C++ SoNode::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoNode
的用法示例。
在下文中一共展示了SoNode::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate
void SoNodeToName::evaluate()
{
// make room as necessary
SO_ENGINE_OUTPUT(output, SoMFString, setNum(input.getNum()));
int next = 0;
for( int i = 0; i < input.getNum(); i++ )
{
SoNode * node = input[i];
if( node == NULL || node->getName() == "" )
{
if( compact.getValue() == FALSE )
{
SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, ""));
next++;
}
}
else
{
SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, node->getName().getString()));
next++;
}
}
// truncate as necessary
SO_ENGINE_OUTPUT(output, SoMFString, setNum(next));
}
示例2: printPath
void printPath(const SoPath* p)
{
for (int i = p->getLength() - 1; i >= 0; --i)
{
SoNode * n = p->getNode(i);
std::string name = n->getName().getString();
ROS_INFO("Path[%i]: %s, type %s",i,name.c_str(),n->getTypeId().getName().getString());
}
}
示例3: setEditorData
/**
* Takes the name of the selected node and sets to de editor to display it.
*/
void NodeNameDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
const SceneModel* model = static_cast< const SceneModel* >( index.model() );
QString value = model->data(index, Qt::DisplayRole).toString();
QLineEdit *textEdit = static_cast<QLineEdit *>(editor);
SoNode* coinNode = model->NodeFromIndex( index )->GetNode();
QString nodeName;
if ( coinNode->getName() == SbName() )
nodeName = QString( coinNode->getTypeId().getName().getString() );
else
nodeName = QString( coinNode->getName().getString() );
textEdit->setText( nodeName );
}
示例4: setNode
void SceneModel::setNode(QModelIndex index, SoNode* node)
{
this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
SoGroup *group = static_cast<SoGroup*>(node);
// insert SoGroup icon
this->insertColumns(0,2,index);
this->insertRows(0,group->getNumChildren(), index);
for (int i=0; i<group->getNumChildren();i++) {
SoNode* child = group->getChild(i);
setNode(this->index(i, 0, index), child);
// See ViewProviderDocumentObject::updateData
QByteArray name(child->getName());
name = QByteArray::fromPercentEncoding(name);
this->setData(this->index(i, 1, index), QVariant(QString::fromUtf8(name)));
}
}
// insert icon
}
示例5: sscanf
int
ModList::findToken(const SoPath *path)
{
SoNode *node = NULL;
char *str = NULL;
int id = -1;
int i;
char c;
for (i = path->getLength() - 1; i >= 0; --i) {
node = path->getNode(i);
str = (char *)(node->getName().getString());
if (strlen(str) && str[0] == theModListId) {
sscanf(str, "%c%d", &c, &id);
break;
}
}
return id;
}
示例6:
SoNode * InventorViewer::getIntStr(const std::string& sscanfStr, const SoPath * path, std::string& extStr, int& extNum, int& pathIdx)
{
if (path->getLength()==0) return NULL;
for (int i = path->getLength() - 1; i >= 0; --i)
{
SoNode * n = path->getNode(i);
std::string name = n->getName().getString();
//ROS_INFO("Path[%i]: %s, type %s",i,name.c_str(),n->getTypeId().getName().getString());
char ln[1000];
int num;
if (sscanf(name.c_str(), sscanfStr.c_str(), &num, ln) < 2) continue;
// ROS_INFO("num: %i rest: %s\n",num,ln);
extStr = ln; //urdf2inventor::helpers::getFilename(ln); // take only the name after the last '/'
extNum = num;
pathIdx = i;
return n;
}
return NULL;
}
示例7: setNode
void SceneModel::setNode(QModelIndex index, SoNode* node)
{
this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
SoGroup *group = static_cast<SoGroup*>(node);
// insert SoGroup icon
this->insertColumns(0,2,index);
this->insertRows(0,group->getNumChildren(), index);
for (int i=0; i<group->getNumChildren();i++) {
SoNode* child = group->getChild(i);
setNode(this->index(i, 0, index), child);
QHash<SoNode*, QString>::iterator it = nodeNames.find(child);
if (it != nodeNames.end()) {
this->setData(this->index(i, 1, index), QVariant(it.value()));
}
else {
this->setData(this->index(i, 1, index), QVariant(QString::fromLatin1(child->getName())));
}
}
}
// insert icon
}
示例8: del
void
InvAnnoManager::selectionCB(void *me, SoPath *selectedObject)
{
InvAnnoManager *mee = static_cast<InvAnnoManager *>(me);
mee->initCheck();
if (!mee->isActive_)
return;
int isAnnoFlg = 0;
int len = selectedObject->getLength();
int ii;
char *selObjNm;
SoNode *obj = NULL;
int objIndex;
int mode = mee->mode_;
// we find out if the selected obj is a InvAnnotationFlag
// and obtain its index from the name of the (sub)-toplevel
// separator node
for (ii = 0; ii < len; ii++)
{
obj = selectedObject->getNode(ii);
char *tmp = (char *)obj->getName().getString();
selObjNm = new char[1 + strlen(tmp)];
char *chNum = new char[1 + strlen(tmp)];
strcpy(selObjNm, tmp);
if (strncmp(selObjNm, "ANNOTATION", 10) == 0)
{
strcpy(chNum, &selObjNm[11]);
int ret = sscanf(chNum, "%d", &objIndex);
if (ret != 1)
{
fprintf(stderr, "InvAnnoManager::selectionCB: sscanf failed\n");
}
isAnnoFlg = 1;
break;
}
}
// we have got an InvAnnoFlag
// and remove it from the scene graph
if (isAnnoFlg == 1)
{
if (obj->getTypeId() == SoSeparator::getClassTypeId())
{
if (mode == InvAnnoManager::EDIT)
{
vector<InvAnnoFlag *>::iterator it, selPos;
// search flag with instance nr = objIndex;
for (it = mee->flags_.begin(); it != mee->flags_.end(); ++it)
{
if ((*it)->getInstance() == objIndex)
{
selPos = it;
break;
}
}
mee->viewer_->createAnnotationEditor(*selPos);
}
if (mode == InvAnnoManager::REMOVE)
{
// deletion of an InvAnnoFlag leads to a proper removal from the
// scene graph by calling InvActiveNode::~InvActiveNode()
bool del(false);
vector<InvAnnoFlag *>::iterator it, remPos;
// search flag with instance nr = objIndex;
for (it = mee->flags_.begin(); it != mee->flags_.end(); ++it)
{
if ((*it)->getInstance() == objIndex)
{
del = true;
remPos = it;
}
}
// delete flag and remove it from flags_
if (del)
{
delete *remPos;
mee->flags_.erase(remPos);
mee->trueNumFlags_--;
mee->deactivate();
mee->sendParameterData();
}
}
}
}
// we create a new flag if anything else is selected
else
{
if (mode != InvAnnoManager::MAKE)
return;
InvAnnoManager *mee = static_cast<InvAnnoManager *>(me);
//.........这里部分代码省略.........