source: trunk/source/visualization/HepRep/src/G4HepRepMessenger.cc @ 1098

Last change on this file since 1098 was 944, checked in by garnier, 15 years ago

mise a jour des tags

File size: 5.7 KB
Line 
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// $Id: G4HepRepMessenger.cc,v 1.10 2006/06/29 21:17:30 gunter Exp $
27// GEANT4 tag $Name:  $
28//
29#include "G4HepRepMessenger.hh"
30
31G4HepRepMessenger::G4HepRepMessenger() :
32    suffix (""),
33    geometry(true),
34    solids(true),
35    invisibles(true) {
36
37    heprepDirectory = new G4UIdirectory("/vis/heprep/");
38    heprepDirectory->SetGuidance("HepRep commands.");
39
40    setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
41    setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
42    setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
43    setEventNumberSuffixCommand->SetParameterName("suffix",false);
44    setEventNumberSuffixCommand->SetDefaultValue("");
45    setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
46   
47    appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
48    appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
49    appendGeometryCommand->SetParameterName("flag",false);
50    appendGeometryCommand->SetDefaultValue(true);
51    appendGeometryCommand->AvailableForStates(G4State_Idle);
52
53    addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
54    addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
55    addPointAttributesCommand->SetParameterName("flag",false);
56    addPointAttributesCommand->SetDefaultValue(false);
57    addPointAttributesCommand->AvailableForStates(G4State_Idle);
58
59    useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
60    useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
61    useSolidsCommand->SetParameterName("flag",false);
62    useSolidsCommand->SetDefaultValue(true);
63    useSolidsCommand->AvailableForStates(G4State_Idle);
64
65/* Not Enabled Yet
66    writeInvisiblesCommand = new G4UIcmdWithABool("/vis/heprep/writeInvisibles", this);
67    writeInvisiblesCommand->SetGuidance("Write invisible objects.");
68    writeInvisiblesCommand->SetParameterName("flag",false);
69    writeInvisiblesCommand->SetDefaultValue(true);
70    writeInvisiblesCommand->AvailableForStates(G4State_Idle);
71*/
72}
73
74G4HepRepMessenger::~G4HepRepMessenger() {
75    delete setEventNumberSuffixCommand;
76    delete appendGeometryCommand;
77    delete addPointAttributesCommand;
78    delete useSolidsCommand;
79//    delete writeInvisiblesCommand;
80    delete heprepDirectory;
81}
82
83G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
84    if (command==setEventNumberSuffixCommand) {
85        return suffix;
86    } else if (command==appendGeometryCommand) {
87        return appendGeometryCommand->ConvertToString(geometry); 
88    } else if (command==addPointAttributesCommand) {
89        return addPointAttributesCommand->ConvertToString(pointAttributes); 
90    } else if (command==useSolidsCommand) {
91        return useSolidsCommand->ConvertToString(solids);
92//    } else if (command==writeInvisiblesCommand) {
93//        return writeInvisiblesCommand->ConvertToString(invisibles);
94    } else {
95        return "";
96    }
97}
98
99void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
100    if (command==setEventNumberSuffixCommand) {
101        suffix = newValue;
102    } else if (command==appendGeometryCommand) {
103        geometry = appendGeometryCommand->GetNewBoolValue(newValue);
104    } else if (command==addPointAttributesCommand) {
105        pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
106    } else if (command==useSolidsCommand) {
107        solids = useSolidsCommand->GetNewBoolValue(newValue);
108//    } else if (command==writeInvisiblesCommand) {
109//        invisibles = writeInvisiblesCommand->GetNewBoolValue(newValue);
110    } 
111}
112
113G4String G4HepRepMessenger::getEventNumberSuffix() {
114    return suffix;
115}
116
117G4bool G4HepRepMessenger::appendGeometry() {
118    return geometry;
119}
120
121G4bool G4HepRepMessenger::addPointAttributes() {
122    return pointAttributes;
123}
124
125G4bool G4HepRepMessenger::useSolids() {
126    return solids;
127}
128
129G4bool G4HepRepMessenger::writeInvisibles() {
130    return invisibles;
131}
132
Note: See TracBrowser for help on using the repository browser.