InventorViewer.h
Go to the documentation of this file.
00001 
00032 #ifndef URDF_VIEWER_INVENTORVIEWER_H
00033 #define URDF_VIEWER_INVENTORVIEWER_H
00034 // Copyright Jennifer Buehler
00035 
00036 #include <Inventor/Qt/SoQt.h>
00037 #include <Inventor/nodes/SoSeparator.h>
00038 #include <Inventor/nodes/SoSelection.h>
00039 #include <Inventor/nodes/SoTransform.h>
00040 #include <Inventor/nodes/SoEventCallback.h>
00041 #include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
00042 #include <Inventor/nodes/SoMaterial.h>
00043 
00044 #include <Eigen/Geometry>
00045 
00046 #include <vector>
00047 #include <map>
00048 #include <fstream>
00049 #include <iostream>
00050 #include <sstream>
00051 #include <string>
00052 
00053 namespace urdf_viewer
00054 {
00063 class InventorViewer
00064 {
00065 public:
00066 
00070     explicit InventorViewer(bool _faces_ccw = true);
00071 
00072     InventorViewer(const InventorViewer& o);
00073     ~InventorViewer();
00074 
00075 
00081     void init(const char * windowName = "InventorViewer", float bck_r=0.3, float bck_g=0.3, float bck_b=0.3);
00082 
00086     void loadModel(SoNode * model);
00087 
00091     bool loadModel(const std::string& filename);
00092 
00093     void runViewer();
00094 
00095 protected:
00096 
00100     virtual void onClickModel(const SoPickedPoint * pickPoint) {}
00104     virtual void onMouseBtnClick(SoEventCallback *pNode) {}
00105 
00111     static bool computeCorrectFaceNormal(const SoPickedPoint * pick, bool ccw_face, Eigen::Vector3d& normal, int& shapeIdx);
00112 
00123     static SoNode * getIntStr(const std::string& sscanfStr, const SoPath * path, std::string& str, int& num, int& pathIdx);
00124 
00125     SoQtExaminerViewer * getViewer()
00126     {
00127         return viewer;
00128     }
00129 
00130     SoSelection * getRoot()
00131     {
00132         return root;
00133     }
00134 
00135     bool isFacesCCW() const
00136     {
00137         return faces_ccw;
00138     }
00139 
00140 private:
00141 
00142     static void mouseBtnCB(void *userData, SoEventCallback *pNode);
00143 
00144     QWidget * viewWindow;
00145     SoQtExaminerViewer * viewer;
00146     bool faces_ccw;
00147     SoSelection * root;
00148     bool initialized;
00149 };
00150 
00151 }  //  namespace urdf_viewer
00152 #endif   // URDF_VIEWER_INVENTORVIEWER_H


urdf_viewer
Author(s): Jennifer Buehler
autogenerated on Fri Mar 1 2019 03:38:13