OpendTect  6.3
visobject.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Kris Tingdahl
8  Date: Jan 2002
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "visdata.h"
15 #include "visosg.h"
16 #include "thread.h"
17 namespace osg { class Group; }
18 
19 namespace visBase
20 {
21 class Material;
22 class Transformation;
23 class EventCatcher;
24 
30 
31 
33 {
34 public:
35  virtual void setMaterial( Material* ) = 0;
36  virtual Material* getMaterial() = 0;
37 
38  virtual bool getBoundingBox(Coord3& min,Coord3& max) const;
39  virtual void setSceneEventCatcher( EventCatcher* ) {}
40 
41  void setSelectable(bool yn) { isselectable=yn; }
42  bool selectable() const { return isselectable; }
43  NotifierAccess* selection() { return &selnotifier; }
44  NotifierAccess* deSelection() {return &deselnotifier;}
45  virtual NotifierAccess* rightClicked() { return &rightClick; }
46  const EventInfo* rightClickedEventInfo() const{return rcevinfo;}
47  const TypeSet<int>* rightClickedPath() const;
48 
49 protected:
50  void triggerSel()
51  { if (isselectable) selnotifier.trigger(); }
52  void triggerDeSel()
53  { if (isselectable) deselnotifier.trigger(); }
54  void triggerRightClick(const EventInfo*);
55  VisualObject(bool selectable=false);
56  ~VisualObject();
57 
58 private:
64 };
65 
66 
68 {
69 public:
70 
71  void setRightHandSystem(bool yn) { righthandsystem_=yn; }
72  bool isRightHandSystem() const { return righthandsystem_; }
73 
74  void setLockable();
78  void readLock();
79  void readUnLock();
80  bool tryReadLock();
81  void writeLock();
82  void writeUnLock();
83  bool tryWriteLock();
84 
85  void setMaterial(Material*);
86  const Material* getMaterial() const { return material_; }
87  Material* getMaterial();
88 
89  static const char* sKeyMaterialID(); //Remove
90  static const char* sKeyMaterial();
91  static const char* sKeyIsOn();
92 
93  virtual bool usePar(const IOPar&);
94  virtual void fillPar(IOPar&) const;
95 
96 protected:
97 
98  int addChild(osg::Node*);
100  void insertChild(int pos,osg::Node*);
101  void removeChild(osg::Node*);
102  int childIndex(const osg::Node*) const;
103 
104 
105  VisualObjectImpl(bool selectable);
106  virtual ~VisualObjectImpl();
107 
108  virtual void materialChangeCB(CallBacker*);
109 
110  virtual void setGroupNode(osg::Group*);
112 
115 
116 private:
117 
118  osg::Group* osgroot_;
119 };
120 
121 mLockerClassImpl( visBase, VisualReadLockLocker, VisualObjectImpl,
122  readLock(), readUnLock(), tryReadLock() )
124  writeLock(), writeUnLock(), tryWriteLock() )
125 };
Definition: visobject.h:32
#define mExpClass(module)
Definition: commondefs.h:157
void setRightHandSystem(bool yn)
Definition: visobject.h:71
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
RenderMode
Base class for all objects that are visual on the scene.
Definition: visobject.h:29
NotifierAccess * deSelection()
Definition: visobject.h:44
void setSelectable(bool yn)
Definition: visobject.h:41
void triggerSel()
Definition: visobject.h:50
Interface class for Notifier. See comments there.
Definition: notify.h:20
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
DataObject is the base class off all objects that are used in Visualization and ought to be shared in...
Definition: visdata.h:59
VisualWriteLockLocker
Definition: visobject.h:123
virtual NotifierAccess * rightClicked()
Definition: visobject.h:45
Definition: visobject.h:29
#define mLockerClassImpl(mod, clssnm, clss, lockfn, unlockfn, trylockfn)
Is an object that is convenient to use when a mutex should be locked and unlocked automatically when ...
Definition: thread.h:203
bool selectable() const
Definition: visobject.h:42
Definition: visobject.h:29
Definition: visobject.h:29
const EventInfo * rcevinfo
Definition: visobject.h:63
bool isRightHandSystem() const
Definition: visobject.h:72
Class to help setup a callback handling.
Definition: notify.h:121
Material * material_
Definition: visobject.h:113
3D point or vector
Definition: commontypes.h:57
VisualObjectImpl
Definition: visobject.h:123
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
osg::Group * osgroot_
Definition: visobject.h:118
void triggerDeSel()
Definition: visobject.h:52
const EventInfo * rightClickedEventInfo() const
Definition: visobject.h:46
Definition: vismaterial.h:36
const Material * getMaterial() const
Definition: visobject.h:86
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
bool isselectable
Definition: visobject.h:59
Definition: visannot.h:40
Notifier< VisualObject > rightClick
Definition: visobject.h:62
Open Scene Graph.
Definition: visannot.h:26
Definition: visevent.h:40
virtual void setSceneEventCatcher(EventCatcher *)
Definition: visobject.h:39
Notifier< VisualObject > deselnotifier
Definition: visobject.h:61
bool righthandsystem_
Definition: visobject.h:114
Definition: visobject.h:67
Definition: visevent.h:83
NotifierAccess * selection()
Definition: visobject.h:43
Notifier< VisualObject > selnotifier
Definition: visobject.h:60

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017