Runs an inventor viewer. Allows to click points on the model, which can be handled in different ways by subclasses. More...
#include <InventorViewer.h>
Public Member Functions | |
void | init (const char *windowName="InventorViewer", float bck_r=0.3, float bck_g=0.3, float bck_b=0.3) |
InventorViewer (bool _faces_ccw=true) | |
InventorViewer (const InventorViewer &o) | |
void | loadModel (SoNode *model) |
bool | loadModel (const std::string &filename) |
void | runViewer () |
~InventorViewer () | |
Protected Member Functions | |
SoSelection * | getRoot () |
SoQtExaminerViewer * | getViewer () |
bool | isFacesCCW () const |
virtual void | onClickModel (const SoPickedPoint *pickPoint) |
virtual void | onMouseBtnClick (SoEventCallback *pNode) |
Static Protected Member Functions | |
static bool | computeCorrectFaceNormal (const SoPickedPoint *pick, bool ccw_face, Eigen::Vector3d &normal, int &shapeIdx) |
static SoNode * | getIntStr (const std::string &sscanfStr, const SoPath *path, std::string &str, int &num, int &pathIdx) |
Static Private Member Functions | |
static void | mouseBtnCB (void *userData, SoEventCallback *pNode) |
Private Attributes | |
bool | faces_ccw |
bool | initialized |
SoSelection * | root |
SoQtExaminerViewer * | viewer |
QWidget * | viewWindow |
Runs an inventor viewer. Allows to click points on the model, which can be handled in different ways by subclasses.
Definition at line 63 of file InventorViewer.h.
InventorViewer::InventorViewer | ( | bool | _faces_ccw = true | ) | [explicit] |
_faces_ccw | faces are to be treated as counter-clockwise. Needed for normal calculations. |
Definition at line 62 of file InventorViewer.cpp.
InventorViewer::InventorViewer | ( | const InventorViewer & | o | ) |
Definition at line 67 of file InventorViewer.cpp.
Definition at line 70 of file InventorViewer.cpp.
bool InventorViewer::computeCorrectFaceNormal | ( | const SoPickedPoint * | pick, |
bool | ccw_face, | ||
Eigen::Vector3d & | normal, | ||
int & | shapeIdx | ||
) | [static, protected] |
Calculates the correct face normal of the pick point.
shapeIdx | output: the index in the pick path at which the actual shape resides. Normal coordinates are in the frame of this shape. |
Definition at line 156 of file InventorViewer.cpp.
SoNode * InventorViewer::getIntStr | ( | const std::string & | sscanfStr, |
const SoPath * | path, | ||
std::string & | str, | ||
int & | num, | ||
int & | pathIdx | ||
) | [static, protected] |
Helper function which can be used to find a specific node along the path which is formatted in a given way, such that a a number and a name can be extracted. The last such node found along the path is returned, along with the extracted number and string as paramter.
sscanfStr | input: the string to use in sscanf, which must extract *first* a number (int), *then* a string for the name. This could be for example "_visual_%i_%s" |
str | output: extracted string / name |
num | output: extracted number |
pathIdx | output: index the link has in the path. |
Definition at line 304 of file InventorViewer.cpp.
SoSelection* urdf_viewer::InventorViewer::getRoot | ( | ) | [inline, protected] |
Definition at line 130 of file InventorViewer.h.
SoQtExaminerViewer* urdf_viewer::InventorViewer::getViewer | ( | ) | [inline, protected] |
Definition at line 125 of file InventorViewer.h.
void InventorViewer::init | ( | const char * | windowName = "InventorViewer" , |
float | bck_r = 0.3 , |
||
float | bck_g = 0.3 , |
||
float | bck_b = 0.3 |
||
) |
Initialize Inventor and Qt TODO: For some reason I haven't yet further investigated, this has to be called **after** functions as Urdf2Inventor::loadAndGetAsInventor(), or it won't work. Find out why, and fix it.
Definition at line 81 of file InventorViewer.cpp.
bool urdf_viewer::InventorViewer::isFacesCCW | ( | ) | const [inline, protected] |
Definition at line 135 of file InventorViewer.h.
void InventorViewer::loadModel | ( | SoNode * | model | ) |
Load a model into the viewer
Definition at line 100 of file InventorViewer.cpp.
bool InventorViewer::loadModel | ( | const std::string & | filename | ) |
Load a model from an inventor file
Definition at line 110 of file InventorViewer.cpp.
void InventorViewer::mouseBtnCB | ( | void * | userData, |
SoEventCallback * | pNode | ||
) | [static, private] |
Definition at line 327 of file InventorViewer.cpp.
virtual void urdf_viewer::InventorViewer::onClickModel | ( | const SoPickedPoint * | pickPoint | ) | [inline, protected, virtual] |
For subclasses: Called when user clicks on part of the model
Definition at line 100 of file InventorViewer.h.
virtual void urdf_viewer::InventorViewer::onMouseBtnClick | ( | SoEventCallback * | pNode | ) | [inline, protected, virtual] |
For subclasses: on any mouse button click
Definition at line 104 of file InventorViewer.h.
void InventorViewer::runViewer | ( | ) |
Definition at line 131 of file InventorViewer.cpp.
bool urdf_viewer::InventorViewer::faces_ccw [private] |
Definition at line 146 of file InventorViewer.h.
bool urdf_viewer::InventorViewer::initialized [private] |
Definition at line 148 of file InventorViewer.h.
SoSelection* urdf_viewer::InventorViewer::root [private] |
Definition at line 147 of file InventorViewer.h.
SoQtExaminerViewer* urdf_viewer::InventorViewer::viewer [private] |
Definition at line 145 of file InventorViewer.h.
QWidget* urdf_viewer::InventorViewer::viewWindow [private] |
Definition at line 144 of file InventorViewer.h.