Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
21class TGLVertex3;
22class TGLVector3;
23class TGLCamera;
24class TGLRect;
25class TGLBoundingBox;
26
27
29{
30protected:
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&);
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
47public:
48 TGLManip();
50 ~TGLManip() override;
51
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 Bool_t Select(const TGLCamera&, const TGLRect&, const TGLBoundingBox&) override { 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 ClassDefOverride(TGLManip, 0); // abstract base GL manipulator widget
69};
70
71#endif
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Definition RtypesCore.h:63
unsigned char UChar_t
Definition RtypesCore.h:38
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition TGLCamera.h:44
Abstract base class for viewer manipulators, which allow direct in viewer manipulation of a (TGlPhysi...
Definition TGLManip.h:29
void SetSelectedWidget(UInt_t s)
Definition TGLManip.h:53
UInt_t GetSelectedWidget() const
Definition TGLManip.h:52
TGLManip()
Construct a manipulator object, bound to supplied viewer, and no physical shape.
Definition TGLManip.cxx:36
TGLManip & operator=(const TGLManip &)
Assignment operator.
Definition TGLManip.cxx:71
TPoint fLastMouse
first (start) mouse position (in WINDOW coords)
Definition TGLManip.h:37
const UChar_t * ColorFor(UInt_t widget) const
Returns color to be used for given widget.
Definition TGLManip.cxx:94
TPoint fFirstMouse
manipulator is active?
Definition TGLManip.h:36
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:115
Bool_t fActive
active width (axis) component
Definition TGLManip.h:33
Bool_t GetActive() const
Definition TGLManip.h:55
Bool_t Select(const TGLCamera &, const TGLRect &, const TGLBoundingBox &) override
Definition TGLManip.h:63
void Attach(TGLPhysicalShape *shape)
Definition TGLManip.h:58
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:153
UInt_t fSelectedWidget
manipulated shape
Definition TGLManip.h:32
void SetActive(Bool_t a)
Definition TGLManip.h:56
TGLPhysicalShape * fShape
Definition TGLManip.h:31
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:142
virtual void Draw(const TGLCamera &camera) const =0
TGLPhysicalShape * GetAttached() const
Definition TGLManip.h:59
~TGLManip() override
Destroy manipulator object.
Definition TGLManip.cxx:87
Concrete physical shape - a GL drawable.
Viewport (pixel base) 2D rectangle class.
Definition TGLUtil.h:422
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Event structure.
Definition GuiTypes.h:174