| [807] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | // File: CCalVisualisable.hh
|
|---|
| 28 | // Description: Sets visualisable attributes from the information in flat file
|
|---|
| 29 | ///////////////////////////////////////////////////////////////////////////////
|
|---|
| 30 | #ifndef CCalVisualisable_hh
|
|---|
| 31 | #define CCalVisualisable_hh 1
|
|---|
| 32 |
|
|---|
| 33 | #include "globals.hh"
|
|---|
| 34 |
|
|---|
| 35 | #if __SUNPRO_CC==0x420
|
|---|
| 36 | typedef G4bool bool;
|
|---|
| 37 | #endif
|
|---|
| 38 |
|
|---|
| 39 | class CCalVisualisable {
|
|---|
| 40 | public:
|
|---|
| 41 |
|
|---|
| 42 | //Here we define the different type of volumes we consider.
|
|---|
| 43 | enum visType {Sensitive=0,
|
|---|
| 44 | Electronics=1,
|
|---|
| 45 | Support=2,
|
|---|
| 46 | Cable=3,
|
|---|
| 47 | Absorber=4,
|
|---|
| 48 | OtherServices=5,
|
|---|
| 49 | PseudoVolumes=6,
|
|---|
| 50 | TotalVisTypes=7,
|
|---|
| 51 | Undefined=-1};
|
|---|
| 52 |
|
|---|
| 53 | private:
|
|---|
| 54 |
|
|---|
| 55 | //This class groups the important visualization parameters.
|
|---|
| 56 | class visParameters {
|
|---|
| 57 | public:
|
|---|
| 58 | visParameters(bool v=false, double r=1,double g=1,double b=1, bool w=true):
|
|---|
| 59 | visibility(v),rColor(r),gColor(g),bColor(b),wireframe(w) {}
|
|---|
| 60 | bool visibility;
|
|---|
| 61 | double rColor;
|
|---|
| 62 | double gColor;
|
|---|
| 63 | double bColor;
|
|---|
| 64 | bool wireframe;
|
|---|
| 65 | };
|
|---|
| 66 |
|
|---|
| 67 | public:
|
|---|
| 68 | //Constructs this object from this file
|
|---|
| 69 | CCalVisualisable(G4String file);
|
|---|
| 70 |
|
|---|
| 71 | virtual ~CCalVisualisable() {}
|
|---|
| 72 |
|
|---|
| 73 | //Reads this object from file
|
|---|
| 74 | bool readFile(G4String file);
|
|---|
| 75 |
|
|---|
| 76 | //Sets visibility to true for Sensitive and to false otherwise.
|
|---|
| 77 | void setDefault();
|
|---|
| 78 |
|
|---|
| 79 | //Get & Set methods.
|
|---|
| 80 | bool isVisible (visType v) const {return theParameters[v].visibility;}
|
|---|
| 81 | void setVisible(visType v, bool flag=true){theParameters[v].visibility=flag;}
|
|---|
| 82 |
|
|---|
| 83 | double colorRed (visType v) const {return theParameters[v].rColor;}
|
|---|
| 84 | double colorGreen(visType v) const {return theParameters[v].gColor;}
|
|---|
| 85 | double colorBlue (visType v) const {return theParameters[v].bColor;}
|
|---|
| 86 | void setColorRed (visType v, double r) {theParameters[v].rColor=r;}
|
|---|
| 87 | void setColorGreen(visType v, double g) {theParameters[v].gColor=g;}
|
|---|
| 88 | void setColorBlue (visType v, double b) {theParameters[v].bColor=b;}
|
|---|
| 89 | void setColor(visType v, double r, double g, double b);
|
|---|
| 90 |
|
|---|
| 91 | bool isWireFrame (visType v) const {return theParameters[v].wireframe;}
|
|---|
| 92 | void setWireFrame(visType v, bool wf=true){theParameters[v].wireframe=wf;}
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | protected:
|
|---|
| 97 | //Read this object from visFile
|
|---|
| 98 | static void setPath();
|
|---|
| 99 | bool readFile();
|
|---|
| 100 |
|
|---|
| 101 | private:
|
|---|
| 102 | static const char* pathName; //Path in which to look for files
|
|---|
| 103 | G4String visFile; //File with visualization info
|
|---|
| 104 | visParameters theParameters[TotalVisTypes]; //Visualisation parameters
|
|---|
| 105 |
|
|---|
| 106 | double checkColorRange(double color, char type) const;
|
|---|
| 107 | };
|
|---|
| 108 |
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|