OpendTect-6_4  6.4
ui3dviewerbody.h
Go to the documentation of this file.
1 #ifndef ui3dviewerbody_h
2 #define ui3dviewerbody_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: Dec 2011
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uiobjbody.h"
16 
17 #include "mousecursor.h"
18 #include "refcount.h"
19 #include "visosg.h"
20 #include "uieventfilter.h"
21 
22 class QGestureEvent;
23 
24 namespace visBase
25 {
26  class Axes;
27  class Camera;
28  class PolygonSelection;
29  class Scene;
30  class SceneColTab;
31  class Transformation;
32  class ThumbWheel;
33  class DataObjectGroup;
34 }
35 
36 
37 namespace osgViewer { class CompositeViewer; class View; class GraphicsWindow; }
38 namespace osgGeo { class TrackballManipulator; }
39 
40 class ui3DViewer;
41 class TrackBallManipulatorMessenger;
42 class KeyBindMan;
44 class SwapCallback;
45 
46 namespace osg
47 {
48  class Group;
49  class GraphicsContext;
50  class Camera;
51  class MatrixTransform;
52  class Projection;
53  class Vec3f;
54  class Viewport;
55 }
56 
57 namespace osgViewer { class View; }
58 
60 
61 mClass(uiOSG) ui3DViewerBody : public uiObjectBody
62 {
63  friend class TrackBallManipulatorMessenger;
64 
65 public:
67  virtual ~ui3DViewerBody();
68 
69  void viewAll(bool animate);
70 
71  void setSceneID(int);
72  visBase::Scene* getScene() { return scene_; }
73  const visBase::Scene* getScene() const { return scene_; }
74 
75  bool serializeScene(const char*) const;
76 
77  void setBackgroundColor(const Color&);
78  Color getBackgroundColor() const;
79  Geom::Size2D<int> getViewportSizePixels() const;
80 
81  float getMouseWheelZoomFactor() const;
84  void setMouseWheelZoomFactor(float);
85 
86  void setReversedMouseWheelDirection(bool);
87  bool getReversedMouseWheelDirection() const;
88 
89  void setHomePos(const IOPar&);
90  void resetToHomePosition();
91 
92  void toggleCameraType();
93  bool isCameraPerspective() const;
94  bool isCameraOrthographic() const;
95 
96  void align();
97  void viewPlaneX();
98  void viewPlaneY();
99  void viewPlaneZ();
100  void viewPlaneInl();
101  void viewPlaneCrl();
102  void viewPlaneN();
103  void viewPlaneYZ();
104 
105  void uiRotate(float angle,bool horizontal);
106  void uiZoom(float rel,const osg::Vec3f* dir=0);
107  void setCameraZoom(float val);
108  float getCameraZoom() const;
109 
110  //Not sure were to put these
111  bool isViewMode() const;
112  virtual void setViewMode(bool viewmode,bool trigger);
113 
114  Coord3 getCameraPosition() const;
115  visBase::Camera* getVisCamera() { return camera_; }
116 
117  virtual void reSizeEvent(CallBacker*);
118  void toggleViewMode(CallBacker*);
119 
120  enum WheelMode { Never, Always, OnHover };
121  void setWheelDisplayMode(WheelMode);
122  WheelMode getWheelDisplayMode() const;
123 
124  void setAnimationEnabled(bool);
125  bool isAnimationEnabled() const;
126  void showRotAxis(bool);
127  bool isAxisShown() const;
128  void setAnnotColor(const Color&);
129  void setAnnotationFont(const FontData&);
130  visBase::PolygonSelection* getPolygonSelector();
131  visBase::SceneColTab* getSceneColTab();
132 
133  void toHomePos();
134  void saveHomePos();
135  bool isHomePosEmpty() { return homepos_.isEmpty(); }
136  void fillCameraPos(IOPar&) const;
137  bool useCameraPos(const IOPar&);
138  const osgViewer::View* getOsgViewerMainView() const { return view_; }
139  const osgViewer::View* getOsgViewerHudView() const { return hudview_; }
140  void setScenesPixelDensity(float dpi);
141 
142  enum StereoType { None, RedCyan, QuadBuffer };
143 
144  bool setStereoType(StereoType);
145  StereoType getStereoType() const;
146  void setStereoOffset(float);
147  float getStereoOffset() const;
148 
149  void setMapView(bool yn);
150  bool isMapView() const { return mapview_; }
151 
152  KeyBindMan& keyBindMan() { return keybindman_; }
153 
154  void removeSwapCallback(CallBacker*);
155 
156 protected:
157  void enableDragging( bool yn );
158 
159  enum ViewModeCursor { RotateCursor, PanCursor, ZoomCursor,
160  HoverCursor };
161  virtual void setViewModeCursor( ViewModeCursor );
162 
163  virtual void updateActModeCursor();
164  void mouseCursorChg(CallBacker*);
166 
167  void notifyManipulatorMovement(
168  float dh,float dv,float df);
169  void setupTouch();
170  void setupHUD();
171  void setupView();
172  void qtEventCB(CallBacker*);
173  void setFocusCB(CallBacker*);
174  void handleGestureEvent(QGestureEvent*);
175  static osgViewer::CompositeViewer* getCompositeViewer();
176 
177 
178  virtual osgViewer::GraphicsWindow& getGraphicsWindow() = 0;
179  virtual osg::GraphicsContext* getGraphicsContext() = 0;
180 
182 
183  void requestRedraw();
184 
185  osg::Camera* getOsgCamera();
186  const osg::Camera* getOsgCamera() const;
187  void setCameraPos(const osg::Vec3f&,
188  const osg::Vec3f&,bool);
189 
190  void thumbWheelRotationCB(CallBacker*);
191  void enableThumbWheelHandling(bool yn,
192  const visBase::ThumbWheel* tw=0);
193 
196 
203 
205  osgViewer::CompositeViewer* compositeviewer_;
206  osgViewer::View* view_;
207  osg::Viewport* viewport_;
210 
211  osgViewer::View* hudview_;
214 
219  TrackBallManipulatorMessenger* manipmessenger_;
220 
222 
225 
227 
228  bool mapview_;
229 };
230 
231 #endif
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
bool isHomePosEmpty()
Definition: ui3dviewerbody.h:135
keep osg camera status and render info
Definition: viscamera.h:30
osg::Switch * offscreenrenderswitch_
Definition: ui3dviewerbody.h:204
Definition of a mouse cursor, can be either a predefined shape (from the enum, or a file...
Definition: mousecursor.h:26
ui3DViewer & handle_
Definition: ui3dviewerbody.h:194
RefMan< visBase::DataObjectGroup > hudscene_
Definition: ui3dviewerbody.h:213
virtual uiObject & uiObjHandle()
Definition: i_uiobjqtbody.h:52
RefMan< visBase::Scene > scene_
Definition: ui3dviewerbody.h:198
bool isMapView() const
Definition: ui3dviewerbody.h:150
IOPar & printpar_
Definition: ui3dviewerbody.h:195
osgViewer::View * hudview_
Definition: ui3dviewerbody.h:211
uiEventFilter eventfilter_
Definition: ui3dviewerbody.h:215
uiMouseEventBlockerByGestures & mouseeventblocker_
Definition: ui3dviewerbody.h:216
Definition: visdata.h:28
const osgViewer::View * getOsgViewerHudView() const
Definition: ui3dviewerbody.h:139
A collection of geoscientific extensions to OpenSceneGraph.
Definition: visannot.h:38
Baseclass for different body implementation (direct & indirect) of OSG.
Definition: ui3dviewerbody.h:61
bool mapview_
Definition: ui3dviewerbody.h:228
The base class for most UI elements.
Definition: uiobj.h:38
Class for a swap callback. This class triggers on the second render that the context is up an running...
Definition: swapbuffercallback.h:26
Definition: uiparent.h:26
Definition: visthumbwheel.h:28
Data needed to make an actual font.
Definition: fontdata.h:20
osgViewer::CompositeViewer * compositeviewer_
Definition: ui3dviewerbody.h:205
RefMan< visBase::PolygonSelection > polygonselection_
Definition: ui3dviewerbody.h:218
FixedString None()
Definition: keystrs.h:90
const osgViewer::View * getOsgViewerMainView() const
Definition: ui3dviewerbody.h:138
is a class that is able to recieve events from Qt and trigger an OD-style notification/callback.
Definition: uieventfilter.h:28
RefMan< visBase::ThumbWheel > horthumbwheel_
Definition: ui3dviewerbody.h:199
WheelMode
Definition: ui3dviewerbody.h:120
RefMan< visBase::SceneColTab > visscenecoltab_
Definition: ui3dviewerbody.h:224
RefMan< visBase::Axes > axes_
Definition: ui3dviewerbody.h:217
Definition: vispolygonselection.h:40
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
ViewModeCursor
Definition: ui3dviewerbody.h:159
IOPar homepos_
Definition: ui3dviewerbody.h:223
Definition: ui3dviewerbody.h:159
StereoType
Definition: ui3dviewerbody.h:142
Definition: ui3dviewer.h:29
RefMan< visBase::ThumbWheel > verthumbwheel_
Definition: ui3dviewerbody.h:200
RefMan< visBase::ThumbWheel > distancethumbwheel_
Definition: ui3dviewerbody.h:201
SwapCallback * swapcallback_
Definition: ui3dviewerbody.h:221
KeyBindMan & keyBindMan()
Definition: ui3dviewerbody.h:152
RefMan< visBase::Camera > camera_
Definition: ui3dviewerbody.h:197
visBase::Camera * getVisCamera()
Definition: ui3dviewerbody.h:115
const visBase::Scene * getScene() const
Definition: ui3dviewerbody.h:73
int wheeldisplaymode_
Definition: ui3dviewerbody.h:202
A cartesian coordinate in 3D space.
Definition: coord.h:72
visBase::Scene * getScene()
Definition: ui3dviewerbody.h:72
KeyBindMan & keybindman_
Definition: ui3dviewerbody.h:226
float stereooffset_
Definition: ui3dviewerbody.h:209
Definition: visannot.h:43
Definition: visscenecoltab.h:30
Scene manages all DataObjects and has some managing functions such as the selection management and va...
Definition: visscene.h:40
TrackBallManipulatorMessenger * manipmessenger_
Definition: ui3dviewerbody.h:219
Open Scene Graph.
Definition: visannot.h:29
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
Definition: uimouseeventblockerbygesture.h:27
Manages keybindings.
Definition: keybindings.h:75
osg::Switch * offscreenrenderhudswitch_
Definition: ui3dviewerbody.h:212
osgViewer::View * view_
Definition: ui3dviewerbody.h:206
#define mClass(module)
Definition: commondefs.h:164
MouseCursor actmodecursor_
Definition: ui3dviewerbody.h:165
osg::Viewport * viewport_
Definition: ui3dviewerbody.h:207
StereoType stereotype_
Definition: ui3dviewerbody.h:208

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