Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandViewerRefresh Class Reference

#include <G4VisCommandsViewer.hh>

+ Inheritance diagram for G4VisCommandViewerRefresh:

Public Member Functions

 G4VisCommandViewerRefresh ()
 
virtual ~G4VisCommandViewerRefresh ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandViewer
 G4VVisCommandViewer ()
 
virtual ~G4VVisCommandViewer ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommandViewer
void SetViewParameters (G4VViewer *, const G4ViewParameters &)
 
void RefreshIfRequired (G4VViewer *)
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 224 of file G4VisCommandsViewer.hh.

Constructor & Destructor Documentation

◆ G4VisCommandViewerRefresh()

G4VisCommandViewerRefresh::G4VisCommandViewerRefresh ( )

Definition at line 1174 of file G4VisCommandsViewer.cc.

1174 {
1175 G4bool omitable, currentAsDefault;
1176 fpCommand = new G4UIcmdWithAString ("/vis/viewer/refresh", this);
1177 fpCommand -> SetGuidance
1178 ("Refreshes viewer.");
1179 fpCommand -> SetGuidance
1180 ("By default, acts on current viewer. \"/vis/viewer/list\""
1181 "\nto see possible viewers. Viewer becomes current.");
1182 fpCommand -> SetParameterName ("viewer-name",
1183 omitable = true,
1184 currentAsDefault = true);
1185}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandViewerRefresh()

G4VisCommandViewerRefresh::~G4VisCommandViewerRefresh ( )
virtual

Definition at line 1187 of file G4VisCommandsViewer.cc.

1187 {
1188 delete fpCommand;
1189}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandViewerRefresh::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1191 of file G4VisCommandsViewer.cc.

1191 {
1192 G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1193 return viewer ? viewer -> GetName () : G4String("none");
1194}
static G4VisManager * fpVisManager

◆ SetNewValue()

void G4VisCommandViewerRefresh::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1196 of file G4VisCommandsViewer.cc.

1196 {
1197
1199 G4bool warn(verbosity >= G4VisManager::warnings);
1200
1201 G4String& refreshName = newValue;
1202 G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
1203 if (!viewer) {
1204 if (verbosity >= G4VisManager::errors) {
1205 G4cout << "ERROR: Viewer \"" << refreshName << "\"" <<
1206 " not found - \"/vis/viewer/list\"\n to see possibilities."
1207 << G4endl;
1208 }
1209 return;
1210 }
1211
1212 G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1213 if (!sceneHandler) {
1214 if (verbosity >= G4VisManager::errors) {
1215 G4cout << "ERROR: Viewer \"" << refreshName << "\"" <<
1216 " has no scene handler - report serious bug."
1217 << G4endl;
1218 }
1219 return;
1220 }
1221
1222 G4Scene* scene = sceneHandler->GetScene();
1223 if (!scene) {
1224 if (verbosity >= G4VisManager::confirmations) {
1225 G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1226 << "\", to which viewer \"" << refreshName << "\"" <<
1227 "\n is attached, has no scene - \"/vis/scene/create\" and"
1228 " \"/vis/sceneHandler/attach\""
1229 "\n (or use compound command \"/vis/drawVolume\")."
1230 << G4endl;
1231 }
1232 return;
1233 }
1234 if (scene->GetRunDurationModelList().empty()) {
1235 G4bool successful = scene -> AddWorldIfEmpty (warn);
1236 if (!successful) {
1237 if (verbosity >= G4VisManager::warnings) {
1238 G4cout <<
1239 "WARNING: Scene is empty. Perhaps no geometry exists."
1240 "\n Try /run/initialize."
1241 << G4endl;
1242 }
1243 return;
1244 }
1245 // Scene has changed. UpdateVisManagerScene issues
1246 // /vis/scene/notifyHandlers, which does a refresh anyway, so the
1247 // ordinary refresh becomes part of the else phrase...
1249 } else {
1250 if (verbosity >= G4VisManager::confirmations) {
1251 G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
1252 << G4endl;
1253 }
1254 viewer -> SetView ();
1255 viewer -> ClearView ();
1256 viewer -> DrawView ();
1257 if (verbosity >= G4VisManager::confirmations) {
1258 G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
1259 "\n (You might also need \"/vis/viewer/update\".)" << G4endl;
1260 }
1261 }
1262}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
const std::vector< Model > & GetRunDurationModelList() const
const G4String & GetName() const
G4Scene * GetScene() const
const G4String & GetName() const
G4VSceneHandler * GetSceneHandler() const
void UpdateVisManagerScene(const G4String &sceneName="")
static Verbosity GetVerbosity()

The documentation for this class was generated from the following files: