#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddFrame:
Public Member Functions | |
G4VisCommandSceneAddFrame () | |
virtual | ~G4VisCommandSceneAddFrame () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Data Structures | |
struct | Frame |
Definition at line 153 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddFrame::G4VisCommandSceneAddFrame | ( | ) |
Definition at line 649 of file G4VisCommandsSceneAdd.cc.
00649 { 00650 fpCommand = new G4UIcommand("/vis/scene/add/frame", this); 00651 fpCommand -> SetGuidance ("Adds frame to current scene."); 00652 G4bool omitable; 00653 G4UIparameter* parameter; 00654 parameter = new G4UIparameter ("size", 'd', omitable = true); 00655 parameter -> SetGuidance ("Size of frame. 1 = full window."); 00656 parameter -> SetParameterRange ("size > 0 && size <=1"); 00657 parameter -> SetDefaultValue (0.97); 00658 fpCommand -> SetParameter (parameter); 00659 }
G4VisCommandSceneAddFrame::~G4VisCommandSceneAddFrame | ( | ) | [virtual] |
G4String G4VisCommandSceneAddFrame::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddFrame::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 669 of file G4VisCommandsSceneAdd.cc.
References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fCurrentColour, G4VVisCommand::fCurrentLineWidth, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4VisManager::GetVerbosity(), G4VModel::SetGlobalDescription(), G4VModel::SetGlobalTag(), G4VModel::SetType(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.
00670 { 00671 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00672 G4bool warn(verbosity >= G4VisManager::warnings); 00673 00674 G4Scene* pScene = fpVisManager->GetCurrentScene(); 00675 if (!pScene) { 00676 if (verbosity >= G4VisManager::errors) { 00677 G4cout << "ERROR: No current scene. Please create one." << G4endl; 00678 } 00679 return; 00680 } 00681 00682 G4double size; 00683 std::istringstream is(newValue); 00684 is >> size; 00685 00686 Frame* frame = new Frame(size, fCurrentLineWidth, fCurrentColour); 00687 G4VModel* model = 00688 new G4CallbackModel<G4VisCommandSceneAddFrame::Frame>(frame); 00689 model->SetType("Frame"); 00690 model->SetGlobalTag("Frame"); 00691 model->SetGlobalDescription("Frame: " + newValue); 00692 const G4String& currentSceneName = pScene -> GetName (); 00693 G4bool successful = pScene -> AddRunDurationModel (model, warn); 00694 if (successful) { 00695 if (verbosity >= G4VisManager::confirmations) { 00696 G4cout << "Frame has been added to scene \"" 00697 << currentSceneName << "\"." 00698 << G4endl; 00699 } 00700 } 00701 else G4VisCommandsSceneAddUnsuccessful(verbosity); 00702 UpdateVisManagerScene (currentSceneName); 00703 }