本文整理汇总了C++中SoSearchAction::setSearchingAll方法的典型用法代码示例。如果您正苦于以下问题:C++ SoSearchAction::setSearchingAll方法的具体用法?C++ SoSearchAction::setSearchingAll怎么用?C++ SoSearchAction::setSearchingAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoSearchAction
的用法示例。
在下文中一共展示了SoSearchAction::setSearchingAll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doAction
void SoFCIndexedFaceSet::doAction(SoAction * action)
{
if (action->getTypeId() == Gui::SoGLSelectAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setSearchingAll(false);
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
if (!(coords && coords->getTypeId().isDerivedFrom(SoCoordinate3::getClassTypeId())))
return;
startSelection(action);
renderSelectionGeometry(static_cast<SoCoordinate3*>(coords)->point.getValues(0));
stopSelection(action);
}
else if (action->getTypeId() == Gui::SoVisibleFaceAction::getClassTypeId()) {
SoNode* node = action->getNodeAppliedTo();
if (!node) return; // on no node applied
// The node we have is the parent of this node and the coordinate node
// thus we search there for it.
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setSearchingAll(false);
sa.setType(SoCoordinate3::getClassTypeId(), 1);
sa.apply(node);
SoPath * path = sa.getPath();
if (!path) return;
// make sure we got the node we wanted
SoNode* coords = path->getNodeFromTail(0);
if (!(coords && coords->getTypeId().isDerivedFrom(SoCoordinate3::getClassTypeId())))
return;
startVisibility(action);
renderVisibleFaces(static_cast<SoCoordinate3*>(coords)->point.getValues(0));
stopVisibility(action);
}
inherited::doAction(action);
}
示例2: getLocalResources
void ViewProviderVRMLObject::getLocalResources(SoNode* node, std::list<std::string>& resources)
{
// search for SoVRMLInline files
SoSearchAction sa;
sa.setType(SoVRMLInline::getClassTypeId());
sa.setInterest(SoSearchAction::ALL);
sa.setSearchingAll(true);
sa.apply(node);
const SoPathList & pathlist = sa.getPaths();
for (int i = 0; i < pathlist.getLength(); i++ ) {
SoPath * path = pathlist[i];
SoVRMLInline * vrml = static_cast<SoVRMLInline*>(path->getTail());
const SbString& url = vrml->getFullURLName();
if (url.getLength() > 0) {
// add the resource file if not yet listed
if (std::find(resources.begin(), resources.end(), url.getString()) == resources.end()) {
resources.push_back(url.getString());
}
// if the resource file could be loaded check if it references further resources
if (vrml->getChildData()) {
getLocalResources(vrml->getChildData(), resources);
}
}
}
// search for SoVRMLImageTexture, ... files
getResourceFile<SoVRMLImageTexture >(node, resources);
getResourceFile<SoVRMLMovieTexture >(node, resources);
getResourceFile<SoVRMLScript >(node, resources);
getResourceFile<SoVRMLBackground >(node, resources);
getResourceFile<SoVRMLAudioClip >(node, resources);
getResourceFile<SoVRMLAnchor >(node, resources);
}
示例3:
void
SoXipImageOverlayManager::updateSliceMap()
{
// Removes all the previous entries
mSliceMap.clear();
SoSearchAction sa;
sa.setInterest( SoSearchAction::ALL );
sa.setType( SoXipShapeList::getClassTypeId() );
sa.setSearchingAll( TRUE );
sa.apply( mShapeSwitch );
SoPathList paths = sa.getPaths();
for( int i = 0; i < paths.getLength(); ++ i )
{
SbString label = ((SoXipShapeList *) paths[i]->getTail())->label.getValue().getString();
int sliceIndex;
if( sscanf( label.getString(), "%d", &sliceIndex ) != 1 )
{
SoDebugError::post( __FILE__, "Invalid label found '%s'", label.getString() );
continue ;
}
mSliceMap[ sliceIndex ] = (SoXipShapeList *) paths[i]->getTail();
}
}
示例4: getPointOnRay
SoPickedPoint* ViewProvider::getPointOnRay(const SbVec2s& pos, const View3DInventorViewer* viewer) const
{
//first get the path to this node and calculate the current transformation
SoSearchAction sa;
sa.setNode(pcRoot);
sa.setSearchingAll(true);
sa.apply(viewer->getSoRenderManager()->getSceneGraph());
if (!sa.getPath())
return nullptr;
SoGetMatrixAction gm(viewer->getSoRenderManager()->getViewportRegion());
gm.apply(sa.getPath());
SoTransform* trans = new SoTransform;
trans->setMatrix(gm.getMatrix());
trans->ref();
// build a temporary scenegraph only keeping this viewproviders nodes and the accumulated
// transformation
SoSeparator* root = new SoSeparator;
root->ref();
root->addChild(viewer->getSoRenderManager()->getCamera());
root->addChild(trans);
root->addChild(pcRoot);
//get the picked point
SoRayPickAction rp(viewer->getSoRenderManager()->getViewportRegion());
rp.setPoint(pos);
rp.setRadius(viewer->getPickRadius());
rp.apply(root);
root->unref();
trans->unref();
SoPickedPoint* pick = rp.getPickedPoint();
return (pick ? new SoPickedPoint(*pick) : 0);
}
示例5: LightManip
void LightManip(SoSeparator * root)
{
SoInput in;
in.setBuffer((void *)scenegraph, std::strlen(scenegraph));
SoSeparator * _root = SoDB::readAll( &in );
if ( _root == NULL ) return; // Shouldn't happen.
root->addChild(_root);
root->ref();
const char * pointlightnames[3] = { "RedLight", "GreenLight", "BlueLight" };
SoSearchAction sa;
for (int i = 0; i < 3; i++) {
sa.setName( pointlightnames[i] );
sa.setInterest( SoSearchAction::FIRST );
sa.setSearchingAll( false );
sa.apply( root );
SoPath * path = sa.getPath();
if ( path == NULL) return; // Shouldn't happen.
SoPointLightManip * manip = new SoPointLightManip;
manip->replaceNode( path );
}
}
示例6: getChildByName
SoNodeList Renderer::getChildByName(SoSeparator * ivRoot, SbName & childName,
SoType targetType, int maxResultsExpected)
{
assert(ivRoot);
SoNodeList resultList;
SoSearchAction sa;
sa.setSearchingAll(true);
sa.setType(targetType, true);
sa.setInterest( SoSearchAction::ALL);
sa.setName(childName);
sa.setFind(SoSearchAction::NAME);
sa.apply(ivRoot);
SoPathList &pathList = sa.getPaths();
int numPaths = pathList.getLength();
if (numPaths > maxResultsExpected)
{
//DBGA(this->className() << "::getChildByName::Found too many children of node: "
// << ivRoot->getName().getString() << " with name: "
// <<childName.getString() << " " );
//DBGA(this->className() << "::getChildByName:: Expected:" << maxResultsExpected
// << " Found:" << numPaths);
//resultList.append(static_cast<SoNode *>(NULL));
return resultList;
}
for(int i = 0; i < numPaths; ++i)
{
resultList.append(pathList[i]->getTail());
}
return resultList;
}
示例7: getResourceFile
void ViewProviderVRMLObject::getResourceFile(SoNode* node, std::list<std::string>& resources)
{
SoSearchAction sa;
sa.setType(T::getClassTypeId());
sa.setInterest(SoSearchAction::ALL);
sa.setSearchingAll(true);
sa.apply(node);
const SoPathList & pathlist = sa.getPaths();
for (int i = 0; i < pathlist.getLength(); i++ ) {
SoFullPath * path = static_cast<SoFullPath *>(pathlist[i]);
if (path->getTail()->isOfType(T::getClassTypeId())) {
T * tex = static_cast<T*>(path->getTail());
for (int j = 0; j < tex->url.getNum(); j++) {
this->addResource(tex->url[j], resources);
}
}
}
}
示例8: addResource
void ViewProviderVRMLObject::getResourceFile<SoVRMLBackground>(SoNode* node, std::list<std::string>& resources)
{
SoSearchAction sa;
sa.setType(SoVRMLBackground::getClassTypeId());
sa.setInterest(SoSearchAction::ALL);
sa.setSearchingAll(true);
sa.apply(node);
const SoPathList & pathlist = sa.getPaths();
for (int i = 0; i < pathlist.getLength(); i++ ) {
SoFullPath * path = static_cast<SoFullPath *>(pathlist[i]);
if (path->getTail()->isOfType(SoVRMLBackground::getClassTypeId())) {
SoVRMLBackground * vrml = static_cast<SoVRMLBackground*>(path->getTail());
// backUrl
for (int j = 0; j < vrml->backUrl.getNum(); j++) {
addResource(vrml->backUrl[j], resources);
}
// bottomUrl
for (int j = 0; j < vrml->bottomUrl.getNum(); j++) {
addResource(vrml->bottomUrl[j], resources);
}
// frontUrl
for (int j = 0; j < vrml->frontUrl.getNum(); j++) {
addResource(vrml->frontUrl[j], resources);
}
// leftUrl
for (int j = 0; j < vrml->leftUrl.getNum(); j++) {
addResource(vrml->leftUrl[j], resources);
}
// rightUrl
for (int j = 0; j < vrml->rightUrl.getNum(); j++) {
addResource(vrml->rightUrl[j], resources);
}
// topUrl
for (int j = 0; j < vrml->topUrl.getNum(); j++) {
addResource(vrml->topUrl[j], resources);
}
}
}
}
示例9: setEdit
bool ViewProviderMirror::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// get the properties from the mirror feature
Part::Mirroring* mf = static_cast<Part::Mirroring*>(getObject());
Base::BoundBox3d bbox = mf->Shape.getBoundingBox();
float len = (float)bbox.CalcDiagonalLength();
Base::Vector3d base = mf->Base.getValue();
Base::Vector3d norm = mf->Normal.getValue();
Base::Vector3d cent = bbox.GetCenter();
base = cent.ProjToPlane(base, norm);
// setup the graph for editing the mirror plane
SoTransform* trans = new SoTransform;
SbRotation rot(SbVec3f(0,0,1), SbVec3f(norm.x,norm.y,norm.z));
trans->rotation.setValue(rot);
trans->translation.setValue(base.x,base.y,base.z);
trans->center.setValue(0.0f,0.0f,0.0f);
SoMaterial* color = new SoMaterial();
color->diffuseColor.setValue(0,0,1);
color->transparency.setValue(0.5);
SoCoordinate3* points = new SoCoordinate3();
points->point.setNum(4);
points->point.set1Value(0, -len/2,-len/2,0);
points->point.set1Value(1, len/2,-len/2,0);
points->point.set1Value(2, len/2, len/2,0);
points->point.set1Value(3, -len/2, len/2,0);
SoFaceSet* face = new SoFaceSet();
pcEditNode->addChild(trans);
pcEditNode->addChild(color);
pcEditNode->addChild(points);
pcEditNode->addChild(face);
// Now we replace the SoTransform node by a manipulator
// Note: Even SoCenterballManip inherits from SoTransform
// we cannot use it directly (in above code) because the
// translation and center fields are overridden.
SoSearchAction sa;
sa.setInterest(SoSearchAction::FIRST);
sa.setSearchingAll(FALSE);
sa.setNode(trans);
sa.apply(pcEditNode);
SoPath * path = sa.getPath();
if (path) {
SoCenterballManip * manip = new SoCenterballManip;
manip->replaceNode(path);
SoDragger* dragger = manip->getDragger();
dragger->addStartCallback(dragStartCallback, this);
dragger->addFinishCallback(dragFinishCallback, this);
dragger->addMotionCallback(dragMotionCallback, this);
}
pcRoot->addChild(pcEditNode);
}
else {
ViewProviderPart::setEdit(ModNum);
}
return true;
}
示例10: updateData
void ViewProviderRobotObject::updateData(const App::Property* prop)
{
Robot::RobotObject* robObj = static_cast<Robot::RobotObject*>(pcObject);
if (prop == &robObj->RobotVrmlFile) {
// read also from file
const char* filename = robObj->RobotVrmlFile.getValue();
QString fn = QString::fromUtf8(filename);
QFile file(fn);
SoInput in;
pcRobotRoot->removeAllChildren();
if (!fn.isEmpty() && file.open(QFile::ReadOnly)) {
QByteArray buffer = file.readAll();
in.setBuffer((void *)buffer.constData(), buffer.length());
SoSeparator * node = SoDB::readAll(&in);
if (node) pcRobotRoot->addChild(node);
pcRobotRoot->addChild(pcTcpRoot);
}
// search for the conection points +++++++++++++++++++++++++++++++++++++++++++++++++
Axis1Node = Axis2Node = Axis3Node = Axis4Node = Axis5Node = Axis6Node = 0;
SoSearchAction searchAction;
SoPath * path;
// Axis 1
searchAction.setName("FREECAD_AXIS1");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis1Node = static_cast<SoVRMLTransform *>(node);
}
// Axis 2
searchAction.setName("FREECAD_AXIS2");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis2Node = static_cast<SoVRMLTransform *>(node);
}
// Axis 3
searchAction.setName("FREECAD_AXIS3");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis3Node = static_cast<SoVRMLTransform *>(node);
}
// Axis 4
searchAction.setName("FREECAD_AXIS4");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis4Node = static_cast<SoVRMLTransform *>(node);
}
// Axis 5
searchAction.setName("FREECAD_AXIS5");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis5Node = static_cast<SoVRMLTransform *>(node);
}
// Axis 6
searchAction.setName("FREECAD_AXIS6");
searchAction.setInterest(SoSearchAction::FIRST);
searchAction.setSearchingAll(FALSE);
searchAction.apply(pcRobotRoot);
path = searchAction.getPath();
if(path){
SoNode* node = path->getTail();
std::string typeName = (const char*)node->getTypeId().getName();
if (!node || node->getTypeId() != SoVRMLTransform::getClassTypeId())
throw; // should not happen
Axis6Node = static_cast<SoVRMLTransform *>(node);
}
//.........这里部分代码省略.........