00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00034 #include "../include/IPSA/ipsaclasses.h"
00035 #include "../include/IPSA/IpsaSimulator.h"
00036 #include "../include/IPSA/viewer/instructions/ShowJoints.h"
00037
00038 #include <Inventor/actions/SoSearchAction.h>
00039
00040
00041 Instruction::tExecResultType ShowJoints::vExecute(std::vector<std::string>& Instr, std::ostringstream& answer, unsigned int& numberOfReturnValues)
00042 {
00043 #ifdef WIN32
00044 Instr;
00045 #endif // WIN32
00046 numberOfReturnValues = 0;
00047
00048 SoSearchAction sa;
00049 sa.setType(SoJoint::getClassTypeId());
00050 sa.setInterest(SoSearchAction::ALL);
00051 sa.apply(ipsaSimulator->getSceneGraph());
00052 SoPathList& pl = sa.getPaths();
00053
00054 bool showJoints = false;
00055 if ("1" == Instr[1])
00056 showJoints = true;
00057
00058 for (int i=0;i<pl.getLength(); i++)
00059 {
00060 SoPath* path = pl[i];
00061 SoJoint* joint = static_cast<SoJoint*>(path->getNodeFromTail(0));
00062
00063 joint->drawVisualisationShape.setValue(showJoints);
00064 }
00065
00066 return eOK;
00067 }