G4VisCommandSceneAddEventID Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddEventID:

G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddEventID ()
virtual ~G4VisCommandSceneAddEventID ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)

Data Structures

struct  EventID

Detailed Description

Definition at line 130 of file G4VisCommandsSceneAdd.hh.


Constructor & Destructor Documentation

G4VisCommandSceneAddEventID::G4VisCommandSceneAddEventID (  ) 

Definition at line 514 of file G4VisCommandsSceneAdd.cc.

00514                                                           {
00515   G4bool omitable;
00516   fpCommand = new G4UIcommand ("/vis/scene/add/eventID", this);
00517   fpCommand -> SetGuidance ("Adds eventID to current scene.");
00518   fpCommand -> SetGuidance
00519     ("Run and event numbers are drawn at end of event or run when"
00520      "\n the scene in which they are added is current.");
00521   G4UIparameter* parameter;
00522   parameter = new G4UIparameter ("size", 'i', omitable = true);
00523   parameter -> SetGuidance ("Screen size of text in pixels.");
00524   parameter -> SetDefaultValue (18);
00525   fpCommand -> SetParameter (parameter);
00526   parameter = new G4UIparameter ("x-position", 'd', omitable = true);
00527   parameter -> SetGuidance ("x screen position in range -1 < x < 1.");
00528   parameter -> SetDefaultValue (-0.95);
00529   fpCommand -> SetParameter (parameter);
00530   parameter = new G4UIparameter ("y-position", 'd', omitable = true);
00531   parameter -> SetGuidance ("y screen position in range -1 < y < 1.");
00532   parameter -> SetDefaultValue (0.9);
00533   fpCommand -> SetParameter (parameter);
00534   parameter = new G4UIparameter ("layout", 's', omitable = true);
00535   parameter -> SetGuidance ("Layout, i.e., adjustment: left|centre|right.");
00536   parameter -> SetDefaultValue ("left");
00537   fpCommand -> SetParameter (parameter);
00538 }

G4VisCommandSceneAddEventID::~G4VisCommandSceneAddEventID (  )  [virtual]

Definition at line 540 of file G4VisCommandsSceneAdd.cc.

00540                                                            {
00541   delete fpCommand;
00542 }


Member Function Documentation

G4String G4VisCommandSceneAddEventID::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 544 of file G4VisCommandsSceneAdd.cc.

00544                                                                    {
00545   return "";
00546 }

void G4VisCommandSceneAddEventID::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 548 of file G4VisCommandsSceneAdd.cc.

References G4Text::centre, G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4VisManager::GetVerbosity(), G4Text::left, G4Text::right, G4VModel::SetGlobalDescription(), G4VModel::SetGlobalTag(), G4VModel::SetType(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.

00549 {
00550   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00551   G4bool warn(verbosity >= G4VisManager::warnings);
00552 
00553   G4Scene* pScene = fpVisManager->GetCurrentScene();
00554   if (!pScene) {
00555     if (verbosity >= G4VisManager::errors) {
00556       G4cout << "ERROR: No current scene.  Please create one." << G4endl;
00557     }
00558     return;
00559   }
00560 
00561   G4int size;
00562   G4double x, y;
00563   G4String layoutString;
00564   std::istringstream is(newValue);
00565   is >> size >> x >> y >> layoutString;
00566 
00567   G4Text::Layout layout = G4Text::right;
00568   if (layoutString(0) == 'l') layout = G4Text::left;
00569   else if (layoutString(0) == 'c') layout = G4Text::centre;
00570   else if (layoutString(0) == 'r') layout = G4Text::right;
00571 
00572   EventID* eventID = new EventID(fpVisManager, size, x, y, layout);
00573   G4VModel* model =
00574     new G4CallbackModel<G4VisCommandSceneAddEventID::EventID>(eventID);
00575   model->SetType("EventID");
00576   model->SetGlobalTag("EventID");
00577   model->SetGlobalDescription("EventID");
00578   const G4String& currentSceneName = pScene -> GetName ();
00579   G4bool successful = pScene -> AddEndOfEventModel (model, warn);
00580   if (successful) {
00581     if (verbosity >= G4VisManager::confirmations) {
00582       G4cout << "EventID has been added to scene \""
00583              << currentSceneName << "\"."
00584              << G4endl;
00585     }
00586   }
00587   else G4VisCommandsSceneAddUnsuccessful(verbosity);
00588   UpdateVisManagerScene (currentSceneName);
00589 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7