ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4VisCommandsViewerDefault.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VisCommandsViewerDefault.cc
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
30
#include "
G4VisCommandsViewerDefault.hh
"
31
32
#include "
G4VisManager.hh
"
33
#include "
G4UIcmdWithAString.hh
"
34
#include "
G4UIcmdWithABool.hh
"
35
37
38
G4VisCommandViewerDefaultHiddenEdge::G4VisCommandViewerDefaultHiddenEdge
()
39
{
40
G4bool
omitable;
41
fpCommand
=
new
G4UIcmdWithABool
(
"/vis/viewer/default/hiddenEdge"
,
this
);
42
fpCommand
->
SetGuidance
(
"Default hiddenEdge drawing for future viewers."
);
43
fpCommand
->
SetGuidance
44
(
"Edges become hidden/seen in wireframe or surface mode."
);
45
fpCommand
->
SetParameterName
(
"hidden-edge"
,omitable =
true
);
46
fpCommand
->
SetDefaultValue
(
true
);
47
}
48
49
G4VisCommandViewerDefaultHiddenEdge::~G4VisCommandViewerDefaultHiddenEdge
()
50
{
51
delete
fpCommand
;
52
}
53
54
G4String
G4VisCommandViewerDefaultHiddenEdge::GetCurrentValue
(
G4UIcommand
*)
55
{
56
return
""
;
57
}
58
59
void
G4VisCommandViewerDefaultHiddenEdge::SetNewValue
(
G4UIcommand
*,
G4String
newValue)
60
{
61
// Follows /vis/viewer/set/hiddenEdge
62
63
G4VisManager::Verbosity
verbosity =
fpVisManager
->
GetVerbosity
();
64
G4ViewParameters
vp =
fpVisManager
->
GetDefaultViewParameters
();
65
G4ViewParameters::DrawingStyle
existingStyle = vp.
GetDrawingStyle
();
66
67
if
(
G4UIcommand::ConvertToBool
(newValue)) {
// true
68
switch
(existingStyle) {
69
case
G4ViewParameters::wireframe
:
70
vp.
SetDrawingStyle
(
G4ViewParameters::hlr
);
71
break
;
72
case
G4ViewParameters::hlr
:
73
break
;
74
case
G4ViewParameters::hsr
:
75
vp.
SetDrawingStyle
(
G4ViewParameters::hlhsr
);
76
break
;
77
case
G4ViewParameters::hlhsr
:
78
break
;
79
case
G4ViewParameters::cloud
:
80
break
;
81
}
82
}
83
else
{
// false
84
switch
(existingStyle) {
85
case
G4ViewParameters::wireframe
:
86
break
;
87
case
G4ViewParameters::hlr
:
88
vp.
SetDrawingStyle
(
G4ViewParameters::wireframe
);
89
break
;
90
case
G4ViewParameters::hsr
:
91
break
;
92
case
G4ViewParameters::hlhsr
:
93
vp.
SetDrawingStyle
(
G4ViewParameters::hsr
);
94
break
;
95
case
G4ViewParameters::cloud
:
96
break
;
97
}
98
}
99
100
fpVisManager
->
SetDefaultViewParameters
(vp);
101
102
if
(verbosity >=
G4VisManager::confirmations
) {
103
G4cout
<<
"Default drawing style set to "
<< vp.
GetDrawingStyle
()
104
<<
G4endl
;
105
}
106
}
107
109
110
G4VisCommandViewerDefaultStyle::G4VisCommandViewerDefaultStyle
()
111
{
112
G4bool
omitable;
113
fpCommand
=
new
G4UIcmdWithAString
(
"/vis/viewer/default/style"
,
this
);
114
fpCommand
->
SetGuidance
(
"Default drawing style for future viewers."
);
115
fpCommand
->
SetGuidance
116
(
"Set style of drawing - w[ireframe] or s[urface] or c[loud]."
);
117
fpCommand
->
SetGuidance
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
123
G4VisCommandViewerDefaultStyle::~G4VisCommandViewerDefaultStyle
()
124
{
125
delete
fpCommand
;
126
}
127
128
G4String
G4VisCommandViewerDefaultStyle::GetCurrentValue
(
G4UIcommand
*)
129
{
130
return
""
;
131
}
132
133
void
G4VisCommandViewerDefaultStyle::SetNewValue
(
G4UIcommand
*,
G4String
newValue)
134
{
135
// Follows /vis/viewer/set/style
136
137
G4VisManager::Verbosity
verbosity =
fpVisManager
->
GetVerbosity
();
138
G4ViewParameters
vp =
fpVisManager
->
GetDefaultViewParameters
();
139
G4ViewParameters::DrawingStyle
existingStyle = vp.
GetDrawingStyle
();
140
141
const
size_t
iPos0 = 0;
142
if
(newValue[iPos0] ==
'w'
) {
// "wireframe"
143
switch
(existingStyle) {
144
case
G4ViewParameters::wireframe
:
145
break
;
146
case
G4ViewParameters::hlr
:
147
break
;
148
case
G4ViewParameters::hsr
:
149
vp.
SetDrawingStyle
(
G4ViewParameters::wireframe
);
150
break
;
151
case
G4ViewParameters::hlhsr
:
152
vp.
SetDrawingStyle
(
G4ViewParameters::hlr
);
153
break
;
154
case
G4ViewParameters::cloud
:
155
vp.
SetDrawingStyle
(
G4ViewParameters::wireframe
);
156
break
;
157
}
158
}
159
else
if
(newValue[iPos0] ==
's'
) {
// "surface"
160
switch
(existingStyle) {
161
case
G4ViewParameters::wireframe
:
162
vp.
SetDrawingStyle
(
G4ViewParameters::hsr
);
163
break
;
164
case
G4ViewParameters::hlr
:
165
vp.
SetDrawingStyle
(
G4ViewParameters::hlhsr
);
166
break
;
167
case
G4ViewParameters::hsr
:
168
break
;
169
case
G4ViewParameters::hlhsr
:
170
break
;
171
case
G4ViewParameters::cloud
:
172
vp.
SetDrawingStyle
(
G4ViewParameters::hsr
);
173
break
;
174
}
175
}
176
else
if
(newValue[iPos0] ==
'c'
) {
// "cloud"
177
switch
(existingStyle) {
178
case
G4ViewParameters::wireframe
:
179
vp.
SetDrawingStyle
(
G4ViewParameters::cloud
);
180
break
;
181
case
G4ViewParameters::hlr
:
182
vp.
SetDrawingStyle
(
G4ViewParameters::cloud
);
183
break
;
184
case
G4ViewParameters::hsr
:
185
vp.
SetDrawingStyle
(
G4ViewParameters::cloud
);
186
break
;
187
case
G4ViewParameters::hlhsr
:
188
vp.
SetDrawingStyle
(
G4ViewParameters::cloud
);
189
break
;
190
case
G4ViewParameters::cloud
:
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
202
fpVisManager
->
SetDefaultViewParameters
(vp);
203
204
if
(verbosity >=
G4VisManager::confirmations
) {
205
G4cout
<<
"Default drawing style set to "
<< vp.
GetDrawingStyle
()
206
<<
G4endl
;
207
}
208
}
geant4
tree
geant4-10.6-release
source
visualization
management
src
G4VisCommandsViewerDefault.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:56
using
1.8.2 with
ECCE GitHub integration