OpendTect-6_4  6.4
visobject.h
Go to the documentation of this file.
1 #ifndef visobject_h
2 #define visobject_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kris Tingdahl
9  Date: Jan 2002
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "visbasemod.h"
17 #include "visdata.h"
18 #include "thread.h"
19 #include "visosg.h"
20 
21 
22 namespace osg { class Group; }
23 
24 namespace visBase
25 {
26 class Material;
27 class Transformation;
28 class EventCatcher;
29 
35 
36 
38 {
39 public:
40  virtual void setMaterial( Material* ) = 0;
41  virtual Material* getMaterial() = 0;
42 
43  virtual bool getBoundingBox(Coord3& min,Coord3& max) const;
44  virtual void setSceneEventCatcher( EventCatcher* ) {}
45 
46  void setSelectable(bool yn) { isselectable=yn; }
47  bool selectable() const { return isselectable; }
48  NotifierAccess* selection() { return &selnotifier; }
49  NotifierAccess* deSelection() {return &deselnotifier;}
50  virtual NotifierAccess* rightClicked() { return &rightClick; }
51  const EventInfo* rightClickedEventInfo() const{return rcevinfo;}
52  const TypeSet<int>* rightClickedPath() const;
53 
54 protected:
55  void triggerSel()
56  { if (isselectable) selnotifier.trigger(); }
57  void triggerDeSel()
58  { if (isselectable) deselnotifier.trigger(); }
59  void triggerRightClick(const EventInfo*);
60  VisualObject(bool selectable=false);
61  ~VisualObject();
62 
63 private:
69 };
70 
71 
73 {
74 public:
75 
76  void setRightHandSystem(bool yn) { righthandsystem_=yn; }
77  bool isRightHandSystem() const { return righthandsystem_; }
78 
79  void setLockable();
83  void readLock();
84  void readUnLock();
85  bool tryReadLock();
86  void writeLock();
87  void writeUnLock();
88  bool tryWriteLock();
89 
90  void setMaterial(Material*);
91  const Material* getMaterial() const { return material_; }
92  Material* getMaterial();
93 
94  static const char* sKeyMaterialID(); //Remove
95  static const char* sKeyMaterial();
96  static const char* sKeyIsOn();
97 
98  virtual bool usePar(const IOPar&);
99  virtual void fillPar(IOPar&) const;
100 
101 protected:
102 
103  int addChild(osg::Node*);
105  void insertChild(int pos,osg::Node*);
106  void removeChild(osg::Node*);
107  int childIndex(const osg::Node*) const;
108 
109 
110  VisualObjectImpl(bool selectable);
111  virtual ~VisualObjectImpl();
112 
113  virtual void materialChangeCB(CallBacker*);
114 
115  virtual void setGroupNode(osg::Group*);
117 
120 
121 private:
122 
123  osg::Group* osgroot_;
124 };
125 
126 mLockerClassImpl( visBase, VisualReadLockLocker, VisualObjectImpl,
127  readLock(), readUnLock(), tryReadLock() )
129  writeLock(), writeUnLock(), tryWriteLock() )
130 };
131 
132 #endif
Definition: visobject.h:37
#define mExpClass(module)
Definition: commondefs.h:160
void setRightHandSystem(bool yn)
Definition: visobject.h:76
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
RenderMode
Base class for all objects that are visual on the scene.
Definition: visobject.h:34
NotifierAccess * deSelection()
Definition: visobject.h:49
void setSelectable(bool yn)
Definition: visobject.h:46
void triggerSel()
Definition: visobject.h:55
Interface class for Notifier. See comments there.
Definition: callback.h:161
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
DataObject is the base class off all objects that are used in Visualization and ought to be shared in...
Definition: visdata.h:65
VisualWriteLockLocker
Definition: visobject.h:128
virtual NotifierAccess * rightClicked()
Definition: visobject.h:50
Definition: visobject.h:34
#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:199
bool selectable() const
Definition: visobject.h:47
Definition: visobject.h:34
Definition: visobject.h:34
const EventInfo * rcevinfo
Definition: visobject.h:68
bool isRightHandSystem() const
Definition: visobject.h:77
Definition: callback.h:254
Material * material_
Definition: visobject.h:118
VisualObjectImpl
Definition: visobject.h:128
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
osg::Group * osgroot_
Definition: visobject.h:123
void triggerDeSel()
Definition: visobject.h:57
const EventInfo * rightClickedEventInfo() const
Definition: visobject.h:51
Definition: vismaterial.h:37
const Material * getMaterial() const
Definition: visobject.h:91
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
A cartesian coordinate in 3D space.
Definition: coord.h:72
bool isselectable
Definition: visobject.h:64
Definition: visannot.h:43
Notifier< VisualObject > rightClick
Definition: visobject.h:67
Open Scene Graph.
Definition: visannot.h:29
Definition: visevent.h:44
virtual void setSceneEventCatcher(EventCatcher *)
Definition: visobject.h:44
Notifier< VisualObject > deselnotifier
Definition: visobject.h:66
bool righthandsystem_
Definition: visobject.h:119
Definition: visobject.h:72
Definition: visevent.h:87
NotifierAccess * selection()
Definition: visobject.h:48
Notifier< VisualObject > selnotifier
Definition: visobject.h:65

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