OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
instancemode.hpp
Go to the documentation of this file.
1 #ifndef CSV_RENDER_INSTANCEMODE_H
2 #define CSV_RENDER_INSTANCEMODE_H
3 
4 #include <osg/ref_ptr>
5 #include <osg/Quat>
6 #include <osg/Vec3f>
7 
8 #include "editmode.hpp"
9 
10 namespace CSVWidget
11 {
12  class SceneToolMode;
13 }
14 
15 namespace CSVRender
16 {
17  class TagBase;
18  class InstanceSelectionMode;
19 
20  class InstanceMode : public EditMode
21  {
22  Q_OBJECT
23 
24  enum DragMode
25  {
30  };
31 
33  std::string mSubModeId;
36  int mDragAxis;
37  bool mLocked;
39 
40  int getSubModeFromId (const std::string& id) const;
41 
42  osg::Vec3f quatToEuler(const osg::Quat& quat) const;
43  osg::Quat eulerToQuat(const osg::Vec3f& euler) const;
44 
45  osg::Vec3f getSelectionCenter(const std::vector<osg::ref_ptr<TagBase> >& selection) const;
46  osg::Vec3f getScreenCoords(const osg::Vec3f& pos);
47 
48  public:
49 
50  InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent = 0);
51 
52  virtual void activate (CSVWidget::SceneToolbar *toolbar);
53 
54  virtual void deactivate (CSVWidget::SceneToolbar *toolbar);
55 
56  virtual void setEditLock (bool locked);
57 
58  virtual void primaryEditPressed (const WorldspaceHitResult& hit);
59 
60  virtual void secondaryEditPressed (const WorldspaceHitResult& hit);
61 
62  virtual void primarySelectPressed (const WorldspaceHitResult& hit);
63 
64  virtual void secondarySelectPressed (const WorldspaceHitResult& hit);
65 
66  virtual bool primaryEditStartDrag (const QPoint& pos);
67 
68  virtual bool secondaryEditStartDrag (const QPoint& pos);
69 
70  virtual void drag (const QPoint& pos, int diffX, int diffY, double speedFactor);
71 
72  virtual void dragCompleted(const QPoint& pos);
73 
76  virtual void dragAborted();
77 
78  virtual void dragWheel (int diff, double speedFactor);
79 
80  virtual void dragEnterEvent (QDragEnterEvent *event);
81 
82  virtual void dropEvent (QDropEvent *event);
83 
84  virtual int getSubMode() const;
85 
86  private slots:
87 
88  void subModeChanged (const std::string& id);
89  };
90 }
91 
92 #endif
virtual void primaryEditPressed(const WorldspaceHitResult &hit)
Default-implementation: Ignored.
Definition: instancemode.cpp:173
Definition: instancemode.hpp:27
Definition: worldspacewidget.hpp:48
Definition: instancemode.hpp:20
Definition: instancemode.hpp:26
int mDragAxis
Definition: instancemode.hpp:36
osg::Vec3f getSelectionCenter(const std::vector< osg::ref_ptr< TagBase > > &selection) const
Definition: instancemode.cpp:62
virtual void deactivate(CSVWidget::SceneToolbar *toolbar)
Default-Implementation: do nothing.
Definition: instancemode.cpp:143
virtual void primarySelectPressed(const WorldspaceHitResult &hit)
Default-implementation: Ignored.
Definition: instancemode.cpp:185
Mode selector tool.
Definition: scenetoolmode.hpp:18
DragMode mDragMode
Definition: instancemode.hpp:35
std::string mSubModeId
Definition: instancemode.hpp:33
osg::Vec3f getScreenCoords(const osg::Vec3f &pos)
Definition: instancemode.cpp:84
void subModeChanged(const std::string &id)
Definition: instancemode.cpp:644
virtual void secondarySelectPressed(const WorldspaceHitResult &hit)
Default-implementation: Ignored.
Definition: instancemode.cpp:201
virtual void drag(const QPoint &pos, int diffX, int diffY, double speedFactor)
Default-implementation: ignored.
Definition: instancemode.cpp:293
virtual int getSubMode() const
Default: return -1.
Definition: instancemode.cpp:639
Definition: worldspacewidget.hpp:40
Definition: instancemode.hpp:28
virtual void dragAborted()
Definition: instancemode.cpp:485
virtual bool secondaryEditStartDrag(const QPoint &pos)
Definition: instancemode.cpp:285
virtual void dropEvent(QDropEvent *event)
Default-implementation: ignored.
Definition: instancemode.cpp:534
InstanceMode(WorldspaceWidget *worldspaceWidget, QWidget *parent=0)
Definition: instancemode.cpp:94
osg::Quat eulerToQuat(const osg::Vec3f &euler) const
Definition: instancemode.cpp:53
int getSubModeFromId(const std::string &id) const
Definition: instancemode.cpp:25
osg::Vec3f quatToEuler(const osg::Quat &quat) const
Definition: instancemode.cpp:30
virtual void secondaryEditPressed(const WorldspaceHitResult &hit)
Default-implementation: Ignored.
Definition: instancemode.cpp:179
InstanceSelectionMode * mSelectionMode
Definition: instancemode.hpp:34
DragMode
Definition: instancemode.hpp:24
bool mLocked
Definition: instancemode.hpp:37
float mUnitScaleDist
Definition: instancemode.hpp:38
virtual void dragEnterEvent(QDragEnterEvent *event)
Default-implementation: ignored.
Definition: instancemode.cpp:522
virtual void dragWheel(int diff, double speedFactor)
Default-implementation: ignored.
Definition: instancemode.cpp:491
Definition: scenetoolbar.hpp:12
virtual bool primaryEditStartDrag(const QPoint &pos)
Definition: instancemode.cpp:215
Definition: instanceselectionmode.hpp:8
virtual void setEditLock(bool locked)
Default-implementation: Ignored.
Definition: instancemode.cpp:165
CSVWidget::SceneToolMode * mSubMode
Definition: instancemode.hpp:32
Definition: editmode.hpp:19
Definition: instancemode.hpp:29
virtual void dragCompleted(const QPoint &pos)
Default-implementation: ignored.
Definition: instancemode.cpp:452
virtual void activate(CSVWidget::SceneToolbar *toolbar)
Default-Implementation: do nothing.
Definition: instancemode.cpp:101