Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:41

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, 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_TEveGeoNode
0013 #define ROOT_TEveGeoNode
0014 
0015 #include "TEveElement.h"
0016 #include <list>
0017 
0018 class TGeoVolume;
0019 class TGeoNode;
0020 class TGeoHMatrix;
0021 class TGeoManager;
0022 class TGeoShape;
0023 
0024 class TEveGeoShapeExtract;
0025 
0026 //----------------------------------------------------------------
0027 
0028 class TEveGeoNode : public TEveElement,
0029                     public TObject
0030 {
0031    friend class TEveGeoNodeEditor;
0032 
0033    TEveGeoNode(const TEveGeoNode&);            // Not implemented
0034    TEveGeoNode& operator=(const TEveGeoNode&); // Not implemented
0035 
0036 protected:
0037    TGeoNode *fNode;
0038    TEveGeoShapeExtract* DumpShapeTree(TEveGeoNode* geon, TEveGeoShapeExtract* parent=nullptr, Bool_t leafs_only=kFALSE);
0039 
0040    static Int_t                  fgCSGExportNSeg;  //!
0041    static std::list<TGeoShape*>  fgTemporaryStore; //!
0042 
0043 public:
0044    TEveGeoNode(TGeoNode* node);
0045 
0046    TObject* GetObject(const TEveException&) const override
0047    { const TObject* obj = this; return const_cast<TObject*>(obj); }
0048 
0049    const char* GetName()  const override;
0050    const char* GetTitle() const override;
0051    const char* GetElementName()  const override;
0052    const char* GetElementTitle() const override;
0053 
0054    TGeoNode* GetNode() const { return fNode; }
0055 
0056    void   ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent) override;
0057 
0058    virtual void   ExpandIntoListTrees();
0059    virtual void   ExpandIntoListTreesRecursively();
0060 
0061    Bool_t CanEditElement() const override { return kFALSE; }
0062 
0063    void   AddStamp(UChar_t bits) override;
0064 
0065    Bool_t CanEditMainColor() const override;
0066    void   SetMainColor(Color_t color) override;
0067 
0068    Bool_t  CanEditMainTransparency() const override;
0069    Char_t  GetMainTransparency() const override;
0070    void    SetMainTransparency(Char_t t) override;
0071 
0072    void UpdateNode(TGeoNode* node);
0073    void UpdateVolume(TGeoVolume* volume);
0074 
0075    void Save(const char* file, const char* name="Extract", Bool_t leafs_only=kFALSE);
0076    void SaveExtract(const char* file, const char* name, Bool_t leafs_only);
0077    void WriteExtract(const char* name, Bool_t leafs_only);
0078 
0079    void Draw(Option_t* option="") override;
0080 
0081    static Int_t GetCSGExportNSeg();
0082    static void  SetCSGExportNSeg(Int_t nseg);
0083 
0084    ClassDefOverride(TEveGeoNode, 0); // Wrapper for TGeoNode that allows it to be shown in GUI and controlled as a TEveElement.
0085 };
0086 
0087 //----------------------------------------------------------------
0088 
0089 class TEveGeoTopNode : public TEveGeoNode
0090 {
0091    TEveGeoTopNode(const TEveGeoTopNode&);            // Not implemented
0092    TEveGeoTopNode& operator=(const TEveGeoTopNode&); // Not implemented
0093 
0094 protected:
0095    TGeoManager* fManager;
0096    Int_t        fVisOption;
0097    Int_t        fVisLevel;
0098    Int_t        fMaxVisNodes;
0099 
0100 public:
0101    TEveGeoTopNode(TGeoManager* manager, TGeoNode* node, Int_t visopt=1,
0102                   Int_t vislvl=3, Int_t maxvisnds=10000);
0103    ~TEveGeoTopNode() override {}
0104 
0105    void         UseNodeTrans();
0106 
0107    TGeoManager* GetGeoManager() const { return fManager; }
0108 
0109    Int_t GetVisOption()      const { return fVisOption; }
0110    void  SetVisOption(Int_t vo)    { fVisOption = vo;   }
0111    Int_t GetVisLevel()       const { return fVisLevel;  }
0112    void  SetVisLevel(Int_t vl)     { fVisLevel = vl;    }
0113    Int_t GetMaxVisNodes()    const { return fMaxVisNodes; }
0114    void  SetMaxVisNodes(Int_t mvn) { fMaxVisNodes = mvn;  }
0115 
0116    Bool_t CanEditElement() const override { return kTRUE; }
0117    Bool_t SingleRnrState() const override { return kTRUE; }
0118 
0119    void   AddStamp(UChar_t bits) override;
0120 
0121    void Draw(Option_t* option="") override;
0122    void Paint(Option_t* option="") override;
0123 
0124    // Signals from GeoManager.
0125    // These are not available any more ... colors in list-tree not refreshed
0126    // properly.
0127    void VolumeVisChanged(TGeoVolume* volume);
0128    void VolumeColChanged(TGeoVolume* volume);
0129    void NodeVisChanged(TGeoNode* node);
0130 
0131    ClassDefOverride(TEveGeoTopNode, 0); // Top-level TEveGeoNode with a pointer to TGeoManager and controls for steering of TGeoPainter.
0132 };
0133 
0134 #endif