TStructViewerGUI.h

Go to the documentation of this file.
00001 // @(#)root/gviz3d:$Id: TStructViewerGUI.h 30023 2009-09-02 17:57:16Z brun $
00002 // Author: Tomasz Sosnicki   18/09/09
00003 
00004 /************************************************************************
00005 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006 * All rights reserved.                                                  *
00007 *                                                                       *
00008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010 *************************************************************************/
00011 
00012 #ifndef ROOT_TStructViewerGUI
00013 #define ROOT_TStructViewerGUI
00014 
00015 #include <TGFrame.h>
00016 #include <TGLEmbeddedViewer.h>
00017 #include <TGToolTip.h>
00018 #include <TGLabel.h>
00019 #include <TGNumberEntry.h>
00020 #include <TGeoVolume.h>
00021 #include <TExMap.h>
00022 
00023 class TGeoMedium;
00024 class TStructViewer;
00025 class TGeoVolume;
00026 class TStructNode;
00027 class TCanvas;
00028 class TGCheckButton;
00029 class TGTextButton;
00030 class TGRadioButton;
00031 class TStructNodeEditor;
00032 class TStructNodeProperty;
00033 class TGLPhysicalShape;
00034 class TString;
00035 class TGTextEntry;
00036 
00037 class TStructViewerGUI : public TGMainFrame {
00038 
00039 private:
00040    TStructViewer       *fParent;                // Pointer to Viewer GUI
00041    TGeoVolume          *fTopVolume;             // Main volume containing all others volumes
00042    TStructNode         *fNodePtr;               // Root node which represents the main pointer
00043    UInt_t               fMaxSlices;             // Maximum number of slices used to build a collection node
00044    UInt_t               fMouseX;                // Position of ToolTip on x-axis
00045    UInt_t               fMouseY;                // Position of ToolTip on y-axis
00046    TStructNode         *fSelectedObject;        // Pointer to actual selected object on scene
00047    TList                fUndoList;              // List with nodes pointers which were top nodes
00048    TList                fRedoList;              // List with nodes pointers which were top nodes
00049    TList                fVisibleObjects;        // List with pointer to nodes which are visible
00050    Float_t              fMaxRatio;              // Maximum ratio used to scale objetcs
00051    TList               *fColors;                // Pointer to the list with color properties
00052    static TGeoMedium   *fgMedium;               // Material and medium
00053    TExMap               fVolumes;               // Map with pointers to Volumes associated with nodes
00054    static UInt_t        fgCounter;              // Volume counter
00055 
00056    // layout
00057    TCanvas             *fCanvas;                // Canvas used to store and paint objects
00058    TGLEmbeddedViewer   *fGLViewer;              // GLViewer in frame
00059    TGToolTip           *fToolTip;               // ToolTip is showed when user mouse is over the object
00060    TGCheckButton       *fShowLinksCheckButton;  // Enable/Disable lines between nodes
00061    TGLabel             *fNodeNameLabel;         // Label with name of node
00062    TGLabel             *fNodeTypelabel;         // Label with classname
00063    TGLabel             *fMembersCountLabel;     // Label with number of members in node
00064    TGLabel             *fAllMembersCountLabel;  // Label with daugthers members
00065    TGLabel             *fSizeLabel;             // Label with size of node
00066    TGLabel             *fTotalSizeLabel;        // Label with size of node and daughters nodes
00067    TGLabel             *fLevelLabel;            // Label with level where the node is placed
00068    TGTextButton        *fUndoButton;            // Button which can restore last top node
00069    TGTextButton        *fRedoButton;            // Button which can repeat last node change
00070    TGRadioButton       *fScaleBySizeButton;     // Sets sorting method to size
00071    TGRadioButton       *fScaleByMembersButton;  // Sets sorting method to members
00072    TGTextEntry         *fPointerTextEntry;      // Sets address of pointer
00073    TGTextEntry         *fPointerTypeTextEntry;  // Sets type of pointer
00074    TStructNodeEditor   *fEditor;                // Frame with a node editor
00075    TGNumberEntry       *fBoxHeightEntry;        // Height of boxes
00076    TGCheckButton       *fAutoRefesh;            // Automatic redraw the scene
00077    TGNumberEntry       *fLevelDistanceEntry;    // Distance between levels
00078    
00079 private:
00080    void           CalculatePosistion(TStructNode* parent);
00081    void           CheckMaxObjects(TStructNode* parent);
00082    void           Divide(TList* list, Float_t x1, Float_t x2, Float_t y1, Float_t y2);
00083    void           DrawNode(TStructNode* node);
00084    void           DrawLink(TStructNode* parent);
00085    void           DrawVolumes(TStructNode* visObj);
00086    TStructNodeProperty* FindNodeProperty(TStructNode* node);
00087    void           Scale(TStructNode* parent);
00088    void           UnCheckMaxObjects();
00089    void           UpdateLabels( TStructNode* node );
00090 
00091 public:
00092    TStructViewerGUI(TStructViewer* parent, TStructNode* nodePtr, TList* colors, const TGWindow *p = NULL, 
00093       UInt_t w = 800, UInt_t h = 600);
00094    ~TStructViewerGUI();
00095    
00096    void           AutoRefreshButtonSlot(Bool_t on);
00097    void           BoxHeightValueSetSlot(Long_t h);
00098    void           CloseWindow();
00099    void           ColorSelectedSlot(Pixel_t pixel);
00100    void           DoubleClickedSlot();
00101    void           Draw(Option_t* option = "");
00102    TCanvas       *GetCanvas();
00103    Int_t          GetColor(TStructNode* node);
00104    TStructNodeProperty* GetDefaultColor();
00105    Bool_t         GetLinksVisibility() const;
00106    TStructNode   *GetNodePtr() const;
00107    void           GLWidgetProcessedEventSlot(Event_t* event);
00108    void           LevelDistValueSetSlot(Long_t dist);
00109    void           MouseOverSlot(TGLPhysicalShape* shape);
00110    void           RedoButtonSlot();
00111    void           ResetButtonSlot();
00112    void           ScaleByChangedSlot();
00113    void           SetLinksVisibility(Bool_t val);
00114    void           SetNodePtr(TStructNode* val);
00115    void           SetPointerButtonSlot();
00116    void           ShowLinksToggled(Bool_t on);
00117    void           UndoButtonSlot();
00118    void           Update(Bool_t resetCamera = false);
00119    void           UpdateButtonSlot();
00120    
00121    ClassDef(TStructViewerGUI, 1); // A GUI fo 3D struct viewer 
00122 };
00123 
00124 #endif

Generated on Tue Jul 5 14:18:44 2011 for ROOT_528-00b_version by  doxygen 1.5.1