Logo ROOT   6.18/05
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
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);
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
91public:
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 = "");
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);
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
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define h(i)
Definition: RSha256.hxx:106
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
Color * colors
Definition: X3DBuffer.c:21
The Canvas class.
Definition: TCanvas.h:31
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
Minimal GL-viewer that can be embedded in a standard ROOT frames.
Concrete physical shape - a GL drawable.
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:53
A doubly linked list.
Definition: TList.h:44
Basic string class.
Definition: TString.h:131
TGLabel * fTotalSizeLabel
void SetNodePtr(TStructNode *val)
Sets top node pointer and updates view.
TGLabel * fAllMembersCountLabel
void ResetButtonSlot()
Resets camera.
TGToolTip * fToolTip
~TStructViewerGUI()
Destructor.
TGTextEntry * fPointerTextEntry
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
TGLabel * fNodeTypelabel
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.
TGLabel * fNodeNameLabel
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 Draw(Option_t *option="")
Check limits and draws nodes and links.
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.
TGTextEntry * fPointerTypeTextEntry
void UndoButtonSlot()
UndoButton Slot. Activated when user press Undo button. Restore last top node pointer.
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".
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 CloseWindow()
Delete window.
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
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48