Geant4  9.6.p02
 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 // GEANT4 tag $Name: not supported by cvs2svn $
29 
30 // /vis/default commands - John Allison 30th October 2011
31 
33 
34 #include "G4VisManager.hh"
35 #include "G4UIcmdWithAString.hh"
36 #include "G4UIcmdWithABool.hh"
37 
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)) {
70  switch (existingStyle) {
73  break;
75  break;
78  break;
80  break;
81  }
82  }
83  else {
84  switch (existingStyle) {
86  break;
89  break;
91  break;
94  break;
95  }
96  }
97 
99 
100  if (verbosity >= G4VisManager::confirmations) {
101  G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
102  << G4endl;
103  }
104 }
105 
107 
109 {
110  G4bool omitable;
111  fpCommand = new G4UIcmdWithAString("/vis/viewer/default/style", this);
112  fpCommand->SetGuidance("Default drawing style for future viewers.");
113  fpCommand->SetGuidance
114  ("Set style of drawing - w[ireframe] or s[urface].");
115  fpCommand->SetGuidance
116  ("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
117  fpCommand->SetParameterName ("style",omitable = false);
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  G4cout << "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 }