File indexing completed on 2025-02-23 09:22:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
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
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
0064
0065 PerspectiveVisActionMessenger::~PerspectiveVisActionMessenger()
0066 {
0067 delete fpCommandScene;
0068 delete fpCommandOS;
0069 delete fpDirectory;
0070 }
0071
0072
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