Geant4  10.01.p02
PerspectiveVisActionMessenger.cc
Go to the documentation of this file.
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 //
28 //
29 //
30 // $Id: PerspectiveVisActionMessenger.cc 69587 2013-05-08 14:26:03Z gcosmo $
31 
33 
34 #include "PerspectiveVisAction.hh"
35 
36 #include "G4UImanager.hh"
37 #include "G4UIcommand.hh"
38 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAString.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
45  G4UImessenger(),
46  fPVA(PVA),
47  fpDirectory(0),
48  fpCommandOS(0),
49  fpCommandScene(0)
50 {
51  G4bool omitable;
52 
53  fpDirectory = new G4UIdirectory ("/perspectiveDemo/");
54  fpDirectory -> SetGuidance ("Perspective demonstration commands.");
55 
56  fpCommandOS = new G4UIcmdWithAString ("/perspectiveDemo/optionString", this);
57  fpCommandOS -> SetGuidance
58  ("Option string - any combination of \"x\", \"y\", \"z\", \"a[ll]\".");
59  fpCommandOS -> SetGuidance
60  ("Controls direction of perspective lines.");
61  fpCommandOS -> SetParameterName ("option-string", omitable = true);
62  fpCommandOS -> SetDefaultValue("all");
63 
64  fpCommandScene = new G4UIcmdWithAString ("/perspectiveDemo/scene", this);
65  fpCommandScene -> SetGuidance
66  ("Scene name.");
67  fpCommandScene -> SetParameterName ("scene-name", omitable = true);
68  fpCommandScene -> SetDefaultValue("room-and-chair");
69  fpCommandScene -> SetCandidates("room-and-chair");
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  delete fpCommandScene;
77  delete fpCommandOS;
78  delete fpDirectory;
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
84 (G4UIcommand* command, G4String newValue)
85 {
86  if (command == fpCommandOS)
87  {
88  fPVA->SetOptionString(newValue);
89  }
90 
91  else if (command == fpCommandScene)
92  {
93  fPVA->SetScene(newValue);
94  }
95 
96  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Definition of the PerspectiveVisActionMessenger class.
PerspectiveVisActionMessenger(PerspectiveVisAction *)
bool G4bool
Definition: G4Types.hh:79
Definition of the PerspectiveVisAction class.
virtual void SetNewValue(G4UIcommand *, G4String)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432