MCPcopy Create free account
hub / github.com/Geant4/geant4 / AddVisAction

Method AddVisAction

source/visualization/management/src/G4VisCommandsSceneAdd.cc:3045–3097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3043}
3044
3045void G4VisCommandSceneAddUserAction::AddVisAction
3046(const G4String& name,
3047 G4VUserVisAction* visAction,
3048 G4Scene* pScene,
3049 G4VisCommandSceneAddUserAction::ActionType type,
3050 G4VisManager::Verbosity verbosity)
3051{
3052 G4bool warn = verbosity >= G4VisManager::warnings;
3053
3054 const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
3055 fpVisManager->GetUserVisActionExtents();
3056 G4VisExtent extent;
3057 std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
3058 visExtentMap.find(visAction);
3059 if (i != visExtentMap.end()) extent = i->second;
3060 if (warn) {
3061 if (extent.GetExtentRadius() <= 0.) {
3062 G4warn
3063 << "WARNING: User Vis Action \"" << name << "\" extent is null."
3064 << G4endl;
3065 }
3066 }
3067
3068 G4VModel* model = new G4CallbackModel<G4VUserVisAction>(visAction);
3069 model->SetType("User Vis Action");
3070 model->SetGlobalTag(name);
3071 model->SetGlobalDescription(name);
3072 model->SetExtent(extent);
3073 G4bool successful = false;;
3074 switch (type) {
3075 case runDuration:
3076 successful = pScene -> AddRunDurationModel (model, warn);
3077 break;
3078 case endOfEvent:
3079 successful = pScene -> AddEndOfEventModel (model, warn);
3080 break;
3081 case endOfRun:
3082 successful = pScene -> AddEndOfRunModel (model, warn);
3083 break;
3084 }
3085 if (successful) {
3086 if (verbosity >= G4VisManager::confirmations) {
3087 const G4String& currentSceneName = pScene -> GetName ();
3088 G4cout << "User Vis Action added to scene \""
3089 << currentSceneName << "\"";
3090 if (verbosity >= G4VisManager::parameters) {
3091 G4cout << "\n with extent " << extent;
3092 }
3093 G4cout << G4endl;
3094 }
3095 }
3096 else G4VisCommandsSceneAddUnsuccessful(verbosity);
3097}
3098
3099////////////// /vis/scene/add/volume ///////////////////////////////////////
3100

Callers

nothing calls this directly

Calls 8

GetExtentRadiusMethod · 0.80
AddRunDurationModelMethod · 0.80
AddEndOfEventModelMethod · 0.80
AddEndOfRunModelMethod · 0.80
findMethod · 0.45
endMethod · 0.45
SetTypeMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected