Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:47

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file visualization/perspective/src/PerspectiveVisActionMessenger.cc
0027 /// \brief Implementation of the PerspectiveVisActionMessenger class
0028 //
0029 //
0030 
0031 #include "PerspectiveVisActionMessenger.hh"
0032 
0033 #include "PerspectiveVisAction.hh"
0034 
0035 #include "G4UIcmdWithAString.hh"
0036 #include "G4UIcommand.hh"
0037 #include "G4UIdirectory.hh"
0038 #include "G4UImanager.hh"
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 PerspectiveVisActionMessenger::PerspectiveVisActionMessenger(PerspectiveVisAction* PVA)
0043   : G4UImessenger(), fPVA(PVA), fpDirectory(0), fpCommandOS(0), fpCommandScene(0)
0044 {
0045   G4bool omitable;
0046 
0047   fpDirectory = new G4UIdirectory("/perspectiveDemo/");
0048   fpDirectory->SetGuidance("Perspective demonstration commands.");
0049 
0050   fpCommandOS = new G4UIcmdWithAString("/perspectiveDemo/optionString", this);
0051   fpCommandOS->SetGuidance("Option string - any combination of \"x\", \"y\", \"z\", \"a[ll]\".");
0052   fpCommandOS->SetGuidance("Controls direction of perspective lines.");
0053   fpCommandOS->SetParameterName("option-string", omitable = true);
0054   fpCommandOS->SetDefaultValue("all");
0055 
0056   fpCommandScene = new G4UIcmdWithAString("/perspectiveDemo/scene", this);
0057   fpCommandScene->SetGuidance("Scene name.");
0058   fpCommandScene->SetParameterName("scene-name", omitable = true);
0059   fpCommandScene->SetDefaultValue("room-and-chair");
0060   fpCommandScene->SetCandidates("room-and-chair");
0061 }
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 PerspectiveVisActionMessenger::~PerspectiveVisActionMessenger()
0066 {
0067   delete fpCommandScene;
0068   delete fpCommandOS;
0069   delete fpDirectory;
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 
0074 void PerspectiveVisActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0075 {
0076   if (command == fpCommandOS) {
0077     fPVA->SetOptionString(newValue);
0078   }
0079 
0080   else if (command == fpCommandScene) {
0081     fPVA->SetScene(newValue);
0082   }
0083 
0084   G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......