Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TStructViewerGUI.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gviz3d:$Id$
0002 // Author: Tomasz Sosnicki   18/09/09
0003 
0004 /************************************************************************
0005 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
0006 * All rights reserved.                                                  *
0007 *                                                                       *
0008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010 *************************************************************************/
0011 
0012 #ifndef ROOT_TStructViewerGUI
0013 #define ROOT_TStructViewerGUI
0014 
0015 #include <TGFrame.h>
0016 #include <TGLEmbeddedViewer.h>
0017 #include <TGToolTip.h>
0018 #include <TGLabel.h>
0019 #include <TGNumberEntry.h>
0020 #include <TGeoVolume.h>
0021 #include <TExMap.h>
0022 
0023 class TGeoMedium;
0024 class TStructViewer;
0025 class TGeoVolume;
0026 class TStructNode;
0027 class TCanvas;
0028 class TGCheckButton;
0029 class TGTextButton;
0030 class TGRadioButton;
0031 class TStructNodeEditor;
0032 class TStructNodeProperty;
0033 class TGLPhysicalShape;
0034 class TString;
0035 class TGTextEntry;
0036 
0037 class TStructViewerGUI : public TGMainFrame {
0038 
0039 private:
0040    TStructViewer       *fParent;                // Pointer to Viewer GUI
0041    TGeoVolume          *fTopVolume;             // Main volume containing all others volumes
0042    TStructNode         *fNodePtr;               // Root node which represents the main pointer
0043    UInt_t               fMaxSlices;             // Maximum number of slices used to build a collection node
0044    UInt_t               fMouseX;                // Position of ToolTip on x-axis
0045    UInt_t               fMouseY;                // Position of ToolTip on y-axis
0046    TStructNode         *fSelectedObject;        // Pointer to actual selected object on scene
0047    TList                fUndoList;              // List with nodes pointers which were top nodes
0048    TList                fRedoList;              // List with nodes pointers which were top nodes
0049    TList                fVisibleObjects;        // List with pointer to nodes which are visible
0050    Float_t              fMaxRatio;              // Maximum ratio used to scale objetcs
0051    TList               *fColors;                // Pointer to the list with color properties
0052    static TGeoMedium   *fgMedium;               // Material and medium
0053    TExMap               fVolumes;               // Map with pointers to Volumes associated with nodes
0054    static UInt_t        fgCounter;              // Volume counter
0055 
0056    // layout
0057    TCanvas             *fCanvas;                // Canvas used to store and paint objects
0058    TGLEmbeddedViewer   *fGLViewer;              // GLViewer in frame
0059    TGToolTip           *fToolTip;               // ToolTip is showed when user mouse is over the object
0060    TGCheckButton       *fShowLinksCheckButton;  // Enable/Disable lines between nodes
0061    TGLabel             *fNodeNameLabel;         // Label with name of node
0062    TGLabel             *fNodeTypelabel;         // Label with classname
0063    TGLabel             *fMembersCountLabel;     // Label with number of members in node
0064    TGLabel             *fAllMembersCountLabel;  // Label with daugthers members
0065    TGLabel             *fSizeLabel;             // Label with size of node
0066    TGLabel             *fTotalSizeLabel;        // Label with size of node and daughters nodes
0067    TGLabel             *fLevelLabel;            // Label with level where the node is placed
0068    TGTextButton        *fUndoButton;            // Button which can restore last top node
0069    TGTextButton        *fRedoButton;            // Button which can repeat last node change
0070    TGRadioButton       *fScaleBySizeButton;     // Sets sorting method to size
0071    TGRadioButton       *fScaleByMembersButton;  // Sets sorting method to members
0072    TGTextEntry         *fPointerTextEntry;      // Sets address of pointer
0073    TGTextEntry         *fPointerTypeTextEntry;  // Sets type of pointer
0074    TStructNodeEditor   *fEditor;                // Frame with a node editor
0075    TGNumberEntry       *fBoxHeightEntry;        // Height of boxes
0076    TGCheckButton       *fAutoRefesh;            // Automatic redraw the scene
0077    TGNumberEntry       *fLevelDistanceEntry;    // Distance between levels
0078 
0079 private:
0080    void           CalculatePosistion(TStructNode* parent);
0081    void           CheckMaxObjects(TStructNode* parent);
0082    void           Divide(TList* list, Float_t x1, Float_t x2, Float_t y1, Float_t y2);
0083    void           DrawNode(TStructNode* node);
0084    void           DrawLink(TStructNode* parent);
0085    void           DrawVolumes(TStructNode* visObj);
0086    TStructNodeProperty* FindNodeProperty(TStructNode* node);
0087    void           Scale(TStructNode* parent);
0088    void           UnCheckMaxObjects();
0089    void           UpdateLabels( TStructNode* node );
0090 
0091 public:
0092    TStructViewerGUI(TStructViewer* parent, TStructNode* nodePtr, TList* colors, const TGWindow *p = nullptr,
0093       UInt_t w = 800, UInt_t h = 600);
0094    ~TStructViewerGUI() override;
0095 
0096    void           AutoRefreshButtonSlot(Bool_t on);
0097    void           BoxHeightValueSetSlot(Long_t h);
0098    void           CloseWindow() override;
0099    void           ColorSelectedSlot(Pixel_t pixel);
0100    void           DoubleClickedSlot();
0101    void           Draw(Option_t* option = "") override;
0102    TCanvas       *GetCanvas();
0103    Int_t          GetColor(TStructNode* node);
0104    TStructNodeProperty* GetDefaultColor();
0105    Bool_t         GetLinksVisibility() const;
0106    TStructNode   *GetNodePtr() const;
0107    void           GLWidgetProcessedEventSlot(Event_t* event);
0108    void           LevelDistValueSetSlot(Long_t dist);
0109    void           MouseOverSlot(TGLPhysicalShape* shape);
0110    void           RedoButtonSlot();
0111    void           ResetButtonSlot();
0112    void           ScaleByChangedSlot();
0113    void           SetLinksVisibility(Bool_t val);
0114    void           SetNodePtr(TStructNode* val);
0115    void           SetPointerButtonSlot();
0116    void           ShowLinksToggled(Bool_t on);
0117    void           UndoButtonSlot();
0118    void           Update(Bool_t resetCamera = false);
0119    void           UpdateButtonSlot();
0120 
0121    ClassDefOverride(TStructViewerGUI, 0); // A GUI fo 3D struct viewer
0122 };
0123 
0124 #endif