Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23class TGeoMedium;
24class TStructViewer;
25class TGeoVolume;
26class TStructNode;
27class TCanvas;
28class TGCheckButton;
29class TGTextButton;
30class TGRadioButton;
34class TString;
35class TGTextEntry;
36
38
39private:
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
79private:
80 void CalculatePosistion(TStructNode* parent);
81 void CheckMaxObjects(TStructNode* parent);
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
91public:
92 TStructViewerGUI(TStructViewer* parent, TStructNode* nodePtr, TList* colors, const TGWindow *p = nullptr,
93 UInt_t w = 800, UInt_t h = 600);
94 ~TStructViewerGUI() override;
95
98 void CloseWindow() override;
100 void DoubleClickedSlot();
101 void Draw(Option_t* option = "") override;
106 TStructNode *GetNodePtr() const;
108 void LevelDistValueSetSlot(Long_t dist);
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);
117 void UndoButtonSlot();
118 void Update(Bool_t resetCamera = false);
119 void UpdateButtonSlot();
120
121 ClassDefOverride(TStructViewerGUI, 0); // A GUI fo 3D struct viewer
122};
123
124#endif
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define h(i)
Definition RSha256.hxx:106
long Long_t
Definition RtypesCore.h:54
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
Color * colors
Definition X3DBuffer.c:21
The Canvas class.
Definition TCanvas.h:23
This class stores a (key,value) pair using an external hash.
Definition TExMap.h:33
Selects different options.
Definition TGButton.h:264
Minimal GL-viewer that can be embedded in a standard ROOT frames.
Concrete physical shape - a GL drawable.
This class handles GUI labels.
Definition TGLabel.h:24
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
TGNumberEntry is a number entry input widget with up/down buttons.
Selects different options.
Definition TGButton.h:321
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
ROOT GUI Window base class.
Definition TGWindow.h:23
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition TGeoMedium.h:23
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
A doubly linked list.
Definition TList.h:38
Basic string class.
Definition TString.h:139
TGLabel * fTotalSizeLabel
void SetNodePtr(TStructNode *val)
Sets top node pointer and updates view.
TGLabel * fAllMembersCountLabel
void ResetButtonSlot()
Resets camera.
TGTextEntry * fPointerTextEntry
~TStructViewerGUI() override
Destructor.
void DrawNode(TStructNode *node)
Creates and draws TGeoVolume from given "node".
void Scale(TStructNode *parent)
Recursive method to scaling all modes on scene.
void RedoButtonSlot()
Activated when user click Redo button. Repeat last Undo action.
TStructNodeProperty * FindNodeProperty(TStructNode *node)
Returns pointer to property associated with node "node".
void ColorSelectedSlot(Pixel_t pixel)
Slot for default color selsect.
TGTextButton * fRedoButton
void BoxHeightValueSetSlot(Long_t h)
Emmited when user changes height of boxes.
TGNumberEntry * fBoxHeightEntry
TGeoVolume * fTopVolume
TStructNode * fSelectedObject
TGRadioButton * fScaleByMembersButton
TStructNode * GetNodePtr() const
Returns top node pointer.
void CheckMaxObjects(TStructNode *parent)
Check if all of nodes can be displayed on scene. Hides redendant nodes.
TGLabel * fMembersCountLabel
void UpdateLabels(TStructNode *node)
Refresh information in labels when user put mouse over object.
void UpdateButtonSlot()
Update button slot. Updates scene.
void MouseOverSlot(TGLPhysicalShape *shape)
MouseOver slot.
Bool_t GetLinksVisibility() const
Returns true if links are visible, otherwise return false.
void DrawLink(TStructNode *parent)
Recursive method to draw links.
void SetLinksVisibility(Bool_t val)
Sets links visibility to "visible".
TGNumberEntry * fLevelDistanceEntry
static UInt_t fgCounter
void AutoRefreshButtonSlot(Bool_t on)
Activated when user chage condition.
TGCheckButton * fAutoRefesh
void DoubleClickedSlot()
Activated when user double click on objects on 3D scene.
void UnCheckMaxObjects()
Shows hidden nodes.
TGTextButton * fUndoButton
TStructNodeProperty * GetDefaultColor()
Return default color for nodes.
void DrawVolumes(TStructNode *visObj)
Recursive method to draw GeoVolumes.
void LevelDistValueSetSlot(Long_t dist)
Emmited when user changes distance between levels.
TGRadioButton * fScaleBySizeButton
Int_t GetColor(TStructNode *node)
Returns color form fColors for given "node".
TGLEmbeddedViewer * fGLViewer
TStructNodeEditor * fEditor
static TGeoMedium * fgMedium
void ScaleByChangedSlot()
Activated when user press radio button.
ClassDefOverride(TStructViewerGUI, 0)
TGTextEntry * fPointerTypeTextEntry
void CloseWindow() override
Delete window.
void UndoButtonSlot()
UndoButton Slot. Activated when user press Undo button. Restore last top node pointer.
void GLWidgetProcessedEventSlot(Event_t *event)
Handle events. Sets fMouseX and fMouseY when user move a mouse over viewer and hides ToolTip.
void ShowLinksToggled(Bool_t on)
Changes links visibility and refresh view.
void SetPointerButtonSlot()
Sets pointer given in fPointerTestEntry to the main pointer.
void Divide(TList *list, Float_t x1, Float_t x2, Float_t y1, Float_t y2)
Divides rectangle where the outlining box is placed.
TStructViewer * fParent
TGCheckButton * fShowLinksCheckButton
void CalculatePosistion(TStructNode *parent)
Recursive method to calculating nodes posistion in 3D space.
void Update(Bool_t resetCamera=false)
Updates view. Clear all the nodes, call draw function and update scene. Doesn't reset camera.
TStructNode * fNodePtr
Event structure.
Definition GuiTypes.h:174
th1 Draw()