Logo ROOT   6.14/05
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 #include "TVirtualGL.h"
16 #include "TPoint.h"
17 #include "GuiTypes.h"
18 #include "TGLUtil.h"
19 
20 class TGLPhysicalShape;
21 class TGLVertex3;
22 class TGLVector3;
23 class TGLCamera;
24 class TGLRect;
25 class TGLBoundingBox;
26 
27 
28 class TGLManip : public TVirtualGLManip
29 {
30 protected:
31  TGLPhysicalShape *fShape; //! manipulated shape
32  UInt_t fSelectedWidget; //! active width (axis) component
33  Bool_t fActive; //! manipulator is active?
34 
35  // Mouse tracking - in WINDOW coords
36  TPoint fFirstMouse; //! first (start) mouse position (in WINDOW coords)
37  TPoint fLastMouse; //! last (latest) mouse position (in WINDOW coords)
38 
39  TGLManip(const TGLManip&);
40  TGLManip& operator=(const TGLManip&);
41 
42  void CalcDrawScale(const TGLBoundingBox& box, const TGLCamera& camera,
43  Double_t& base, TGLVector3 axis[3]) const;
44 
45  const UChar_t* ColorFor(UInt_t widget) const;
46 
47 public:
48  TGLManip();
49  TGLManip(TGLPhysicalShape* shape);
50  virtual ~TGLManip();
51 
53  void SetSelectedWidget(UInt_t s) { fSelectedWidget = s; }
54 
55  Bool_t GetActive() const { return fActive; }
56  void SetActive(Bool_t a) { fActive = a; }
57 
58  void Attach(TGLPhysicalShape* shape) { fShape = shape; }
59  TGLPhysicalShape * GetAttached() const { return fShape; }
60 
61  virtual void Draw(const TGLCamera& camera) const = 0;
62  // CRAPPY TVirtualGLManip TTTT, just override it here
63  virtual Bool_t Select(const TGLCamera&, const TGLRect&, const TGLBoundingBox&) { return kFALSE; }
64 
65  virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera);
66  virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera);
67 
68  ClassDef(TGLManip, 0); // abstract base GL manipulator widget
69 };
70 
71 #endif
Abstract base class for viewer manipulators, which allow direct in viewer manipulation of a (TGlPhysi...
Definition: TGLManip.h:28
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
TGLPhysicalShape * GetAttached() const
Definition: TGLManip.h:59
void SetSelectedWidget(UInt_t s)
Definition: TGLManip.h:53
UInt_t fSelectedWidget
manipulated shape
Definition: TGLManip.h:32
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:52
#define ClassDef(name, id)
Definition: Rtypes.h:320
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
TPoint fLastMouse
first (start) mouse position (in WINDOW coords)
Definition: TGLManip.h:37
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:31
Bool_t fActive
active width (axis) component
Definition: TGLManip.h:33
void Attach(TGLPhysicalShape *shape)
Definition: TGLManip.h:58
auto * a
Definition: textangle.C:12
TGLPhysicalShape * fShape
Definition: TGLManip.h:31
unsigned int UInt_t
Definition: RtypesCore.h:42
void SetActive(Bool_t a)
Definition: TGLManip.h:56
const Bool_t kFALSE
Definition: RtypesCore.h:88
double Double_t
Definition: RtypesCore.h:55
Bool_t GetActive() const
Definition: TGLManip.h:55
static constexpr double s
TGLManip & operator=(const TGLManip &)
Assignment operator.
Definition: TGLManip.cxx:74
virtual Bool_t Select(const TGLCamera &, const TGLRect &, const TGLBoundingBox &)
Definition: TGLManip.h:63
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:36
virtual ~TGLManip()
Destroy manipulator object.
Definition: TGLManip.cxx:90