OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
HandlerBase.h
Go to the documentation of this file.
1#pragma once
2
3#include <osg/Geode>
4#include <osg/Switch>
5
6namespace osg
7{
8 class Node;
9 class Switch;
10 class Drawable;
11}
12
13#include <osg/Vec3d>
14
15#include <list>
16
17class HandlerBase;
18
20{
21public:
23 virtual ~HandlerNotifier() {};
24
25 virtual void handlerInteraction(HandlerBase *handler) = 0;
26};
27
29{
30public:
31 HandlerBase() : selectorDrawable(nullptr) {};
32 virtual ~HandlerBase() {};
33
34 virtual osg::Node *getNode(void) = 0;
35
36 virtual void mouseOver(bool flag) = 0;
37
38 void createSelectLine(osg::Switch *node, std::list<osg::Vec3d> &pointList, bool visible = false);
39
40 osg::Drawable *getSelectorDrawable(void) { return selectorDrawable; }
41
42 virtual void setInteraction(int intersectionIndex, double intersectionRatio) = 0;
43 virtual void setInteractionReference(int intersectionIndex, double intersectionRatio) = 0;
44
45 void beginInteraction(void);
46 void endInteraction(void);
47
48 void addNotifier(HandlerNotifier *notifier);
49 void removeNotifier(HandlerNotifier *notifier);
50
51 void reportInteraction(void);
52
53private:
54 osg::Drawable *selectorDrawable;
55 osg::ref_ptr<osg::Geode> selectLine;
56 osg::ref_ptr<osg::Switch> switchNode;
57
58 std::list<HandlerNotifier *> notifiers;
59};
60
Definition HandlerBase.h:29
virtual ~HandlerBase()
Definition HandlerBase.h:32
virtual void mouseOver(bool flag)=0
osg::Drawable * getSelectorDrawable(void)
Definition HandlerBase.h:40
void addNotifier(HandlerNotifier *notifier)
Definition HandlerBase.cpp:86
void beginInteraction(void)
Definition HandlerBase.cpp:70
void reportInteraction(void)
Definition HandlerBase.cpp:96
virtual void setInteractionReference(int intersectionIndex, double intersectionRatio)=0
void endInteraction(void)
Definition HandlerBase.cpp:78
HandlerBase()
Definition HandlerBase.h:31
void createSelectLine(osg::Switch *node, std::list< osg::Vec3d > &pointList, bool visible=false)
Definition HandlerBase.cpp:14
virtual osg::Node * getNode(void)=0
virtual void setInteraction(int intersectionIndex, double intersectionRatio)=0
void removeNotifier(HandlerNotifier *notifier)
Definition HandlerBase.cpp:91
Definition HandlerBase.h:20
virtual ~HandlerNotifier()
Definition HandlerBase.h:23
HandlerNotifier()
Definition HandlerBase.h:22
virtual void handlerInteraction(HandlerBase *handler)=0
Definition RubberbandOsgWrapper.h:22