source: trunk/examples/extended/visualization/perspective/src/PerspectiveVisActionMessenger.cc @ 1309

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 3.2 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//
27// $Id: PerspectiveVisActionMessenger.cc,v 1.3 2006/11/06 20:07:36 allison Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29
30#include "PerspectiveVisActionMessenger.hh"
31
32#include "PerspectiveVisAction.hh"
33
34#include "G4UImanager.hh"
35#include "G4UIcommand.hh"
36#include "G4UIdirectory.hh"
37#include "G4UIcmdWithAString.hh"
38
39PerspectiveVisActionMessenger::PerspectiveVisActionMessenger
40(PerspectiveVisAction* PVA):
41  fPVA(PVA)
42{
43  G4bool omitable;
44
45  fpDirectory = new G4UIdirectory ("/perspectiveDemo/");
46  fpDirectory -> SetGuidance ("Perspective demonstration commands.");
47
48  fpCommandOS = new G4UIcmdWithAString ("/perspectiveDemo/optionString", this);
49  fpCommandOS -> SetGuidance
50    ("Option string - any combination of \"x\", \"y\", \"z\", \"a[ll]\".");
51  fpCommandOS -> SetParameterName ("option-string", omitable = true);
52  fpCommandOS -> SetDefaultValue("all");
53
54  fpCommandScene = new G4UIcmdWithAString ("/perspectiveDemo/scene", this);
55  fpCommandScene -> SetGuidance
56    ("Scene name.");
57  fpCommandScene -> SetParameterName ("scene-name", omitable = true);
58  fpCommandScene -> SetDefaultValue("room-and-chair");
59  fpCommandScene -> SetCandidates("room-and-chair");
60}
61
62PerspectiveVisActionMessenger::~PerspectiveVisActionMessenger ()
63{
64  delete fpCommandScene;
65  delete fpCommandOS;
66  delete fpDirectory;
67}
68
69void PerspectiveVisActionMessenger::SetNewValue
70(G4UIcommand* command, G4String newValue)
71{
72  if (command == fpCommandOS)
73    {
74      fPVA->SetOptionString(newValue);
75    }
76
77  else if (command == fpCommandScene)
78    {
79      fPVA->SetScene(newValue);
80    }
81
82  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
83}
Note: See TracBrowser for help on using the repository browser.