[807] | 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: G4BlineTracerMessenger.cc,v 1.2 2006/06/29 17:15:18 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | // -------------------------------------------------------------------- |
---|
| 31 | // |
---|
| 32 | // G4BlineTracerMessenger implementation |
---|
| 33 | // |
---|
| 34 | // -------------------------------------------------------------------- |
---|
| 35 | // Author: Laurent Desorgher (desorgher@phim.unibe.ch) |
---|
| 36 | // Created - 2003-10-06 |
---|
| 37 | // -------------------------------------------------------------------- |
---|
| 38 | |
---|
| 39 | #include "G4BlineTracerMessenger.hh" |
---|
| 40 | #include "G4BlineTracer.hh" |
---|
| 41 | #include "G4BlineEventAction.hh" |
---|
| 42 | |
---|
| 43 | #include "G4UImessenger.hh" |
---|
| 44 | #include "G4UIdirectory.hh" |
---|
| 45 | #include "G4UIcommand.hh" |
---|
| 46 | #include "G4UIcmdWithADouble.hh" |
---|
| 47 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 48 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 49 | #include "G4UIcmdWithoutParameter.hh" |
---|
| 50 | #include "G4UIcmdWith3Vector.hh" |
---|
| 51 | #include "G4UIcmdWithABool.hh" |
---|
| 52 | |
---|
| 53 | /////////////////////////////////////////////////////////////////////////// |
---|
| 54 | |
---|
| 55 | G4BlineTracerMessenger::G4BlineTracerMessenger( G4BlineTracer* aBlineTool ) |
---|
| 56 | { |
---|
| 57 | theBlineTool = aBlineTool; |
---|
| 58 | BlineToolDir = new G4UIdirectory("/vis/blineTracer/"); |
---|
| 59 | BlineToolDir->SetGuidance("Commands to trace and visualise magnetic field lines."); |
---|
| 60 | BlineToolDir->SetGuidance("These commands work only if a magnetic-field is set"); |
---|
| 61 | BlineToolDir->SetGuidance("in the application."); |
---|
| 62 | |
---|
| 63 | // commands |
---|
| 64 | |
---|
| 65 | BlineCmd = new G4UIcmdWithAnInteger("/vis/blineTracer/computeBline",this); |
---|
| 66 | BlineCmd->SetGuidance("Compute magnetic field lines for visualisation."); |
---|
| 67 | BlineCmd->SetParameterName("nb_of_lines",false); |
---|
| 68 | BlineCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 69 | |
---|
| 70 | SetMaxTrackingStepCmd = |
---|
| 71 | new G4UIcmdWithADoubleAndUnit("/vis/blineTracer/setMaxStepLength",this); |
---|
| 72 | SetMaxTrackingStepCmd->SetGuidance("Set the maximum length of tracking step"); |
---|
| 73 | SetMaxTrackingStepCmd->SetGuidance("when integrating magnetic field line."); |
---|
| 74 | SetMaxTrackingStepCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 75 | |
---|
| 76 | SetDrawColourCmd = new G4UIcmdWith3Vector("/vis/blineTracer/setColour",this); |
---|
| 77 | SetDrawColourCmd->SetGuidance("Set the colour drawing trajectories"); |
---|
| 78 | SetDrawColourCmd->SetGuidance("and magnetic field lines."); |
---|
| 79 | SetDrawColourCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 80 | |
---|
| 81 | SetDrawBlineCmd = new G4UIcmdWithABool("/vis/blineTracer/stockLines",this); |
---|
| 82 | SetDrawBlineCmd->SetGuidance("If true field lines are stocked in lines"); |
---|
| 83 | SetDrawBlineCmd->SetGuidance("to be drawn."); |
---|
| 84 | SetDrawBlineCmd->SetParameterName("StockLines",false); |
---|
| 85 | SetDrawBlineCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 86 | |
---|
| 87 | SetDrawPointsCmd = new G4UIcmdWithABool("/vis/blineTracer/stockPoints",this); |
---|
| 88 | SetDrawPointsCmd->SetGuidance("If true step field line points are stocked"); |
---|
| 89 | SetDrawPointsCmd->SetGuidance("in vector of points to be drawn."); |
---|
| 90 | SetDrawPointsCmd->SetParameterName("StockPoints",false); |
---|
| 91 | SetDrawPointsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 92 | |
---|
| 93 | SetPointSizeCmd = new G4UIcmdWithADouble("/vis/blineTracer/setPointSize",this); |
---|
| 94 | SetPointSizeCmd->SetGuidance("Set the size of points for drawing."); |
---|
| 95 | SetPointSizeCmd->SetParameterName("StepSize",false); |
---|
| 96 | SetPointSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 97 | |
---|
| 98 | DrawCmd = new G4UIcmdWithoutParameter("/vis/blineTracer/show",this); |
---|
| 99 | DrawCmd->SetGuidance("Show the stored magnetic field lines."); |
---|
| 100 | DrawCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 101 | |
---|
| 102 | ResetCmd = |
---|
| 103 | new G4UIcmdWithoutParameter("/vis/blineTracer/resetMaterialToBeDrawn",this); |
---|
| 104 | ResetCmd->SetGuidance("Clear the vectors of lines and points to be drawn."); |
---|
| 105 | ResetCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | /////////////////////////////////////////////////////////////////////////// |
---|
| 109 | |
---|
| 110 | G4BlineTracerMessenger::~G4BlineTracerMessenger() |
---|
| 111 | { |
---|
| 112 | delete ResetCmd; |
---|
| 113 | delete DrawCmd; |
---|
| 114 | delete SetPointSizeCmd; |
---|
| 115 | delete SetDrawPointsCmd; |
---|
| 116 | delete SetDrawBlineCmd; |
---|
| 117 | delete SetDrawColourCmd; |
---|
| 118 | delete SetMaxTrackingStepCmd; |
---|
| 119 | delete BlineCmd; |
---|
| 120 | delete BlineToolDir; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | /////////////////////////////////////////////////////////////////////////// |
---|
| 124 | |
---|
| 125 | void G4BlineTracerMessenger::SetNewValue( G4UIcommand * command, |
---|
| 126 | G4String newValues ) |
---|
| 127 | { |
---|
| 128 | if (command == BlineCmd) |
---|
| 129 | theBlineTool->ComputeBlines(1); |
---|
| 130 | else if( command == SetMaxTrackingStepCmd ) |
---|
| 131 | theBlineTool->SetMaxTrackingStep(SetMaxTrackingStepCmd |
---|
| 132 | ->GetNewDoubleValue(newValues)); |
---|
| 133 | else if( command == SetDrawBlineCmd ) |
---|
| 134 | theBlineTool->GetEventAction()->SetDrawBline(SetDrawBlineCmd |
---|
| 135 | ->GetNewBoolValue(newValues)); |
---|
| 136 | else if( command == SetDrawColourCmd ) |
---|
| 137 | { |
---|
| 138 | G4ThreeVector vec=SetDrawColourCmd->GetNew3VectorValue(newValues); |
---|
| 139 | theBlineTool->GetEventAction()-> |
---|
| 140 | SetDrawColour(G4Colour(vec.x(),vec.y(),vec.z())); |
---|
| 141 | } |
---|
| 142 | else if( command == SetDrawPointsCmd ) |
---|
| 143 | theBlineTool->GetEventAction()->SetDrawPoints(SetDrawPointsCmd |
---|
| 144 | ->GetNewBoolValue(newValues)); |
---|
| 145 | else if( command == SetPointSizeCmd ) |
---|
| 146 | theBlineTool->GetEventAction()->SetPointSize(SetPointSizeCmd |
---|
| 147 | ->GetNewDoubleValue(newValues)); |
---|
| 148 | else if( command == DrawCmd ) |
---|
| 149 | theBlineTool->GetEventAction()->DrawFieldLines(.5,45.,45.); |
---|
| 150 | else if( command == ResetCmd ) |
---|
| 151 | theBlineTool->GetEventAction()->ResetVectorObjectToBeDrawn(); |
---|
| 152 | } |
---|