Logo ROOT   6.08/07
Reference Guide
TGLManip.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder 16/09/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLManip
13 #define ROOT_TGLManip
14 
15 #ifndef ROOT_TVirtualGL
16 #include "TVirtualGL.h"
17 #endif
18 #ifndef ROOT_TPoint
19 #include "TPoint.h"
20 #endif
21 #ifndef ROOT_GuiTypes
22 #include "GuiTypes.h"
23 #endif
24 #ifndef ROOT_TGLUtil
25 #include "TGLUtil.h"
26 #endif
27 
28 class TGLPhysicalShape;
29 class TGLVertex3;
30 class TGLVector3;
31 class TGLCamera;
32 class TGLRect;
33 class TGLBoundingBox;
34 
35 
36 class TGLManip : public TVirtualGLManip
37 {
38 protected:
39  TGLPhysicalShape *fShape; //! manipulated shape
40  UInt_t fSelectedWidget; //! active width (axis) component
41  Bool_t fActive; //! manipulator is active?
42 
43  // Mouse tracking - in WINDOW coords
44  TPoint fFirstMouse; //! first (start) mouse position (in WINDOW coords)
45  TPoint fLastMouse; //! last (latest) mouse position (in WINDOW coords)
46 
47  TGLManip(const TGLManip&);
48  TGLManip& operator=(const TGLManip&);
49 
50  void CalcDrawScale(const TGLBoundingBox& box, const TGLCamera& camera,
51  Double_t& base, TGLVector3 axis[3]) const;
52 
53  const UChar_t* ColorFor(UInt_t widget) const;
54 
55 public:
56  TGLManip();
57  TGLManip(TGLPhysicalShape* shape);
58  virtual ~TGLManip();
59 
61  void SetSelectedWidget(UInt_t s) { fSelectedWidget = s; }
62 
63  Bool_t GetActive() const { return fActive; }
64  void SetActive(Bool_t a) { fActive = a; }
65 
66  void Attach(TGLPhysicalShape* shape) { fShape = shape; }
67  TGLPhysicalShape * GetAttached() const { return fShape; }
68 
69  virtual void Draw(const TGLCamera& camera) const = 0;
70  // CRAPPY TVirtualGLManip TTTT, just override it here
71  virtual Bool_t Select(const TGLCamera&, const TGLRect&, const TGLBoundingBox&) { return kFALSE; }
72 
73  virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera);
74  virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera);
75 
76  ClassDef(TGLManip, 0); // abstract base GL manipulator widget
77 };
78 
79 #endif
Abstract base class for viewer manipulators, which allow direct in viewer manipulation of a (TGlPhysi...
Definition: TGLManip.h:36
virtual void Draw(const TGLCamera &camera) const =0
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
virtual Bool_t HandleButton(const Event_t &event, const TGLCamera &camera)
Handle a mouse button event - return kTRUE if processed, kFALSE otherwise.
Definition: TGLManip.cxx:118
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
TGLPhysicalShape * GetAttached() const
Definition: TGLManip.h:67
void SetSelectedWidget(UInt_t s)
Definition: TGLManip.h:61
UInt_t fSelectedWidget
manipulated shape
Definition: TGLManip.h:40
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
Concrete physical shape - a GL drawable.
UInt_t GetSelectedWidget() const
Definition: TGLManip.h:60
#define ClassDef(name, id)
Definition: Rtypes.h:254
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:86
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:426
3 component (x/y/z) vector class.
Definition: TGLUtil.h:250
TPoint fLastMouse
first (start) mouse position (in WINDOW coords)
Definition: TGLManip.h:45
TGLManip()
Construct a manipulator object, bound to supplied viewer, and no physical shape.
Definition: TGLManip.cxx:39
const UChar_t * ColorFor(UInt_t widget) const
Returns color to be used for given widget.
Definition: TGLManip.cxx:97
Definition: TPoint.h:33
Bool_t fActive
active width (axis) component
Definition: TGLManip.h:41
void Attach(TGLPhysicalShape *shape)
Definition: TGLManip.h:66
TGLPhysicalShape * fShape
Definition: TGLManip.h:39
unsigned int UInt_t
Definition: RtypesCore.h:42
void SetActive(Bool_t a)
Definition: TGLManip.h:64
double Double_t
Definition: RtypesCore.h:55
Bool_t GetActive() const
Definition: TGLManip.h:63
TGLManip & operator=(const TGLManip &)
Assignment operator.
Definition: TGLManip.cxx:74
virtual Bool_t Select(const TGLCamera &, const TGLRect &, const TGLBoundingBox &)
Definition: TGLManip.h:71
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
void CalcDrawScale(const TGLBoundingBox &box, const TGLCamera &camera, Double_t &base, TGLVector3 axis[3]) const
Calculates base and axis scale factor (in world units) for drawing manipulators with reasonable size ...
Definition: TGLManip.cxx:156
virtual Bool_t HandleMotion(const Event_t &event, const TGLCamera &camera)
Handle a mouse button event - return kTRUE if widget selection change kFALSE otherwise.
Definition: TGLManip.cxx:145
unsigned char UChar_t
Definition: RtypesCore.h:34
TPoint fFirstMouse
manipulator is active?
Definition: TGLManip.h:44
virtual ~TGLManip()
Destroy manipulator object.
Definition: TGLManip.cxx:90