Geant4-11
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
37
39{
40 G4bool omitable;
41 fpCommand = new G4UIcmdWithABool("/vis/viewer/default/hiddenEdge", this);
42 fpCommand->SetGuidance("Default hiddenEdge drawing for future viewers.");
44 ("Edges become hidden/seen in wireframe or surface mode.");
45 fpCommand->SetParameterName("hidden-edge",omitable = true);
47}
48
50{
51 delete fpCommand;
52}
53
55{
56 return "";
57}
58
60{
61 // Follows /vis/viewer/set/hiddenEdge
62
66
67 if (G4UIcommand::ConvertToBool(newValue)) { // true
68 switch (existingStyle) {
71 break;
73 break;
76 break;
78 break;
80 break;
81 }
82 }
83 else { // false
84 switch (existingStyle) {
86 break;
89 break;
91 break;
94 break;
96 break;
97 }
98 }
99
101
102 if (verbosity >= G4VisManager::confirmations) {
103 G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
104 << G4endl;
105 }
106}
107
109
111{
112 G4bool omitable;
113 fpCommand = new G4UIcmdWithAString("/vis/viewer/default/style", this);
114 fpCommand->SetGuidance("Default drawing style for future viewers.");
116 ("Set style of drawing - w[ireframe] or s[urface] or c[loud].");
118 ("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
119 fpCommand->SetParameterName ("style",omitable = false);
120 fpCommand->SetCandidates("w wireframe s surface c cloud");
121}
122
124{
125 delete fpCommand;
126}
127
129{
130 return "";
131}
132
134{
135 // Follows /vis/viewer/set/style
136
140
141 const size_t iPos0 = 0;
142 if (newValue[iPos0] == 'w') { // "wireframe"
143 switch (existingStyle) {
145 break;
147 break;
150 break;
153 break;
156 break;
157 }
158 }
159 else if (newValue[iPos0] == 's') { // "surface"
160 switch (existingStyle) {
163 break;
166 break;
168 break;
170 break;
173 break;
174 }
175 }
176 else if (newValue[iPos0] == 'c') { // "cloud"
177 switch (existingStyle) {
180 break;
183 break;
186 break;
189 break;
191 break;
192 }
193 }
194 else {
195 if (verbosity >= G4VisManager::errors) {
196 G4cerr << "ERROR: \"" << newValue << "\" not recognised."
197 " Looking for 'w' or 's' or 'c' first character." << G4endl;
198 }
199 return;
200 }
201
203
204 if (verbosity >= G4VisManager::confirmations) {
205 G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
206 << G4endl;
207 }
208}
bool G4bool
Definition: G4Types.hh:86
G4GLOB_DLL std::ostream G4cerr
#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:156
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:545
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 &)