Logo ROOT  
Reference Guide
TStructViewerGUI.h
Go to the documentation of this file.
1 // @(#)root/gviz3d:$Id$
2 // Author: Tomasz Sosnicki 18/09/09
3 
4 /************************************************************************
5 * Copyright (C) 1995-2009, 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_TStructViewerGUI
13 #define ROOT_TStructViewerGUI
14 
15 #include <TGFrame.h>
16 #include <TGLEmbeddedViewer.h>
17 #include <TGToolTip.h>
18 #include <TGLabel.h>
19 #include <TGNumberEntry.h>
20 #include <TGeoVolume.h>
21 #include <TExMap.h>
22 
23 class TGeoMedium;
24 class TStructViewer;
25 class TGeoVolume;
26 class TStructNode;
27 class TCanvas;
28 class TGCheckButton;
29 class TGTextButton;
30 class TGRadioButton;
31 class TStructNodeEditor;
33 class TGLPhysicalShape;
34 class TString;
35 class TGTextEntry;
36 
37 class TStructViewerGUI : public TGMainFrame {
38 
39 private:
40  TStructViewer *fParent; // Pointer to Viewer GUI
41  TGeoVolume *fTopVolume; // Main volume containing all others volumes
42  TStructNode *fNodePtr; // Root node which represents the main pointer
43  UInt_t fMaxSlices; // Maximum number of slices used to build a collection node
44  UInt_t fMouseX; // Position of ToolTip on x-axis
45  UInt_t fMouseY; // Position of ToolTip on y-axis
46  TStructNode *fSelectedObject; // Pointer to actual selected object on scene
47  TList fUndoList; // List with nodes pointers which were top nodes
48  TList fRedoList; // List with nodes pointers which were top nodes
49  TList fVisibleObjects; // List with pointer to nodes which are visible
50  Float_t fMaxRatio; // Maximum ratio used to scale objetcs
51  TList *fColors; // Pointer to the list with color properties
52  static TGeoMedium *fgMedium; // Material and medium
53  TExMap fVolumes; // Map with pointers to Volumes associated with nodes
54  static UInt_t fgCounter; // Volume counter
55 
56  // layout
57  TCanvas *fCanvas; // Canvas used to store and paint objects
58  TGLEmbeddedViewer *fGLViewer; // GLViewer in frame
59  TGToolTip *fToolTip; // ToolTip is showed when user mouse is over the object
60  TGCheckButton *fShowLinksCheckButton; // Enable/Disable lines between nodes
61  TGLabel *fNodeNameLabel; // Label with name of node
62  TGLabel *fNodeTypelabel; // Label with classname
63  TGLabel *fMembersCountLabel; // Label with number of members in node
64  TGLabel *fAllMembersCountLabel; // Label with daugthers members
65  TGLabel *fSizeLabel; // Label with size of node
66  TGLabel *fTotalSizeLabel; // Label with size of node and daughters nodes
67  TGLabel *fLevelLabel; // Label with level where the node is placed
68  TGTextButton *fUndoButton; // Button which can restore last top node
69  TGTextButton *fRedoButton; // Button which can repeat last node change
70  TGRadioButton *fScaleBySizeButton; // Sets sorting method to size
71  TGRadioButton *fScaleByMembersButton; // Sets sorting method to members
72  TGTextEntry *fPointerTextEntry; // Sets address of pointer
73  TGTextEntry *fPointerTypeTextEntry; // Sets type of pointer
74  TStructNodeEditor *fEditor; // Frame with a node editor
75  TGNumberEntry *fBoxHeightEntry; // Height of boxes
76  TGCheckButton *fAutoRefesh; // Automatic redraw the scene
77  TGNumberEntry *fLevelDistanceEntry; // Distance between levels
78 
79 private:
80  void CalculatePosistion(TStructNode* parent);
81  void CheckMaxObjects(TStructNode* parent);
82  void Divide(TList* list, Float_t x1, Float_t x2, Float_t y1, Float_t y2);
83  void DrawNode(TStructNode* node);
84  void DrawLink(TStructNode* parent);
85  void DrawVolumes(TStructNode* visObj);
87  void Scale(TStructNode* parent);
88  void UnCheckMaxObjects();
89  void UpdateLabels( TStructNode* node );
90 
91 public:
92  TStructViewerGUI(TStructViewer* parent, TStructNode* nodePtr, TList* colors, const TGWindow *p = NULL,
93  UInt_t w = 800, UInt_t h = 600);
95 
98  void CloseWindow();
99  void ColorSelectedSlot(Pixel_t pixel);
100  void DoubleClickedSlot();
101  void Draw(Option_t* option = "");
102  TCanvas *GetCanvas();
103  Int_t GetColor(TStructNode* node);
105  Bool_t GetLinksVisibility() const;
106  TStructNode *GetNodePtr() const;
109  void MouseOverSlot(TGLPhysicalShape* shape);
110  void RedoButtonSlot();
111  void ResetButtonSlot();
112  void ScaleByChangedSlot();
113  void SetLinksVisibility(Bool_t val);
114  void SetNodePtr(TStructNode* val);
115  void SetPointerButtonSlot();
116  void ShowLinksToggled(Bool_t on);
117  void UndoButtonSlot();
118  void Update(Bool_t resetCamera = false);
119  void UpdateButtonSlot();
120 
121  ClassDef(TStructViewerGUI, 0); // A GUI fo 3D struct viewer
122 };
123 
124 #endif
TStructViewerGUI::fSelectedObject
TStructNode * fSelectedObject
Definition: TStructViewerGUI.h:46
TStructViewerGUI::fTopVolume
TGeoVolume * fTopVolume
Definition: TStructViewerGUI.h:41
TStructViewer
Definition: TStructViewer.h:26
TStructViewerGUI::DrawVolumes
void DrawVolumes(TStructNode *visObj)
Recursive method to draw GeoVolumes.
Definition: TStructViewerGUI.cxx:532
TStructViewerGUI::fLevelDistanceEntry
TGNumberEntry * fLevelDistanceEntry
Definition: TStructViewerGUI.h:77
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TStructViewerGUI::fAllMembersCountLabel
TGLabel * fAllMembersCountLabel
Definition: TStructViewerGUI.h:64
TStructViewerGUI::fEditor
TStructNodeEditor * fEditor
Definition: TStructViewerGUI.h:74
TStructViewerGUI::fUndoList
TList fUndoList
Definition: TStructViewerGUI.h:47
TGMainFrame
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:398
TStructViewerGUI::RedoButtonSlot
void RedoButtonSlot()
Activated when user click Redo button. Repeat last Undo action.
Definition: TStructViewerGUI.cxx:691
Option_t
const char Option_t
Definition: RtypesCore.h:66
TStructViewerGUI::fVolumes
TExMap fVolumes
Definition: TStructViewerGUI.h:53
TStructViewerGUI::fMaxRatio
Float_t fMaxRatio
Definition: TStructViewerGUI.h:50
TStructViewerGUI::UndoButtonSlot
void UndoButtonSlot()
UndoButton Slot. Activated when user press Undo button. Restore last top node pointer.
Definition: TStructViewerGUI.cxx:867
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TStructViewerGUI::GetNodePtr
TStructNode * GetNodePtr() const
Returns top node pointer.
Definition: TStructViewerGUI.cxx:622
TGLEmbeddedViewer
Minimal GL-viewer that can be embedded in a standard ROOT frames.
Definition: TGLEmbeddedViewer.h:24
colors
Color * colors
Definition: X3DBuffer.c:21
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
TStructViewerGUI::fLevelLabel
TGLabel * fLevelLabel
Definition: TStructViewerGUI.h:67
Float_t
float Float_t
Definition: RtypesCore.h:57
TGTextButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
TStructViewerGUI::fNodeNameLabel
TGLabel * fNodeNameLabel
Definition: TStructViewerGUI.h:61
TGeoVolume.h
TStructViewerGUI::fColors
TList * fColors
Definition: TStructViewerGUI.h:51
TStructViewerGUI::fSizeLabel
TGLabel * fSizeLabel
Definition: TStructViewerGUI.h:65
TStructViewerGUI::AutoRefreshButtonSlot
void AutoRefreshButtonSlot(Bool_t on)
Activated when user chage condition.
Definition: TStructViewerGUI.cxx:240
event
Definition: triangle.c:553
TGToolTip
Definition: TGToolTip.h:24
TStructViewerGUI::DrawNode
void DrawNode(TStructNode *node)
Creates and draws TGeoVolume from given "node".
Definition: TStructViewerGUI.cxx:478
TStructViewerGUI::UnCheckMaxObjects
void UnCheckMaxObjects()
Shows hidden nodes.
Definition: TStructViewerGUI.cxx:798
TGLEmbeddedViewer.h
TStructViewerGUI::fGLViewer
TGLEmbeddedViewer * fGLViewer
Definition: TStructViewerGUI.h:58
TStructViewerGUI::SetNodePtr
void SetNodePtr(TStructNode *val)
Sets top node pointer and updates view.
Definition: TStructViewerGUI.cxx:758
TStructViewerGUI::fgCounter
static UInt_t fgCounter
Definition: TStructViewerGUI.h:54
TStructViewerGUI::fNodePtr
TStructNode * fNodePtr
Definition: TStructViewerGUI.h:42
TString
Basic string class.
Definition: TString.h:136
TStructViewerGUI::fRedoList
TList fRedoList
Definition: TStructViewerGUI.h:48
bool
TStructViewerGUI::GetDefaultColor
TStructNodeProperty * GetDefaultColor()
Return default color for nodes.
Definition: TStructViewerGUI.cxx:602
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TStructViewerGUI::GetColor
Int_t GetColor(TStructNode *node)
Returns color form fColors for given "node".
Definition: TStructViewerGUI.cxx:589
TStructViewerGUI::fCanvas
TCanvas * fCanvas
Definition: TStructViewerGUI.h:57
TGCheckButton
Selects different options.
Definition: TGButton.h:264
ROOT::Math::gv_detail::dist
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
TStructViewerGUI::fToolTip
TGToolTip * fToolTip
Definition: TStructViewerGUI.h:59
TStructViewerGUI::fMaxSlices
UInt_t fMaxSlices
Definition: TStructViewerGUI.h:43
TStructViewerGUI::ColorSelectedSlot
void ColorSelectedSlot(Pixel_t pixel)
Slot for default color selsect.
Definition: TStructViewerGUI.cxx:343
TStructViewerGUI::DoubleClickedSlot
void DoubleClickedSlot()
Activated when user double click on objects on 3D scene.
Definition: TStructViewerGUI.cxx:413
TStructViewerGUI::SetPointerButtonSlot
void SetPointerButtonSlot()
Sets pointer given in fPointerTestEntry to the main pointer.
Definition: TStructViewerGUI.cxx:779
TStructViewerGUI
Definition: TStructViewerGUI.h:37
TGRadioButton
Selects different options.
Definition: TGButton.h:322
TStructViewerGUI::Update
void Update(Bool_t resetCamera=false)
Updates view. Clear all the nodes, call draw function and update scene. Doesn't reset camera.
Definition: TStructViewerGUI.cxx:814
h
#define h(i)
Definition: RSha256.hxx:106
TStructViewerGUI::fScaleBySizeButton
TGRadioButton * fScaleBySizeButton
Definition: TStructViewerGUI.h:70
TGTextEntry
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
TStructViewerGUI::Divide
void Divide(TList *list, Float_t x1, Float_t x2, Float_t y1, Float_t y2)
Divides rectangle where the outlining box is placed.
Definition: TStructViewerGUI.cxx:355
TStructViewerGUI::GetLinksVisibility
Bool_t GetLinksVisibility() const
Returns true if links are visible, otherwise return false.
Definition: TStructViewerGUI.cxx:610
TStructViewerGUI::fShowLinksCheckButton
TGCheckButton * fShowLinksCheckButton
Definition: TStructViewerGUI.h:60
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TStructViewerGUI::BoxHeightValueSetSlot
void BoxHeightValueSetSlot(Long_t h)
Emmited when user changes height of boxes.
Definition: TStructViewerGUI.cxx:250
TStructViewerGUI::FindNodeProperty
TStructNodeProperty * FindNodeProperty(TStructNode *node)
Returns pointer to property associated with node "node".
Definition: TStructViewerGUI.cxx:555
TStructViewerGUI::UpdateButtonSlot
void UpdateButtonSlot()
Update button slot. Updates scene.
Definition: TStructViewerGUI.cxx:834
TStructViewerGUI::UpdateLabels
void UpdateLabels(TStructNode *node)
Refresh information in labels when user put mouse over object.
Definition: TStructViewerGUI.cxx:842
TStructViewerGUI::LevelDistValueSetSlot
void LevelDistValueSetSlot(Long_t dist)
Emmited when user changes distance between levels.
Definition: TStructViewerGUI.cxx:654
TStructViewerGUI::fVisibleObjects
TList fVisibleObjects
Definition: TStructViewerGUI.h:49
TStructViewerGUI::fNodeTypelabel
TGLabel * fNodeTypelabel
Definition: TStructViewerGUI.h:62
TStructViewerGUI::fPointerTextEntry
TGTextEntry * fPointerTextEntry
Definition: TStructViewerGUI.h:72
TStructViewerGUI::fScaleByMembersButton
TGRadioButton * fScaleByMembersButton
Definition: TStructViewerGUI.h:71
TStructViewerGUI::fMembersCountLabel
TGLabel * fMembersCountLabel
Definition: TStructViewerGUI.h:63
TStructViewerGUI::CheckMaxObjects
void CheckMaxObjects(TStructNode *parent)
Check if all of nodes can be displayed on scene. Hides redendant nodes.
Definition: TStructViewerGUI.cxx:290
unsigned int
TStructNodeProperty
Definition: TStructNodeProperty.h:19
TStructViewerGUI::fPointerTypeTextEntry
TGTextEntry * fPointerTypeTextEntry
Definition: TStructViewerGUI.h:73
TStructViewerGUI::fMouseY
UInt_t fMouseY
Definition: TStructViewerGUI.h:45
TStructViewerGUI::fgMedium
static TGeoMedium * fgMedium
Definition: TStructViewerGUI.h:52
TStructViewerGUI::fMouseX
UInt_t fMouseX
Definition: TStructViewerGUI.h:44
TStructNode
Definition: TStructNode.h:34
TGLabel.h
TStructViewerGUI::ResetButtonSlot
void ResetButtonSlot()
Resets camera.
Definition: TStructViewerGUI.cxx:707
TStructViewerGUI::GetCanvas
TCanvas * GetCanvas()
Definition: TStructViewerGUI.cxx:580
TStructViewerGUI::TStructViewerGUI
TStructViewerGUI(TStructViewer *parent, TStructNode *nodePtr, TList *colors, const TGWindow *p=NULL, UInt_t w=800, UInt_t h=600)
Constructs window with "w" as width, "h" as height and given parent "p".
Definition: TStructViewerGUI.cxx:57
TStructViewerGUI::DrawLink
void DrawLink(TStructNode *parent)
Recursive method to draw links.
Definition: TStructViewerGUI.cxx:448
TStructViewerGUI::fTotalSizeLabel
TGLabel * fTotalSizeLabel
Definition: TStructViewerGUI.h:66
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TStructViewerGUI::Scale
void Scale(TStructNode *parent)
Recursive method to scaling all modes on scene.
Definition: TStructViewerGUI.cxx:717
TStructViewerGUI::fRedoButton
TGTextButton * fRedoButton
Definition: TStructViewerGUI.h:69
TStructViewerGUI::fUndoButton
TGTextButton * fUndoButton
Definition: TStructViewerGUI.h:68
TStructViewerGUI::MouseOverSlot
void MouseOverSlot(TGLPhysicalShape *shape)
MouseOver slot.
Definition: TStructViewerGUI.cxx:665
TGToolTip.h
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
Event_t
Event structure.
Definition: GuiTypes.h:174
TStructViewerGUI::ShowLinksToggled
void ShowLinksToggled(Bool_t on)
Changes links visibility and refresh view.
Definition: TStructViewerGUI.cxx:788
TGLPhysicalShape
Concrete physical shape - a GL drawable.
Definition: TGLPhysicalShape.h:32
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TExMap
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
TStructViewerGUI::Draw
void Draw(Option_t *option="")
Check limits and draws nodes and links.
Definition: TStructViewerGUI.cxx:430
TStructViewerGUI::CloseWindow
void CloseWindow()
Delete window.
Definition: TStructViewerGUI.cxx:334
TGNumberEntry.h
TStructViewerGUI::CalculatePosistion
void CalculatePosistion(TStructNode *parent)
Recursive method to calculating nodes posistion in 3D space.
Definition: TStructViewerGUI.cxx:260
TGNumberEntry
TGNumberEntry is a number entry input widget with up/down buttons.
Definition: TGNumberEntry.h:148
TGeoMedium
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
TStructViewerGUI::SetLinksVisibility
void SetLinksVisibility(Bool_t val)
Sets links visibility to "visible".
Definition: TStructViewerGUI.cxx:767
TStructViewerGUI::ScaleByChangedSlot
void ScaleByChangedSlot()
Activated when user press radio button.
Definition: TStructViewerGUI.cxx:883
TStructViewerGUI::~TStructViewerGUI
~TStructViewerGUI()
Destructor.
Definition: TStructViewerGUI.cxx:232
TStructViewerGUI::fAutoRefesh
TGCheckButton * fAutoRefesh
Definition: TStructViewerGUI.h:76
TStructViewerGUI::fParent
TStructViewer * fParent
Definition: TStructViewerGUI.h:40
TGeoVolume
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:49
TStructViewerGUI::GLWidgetProcessedEventSlot
void GLWidgetProcessedEventSlot(Event_t *event)
Handle events. Sets fMouseX and fMouseY when user move a mouse over viewer and hides ToolTip.
Definition: TStructViewerGUI.cxx:630
TList
A doubly linked list.
Definition: TList.h:44
TExMap.h
int
TStructNodeEditor
Definition: TStructNodeEditor.h:26
TStructViewerGUI::fBoxHeightEntry
TGNumberEntry * fBoxHeightEntry
Definition: TStructViewerGUI.h:75