Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VisCommandsViewerDefault.cc
Go to the documentation of this file.
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
28// /vis/default commands - John Allison 30th October 2011
29
31
32#include "G4VisManager.hh"
33#include "G4UIcmdWithAString.hh"
34#include "G4UIcmdWithABool.hh"
35
36#define G4warn G4cout
37
38////////////// /vis/viewer/default/hiddenEdge ///////////////////////////////////////
39
41{
42 G4bool omitable;
43 fpCommand = new G4UIcmdWithABool("/vis/viewer/default/hiddenEdge", this);
44 fpCommand->SetGuidance("Default hiddenEdge drawing for future viewers.");
45 fpCommand->SetGuidance
46 ("Edges become hidden/seen in wireframe or surface mode.");
47 fpCommand->SetParameterName("hidden-edge",omitable = true);
48 fpCommand->SetDefaultValue(true);
49}
50
52{
53 delete fpCommand;
54}
55
57{
58 return "";
59}
60
62{
63 // Follows /vis/viewer/set/hiddenEdge
64
68
69 if (G4UIcommand::ConvertToBool(newValue)) { // true
70 switch (existingStyle) {
73 break;
75 break;
78 break;
80 break;
82 break;
83 }
84 }
85 else { // false
86 switch (existingStyle) {
88 break;
91 break;
93 break;
96 break;
98 break;
99 }
100 }
101
103
104 if (verbosity >= G4VisManager::confirmations) {
105 G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
106 << G4endl;
107 }
108}
109
110////////////// /vis/viewer/default/style ///////////////////////////////////////
111
113{
114 G4bool omitable;
115 fpCommand = new G4UIcmdWithAString("/vis/viewer/default/style", this);
116 fpCommand->SetGuidance("Default drawing style for future viewers.");
117 fpCommand->SetGuidance
118 ("Set style of drawing - w[ireframe] or s[urface] or c[loud].");
119 fpCommand->SetGuidance
120 ("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
121 fpCommand->SetParameterName ("style",omitable = false);
122 fpCommand->SetCandidates("w wireframe s surface c cloud");
123}
124
126{
127 delete fpCommand;
128}
129
131{
132 return "";
133}
134
136{
137 // Follows /vis/viewer/set/style
138
142
143 const size_t iPos0 = 0;
144 if (newValue[iPos0] == 'w') { // "wireframe"
145 switch (existingStyle) {
147 break;
149 break;
152 break;
155 break;
158 break;
159 }
160 }
161 else if (newValue[iPos0] == 's') { // "surface"
162 switch (existingStyle) {
165 break;
168 break;
170 break;
172 break;
175 break;
176 }
177 }
178 else if (newValue[iPos0] == 'c') { // "cloud"
179 switch (existingStyle) {
182 break;
185 break;
188 break;
191 break;
193 break;
194 }
195 }
196 else {
197 if (verbosity >= G4VisManager::errors) {
198 G4warn << "ERROR: \"" << newValue << "\" not recognised."
199 " Looking for 'w' or 's' or 'c' first character." << G4endl;
200 }
201 return;
202 }
203
205
206 if (verbosity >= G4VisManager::confirmations) {
207 G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
208 << G4endl;
209 }
210}
#define G4warn
Definition: G4Scene.cc:41
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:549
static G4VisManager * fpVisManager
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
DrawingStyle GetDrawingStyle() const
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4ViewParameters & GetDefaultViewParameters() const
static Verbosity GetVerbosity()
void SetDefaultViewParameters(const G4ViewParameters &)