cherish
DraggableWire.h
1 #ifndef DRAGGABLEWIRE_H
2 #define DRAGGABLEWIRE_H
3 
4 #include <osg/Geode>
5 #include <osg/Geometry>
6 #include <osg/Switch>
7 #include <osg/StateSet>
8 #include <osg/Point>
9 #include <osg/LineWidth>
10 #include <osg/MatrixTransform>
11 
12 #include "SVMData.h"
13 
14 namespace entity {
15 
20 class DraggableWire : public osg::MatrixTransform
21 {
22  friend class SVMData;
23 public:
25  DraggableWire();
26 
28  osg::Vec3f getCenter3D() const;
29 
31  osg::Vec3f getCenter2D() const;
32 
34  osg::Plane getPlane() const;
35 
37  const osg::Geode* getGeode() const;
38 
40  void editPick(double u, double v);
41 
43  void unselect();
44 
46  void select();
47 
50  void pick(int index);
51 
53  void unpick();
54 
56  void drag();
57 
59  void dragStop();
60 
62  osg::Vec3f getPoint2D(int i) const;
63 
65  osg::Vec3f getPoint3D(int i) const;
66 
67 protected:
70 
72  void setColorWire(osg::Vec4f color);
73 
75  void setColorPoint(int index, osg::Vec4f color);
76 
78  void setColorPointWire(int index, osg::Vec4f color);
79 
81  void updateGeometry(osg::Geometry* geom);
82 
83 private:
84  osg::Geode* m_geode;
85  osg::Geometry* m_wire;
86  osg::Geometry* m_points;
87  int m_selectedPoint;
89 }; // class DraggableWire
90 } // namespace entity
91 
92 
93 #endif // DRAGGABLEWIRE_H
void setColorPointWire(int index, osg::Vec4f color)
Definition: DraggableWire.cpp:177
Definition: SVMData.h:22
Scene graph entities.
Definition: AddEntityCommand.h:17
void pick(int index)
Definition: DraggableWire.cpp:100
osg::Vec3f getCenter3D() const
Definition: DraggableWire.cpp:48
void unpick()
Definition: DraggableWire.cpp:112
void dragStop()
Definition: DraggableWire.cpp:124
void setColorPoint(int index, osg::Vec4f color)
Definition: DraggableWire.cpp:166
void drag()
Definition: DraggableWire.cpp:118
void unselect()
Definition: DraggableWire.cpp:87
A scene graph class that contains all the geometric entities of entity::SVMData.
Definition: DraggableWire.h:20
void setColorPointsDefaults()
Definition: DraggableWire.cpp:144
const osg::Geode * getGeode() const
Definition: DraggableWire.cpp:70
osg::Plane getPlane() const
Definition: DraggableWire.cpp:62
void setColorWire(osg::Vec4f color)
Definition: DraggableWire.cpp:154
osg::Vec3f getPoint3D(int i) const
Definition: DraggableWire.cpp:139
osg::Vec3f getPoint2D(int i) const
Definition: DraggableWire.cpp:130
void editPick(double u, double v)
Definition: DraggableWire.cpp:75
void select()
Definition: DraggableWire.cpp:94
void updateGeometry(osg::Geometry *geom)
Definition: DraggableWire.cpp:190
DraggableWire()
Definition: DraggableWire.cpp:10
osg::Vec3f getCenter2D() const
Definition: DraggableWire.cpp:53