Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 // $Id: G4VisCommandsDefault.cc,v 1.4 2007-01-05 16:29:38 allison Exp $
28 
29 // /vis/default commands - John Allison 30th October 2011
30 
32 
33 #include "G4VisManager.hh"
34 #include "G4UIcmdWithAString.hh"
35 #include "G4UIcmdWithABool.hh"
36 
38 
40 {
41  G4bool omitable;
42  fpCommand = new G4UIcmdWithABool("/vis/viewer/default/hiddenEdge", this);
43  fpCommand->SetGuidance("Default hiddenEdge drawing for future viewers.");
44  fpCommand->SetGuidance
45  ("Edges become hidden/seen in wireframe or surface mode.");
46  fpCommand->SetParameterName("hidden-edge",omitable = true);
47  fpCommand->SetDefaultValue(true);
48 }
49 
51 {
52  delete fpCommand;
53 }
54 
56 {
57  return "";
58 }
59 
61 {
62  // Follows /vis/viewer/set/hiddenEdge
63 
67 
68  if (G4UIcommand::ConvertToBool(newValue)) {
69  switch (existingStyle) {
72  break;
74  break;
77  break;
79  break;
80  }
81  }
82  else {
83  switch (existingStyle) {
85  break;
88  break;
90  break;
93  break;
94  }
95  }
96 
98 
99  if (verbosity >= G4VisManager::confirmations) {
100  G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
101  << G4endl;
102  }
103 }
104 
106 
108 {
109  G4bool omitable;
110  fpCommand = new G4UIcmdWithAString("/vis/viewer/default/style", this);
111  fpCommand->SetGuidance("Default drawing style for future viewers.");
112  fpCommand->SetGuidance
113  ("Set style of drawing - w[ireframe] or s[urface].");
114  fpCommand->SetGuidance
115  ("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
116  fpCommand->SetParameterName ("style",omitable = false);
117  fpCommand->SetCandidates("w wireframe s surface");
118 }
119 
121 {
122  delete fpCommand;
123 }
124 
126 {
127  return "";
128 }
129 
131 {
132  // Follows /vis/viewer/set/style
133 
136  G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
137 
138  const size_t iPos0 = 0;
139  if (newValue[iPos0] == 'w') { // "wireframe"
140  switch (existingStyle) {
142  break;
144  break;
147  break;
150  break;
151  }
152  }
153  else if (newValue[iPos0] == 's') { // "surface"
154  switch (existingStyle) {
157  break;
160  break;
162  break;
164  break;
165  }
166  }
167  else {
168  if (verbosity >= G4VisManager::errors) {
169  G4cerr << "ERROR: \"" << newValue << "\" not recognised."
170  " Looking for 'w' or 's' first character." << G4endl;
171  }
172  return;
173  }
174 
176 
177  if (verbosity >= G4VisManager::confirmations) {
178  G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
179  << G4endl;
180  }
181 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetDefaultViewParameters(const G4ViewParameters &)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
const G4ViewParameters & GetDefaultViewParameters() const
G4GLOB_DLL std::ostream G4cout
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:437
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
G4String GetCurrentValue(G4UIcommand *command)
static Verbosity GetVerbosity()
void SetNewValue(G4UIcommand *command, G4String newValue)
DrawingStyle GetDrawingStyle() const
void SetCandidates(const char *candidateList)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager