Geant4
10.03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4GMocrenFileViewer.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: G4GMocrenFileViewer.cc 87360 2014-12-01 16:07:16Z gcosmo $
28
//
29
//
30
// Created: Mar. 31, 2009 Akinori Kimura
31
//
32
33
34
#define __G_ANSI_C__
35
#define G4GMocrenFile_STRUCTURE_PRIORITY 1.
36
37
#include "
G4ios.hh
"
38
#include <cstdio>
39
#include <cstring>
40
#include <cassert>
41
42
#include "
G4VisManager.hh
"
43
#include "
G4Scene.hh
"
44
#include "
G4Vector3D.hh
"
45
#include "
G4VisExtent.hh
"
46
#include "
G4LogicalVolume.hh
"
47
#include "
G4VSolid.hh
"
48
49
#include "
G4GMocrenFile.hh
"
50
#include "
G4GMocrenFileSceneHandler.hh
"
51
#include "
G4GMocrenFileViewer.hh
"
52
#include "
G4GMocrenMessenger.hh
"
53
54
55
//----- constants
56
57
//-- for a debugging
58
const
bool
GFDEBUG
=
false
;
59
60
//----- G4GMocrenFileViewer, constructor
61
G4GMocrenFileViewer::G4GMocrenFileViewer
(
G4GMocrenFileSceneHandler
& sceneHandler,
62
G4GMocrenMessenger
&,
63
const
G4String
&
name
)
64
:
G4VViewer
(sceneHandler, sceneHandler.IncrementViewCount (), name),
65
kSceneHandler (sceneHandler)
66
{
67
// Set a g4.gdd-file viewer
68
std::strncpy(
kG4GddViewer
,
"gMocren"
, 8);
69
if
( getenv(
"G4GMocrenFile_VIEWER"
) != NULL ) {
70
char
* env = getenv(
"G4GMocrenFile_VIEWER"
);
71
int
len = std::strlen(env);
72
if
(len >= 32) {
73
G4Exception
(
"G4GMocrenFileViewer::G4GMocrenFileViewer(*)"
,
74
"gMocren1000"
,
FatalException
,
75
"Invalid length of string set in G4GMocrenFile_VIEWER"
);
76
}
77
std::strncpy(
kG4GddViewer
, env, len);
78
//std::strcpy( kG4GddViewer, getenv( "G4GMocrenFile_VIEWER" ) ) ;
79
}
80
81
// string for viewer invocation
82
if
( !std::strcmp(
kG4GddViewer
,
"NONE"
) ) {
83
84
//std::strcpy( kG4GddViewerInvocation, "" );
85
kG4GddViewerInvocation
[0] =
'\0'
;
86
}
else
{
87
88
std::strncpy(
kG4GddViewerInvocation
,
kG4GddViewer
, std::strlen(
kG4GddViewer
));
89
std::strncat(
kG4GddViewerInvocation
,
" "
, 1);
90
const
char
* gddfname =
kSceneHandler
.
GetGddFileName
();
91
int
len = std::strlen(gddfname);
92
if
(len >= 64) {
93
G4Exception
(
"G4GMocrenFileViewer::G4GMocrenFileViewer(*)"
,
94
"gMocren1001"
,
FatalException
,
95
"Invalid length of the GDD file name"
);
96
}
97
std::strncat(
kG4GddViewerInvocation
, gddfname, len );
98
}
99
100
}
101
102
//----- G4GMocrenFileViewer, destructor
103
G4GMocrenFileViewer::~G4GMocrenFileViewer
()
104
{}
105
106
//----- G4GMocrenFileViewer::SetView ()
107
void
G4GMocrenFileViewer::SetView
()
108
{
109
if
(
GFDEBUG
)
110
if
(
G4VisManager::GetVerbosity
() >=
G4VisManager::errors
)
111
G4cout
<<
"***** G4GMocrenFileViewer::SetView(): No effects"
<<
G4endl
;
112
113
// Do nothing, since DAWN is running as a different process.
114
// SendViewParameters () will do this job instead.
115
}
116
117
118
//----- G4GMocrenFileViewer::ClearView()
119
void
120
G4GMocrenFileViewer::ClearView
(
void
)
121
{
122
if
(
GFDEBUG
)
123
if
(
G4VisManager::GetVerbosity
() >=
G4VisManager::errors
)
124
G4cout
<<
"***** G4GMocrenFileViewer::ClearView (): No effects "
<<
G4endl
;
125
126
//if(kSceneHandler.kGddDest) {
127
//kSceneHandler.kGddDest.close();
128
// Re-open with same filename...
129
//kSceneHandler.kGddDest.open(kSceneHandler.kGddFileName);
130
kSceneHandler
.
kFlagInModeling
=
false
;
131
kSceneHandler
.
GFBeginModeling
();
132
//}
133
}
134
135
136
//----- G4GMocrenFileViewer::DrawView ()
137
void
G4GMocrenFileViewer::DrawView
()
138
{
139
if
(
GFDEBUG
)
140
if
(
G4VisManager::GetVerbosity
() >=
G4VisManager::errors
)
141
G4cout
<<
"***** G4GMocrenFileViewer::DrawView () "
<<
G4endl
;
142
143
//-----
144
kSceneHandler
.
GFBeginModeling
() ;
145
146
//----- Always visit G4 kernel
147
NeedKernelVisit
();
148
149
//----- Draw
150
G4VViewer::ProcessView
() ;
151
152
}
// G4GMocrenFileViewer::DrawView ()
153
154
155
156
//----- G4GMocrenFileViewer::ShowView()
157
void
G4GMocrenFileViewer::ShowView
(
void
)
158
{
159
if
(
GFDEBUG
)
160
if
(
G4VisManager::GetVerbosity
() >=
G4VisManager::errors
)
161
G4cout
<<
"***** G4GMocrenFileViewer::ShowView () "
<<
G4endl
;
162
163
if
(
kSceneHandler
.
GFIsInModeling
() )
164
{
165
//----- End of modeling
166
// !EndModeling, !DrawAll, !CloseDevice,
167
// close g4.gdd
168
kSceneHandler
.
GFEndModeling
();
169
170
//----- Output DAWN GUI file
171
//SendViewParameters();
172
173
//----- string for viewer invocation
174
if
( !strcmp(
kG4GddViewer
,
"NONE"
) ) {
175
176
kG4GddViewerInvocation
[0] =
'\0'
;
177
//std::strcpy( kG4GddViewerInvocation, "" );
178
}
else
{
179
180
std::strncpy(
kG4GddViewerInvocation
,
kG4GddViewer
, std::strlen(
kG4GddViewer
));
181
std::strncat(
kG4GddViewerInvocation
,
" "
, 1);
182
const
char
* gddfname =
kSceneHandler
.
GetGddFileName
();
183
int
len = std::strlen(gddfname);
184
if
(len >= 64) {
185
G4Exception
(
"G4GMocrenFileViewer::ShowView()"
,
186
"gMocren1002"
,
FatalException
,
187
"Invalid length of the GDD file name"
);
188
}
189
std::strncat(
kG4GddViewerInvocation
, gddfname, len);
190
}
191
192
}
193
194
}
// G4GMocrenFileViewer::ShowView()
195
G4Scene.hh
G4GMocrenFileViewer::kG4GddViewerInvocation
char kG4GddViewerInvocation[64]
Definition:
G4GMocrenFileViewer.hh:65
G4VisManager.hh
G4GMocrenFileViewer::kG4GddViewer
char kG4GddViewer[32]
Definition:
G4GMocrenFileViewer.hh:64
G4InuclParticleNames::name
const char * name(G4int ptype)
Definition:
G4InuclParticleNames.hh:77
G4GMocrenFileViewer::G4GMocrenFileViewer
G4GMocrenFileViewer(G4GMocrenFileSceneHandler &scene, G4GMocrenMessenger &messenger, const G4String &name="")
Definition:
G4GMocrenFileViewer.cc:61
G4GMocrenMessenger
Definition:
G4GMocrenMessenger.hh:46
G4GMocrenFileSceneHandler.hh
G4GMocrenFileViewer::ShowView
void ShowView()
Definition:
G4GMocrenFileViewer.cc:157
G4GMocrenFile.hh
G4VisExtent.hh
G4cout
G4GLOB_DLL std::ostream G4cout
G4VViewer
Definition:
G4VViewer.hh:46
G4GMocrenFileViewer::kSceneHandler
G4GMocrenFileSceneHandler & kSceneHandler
Definition:
G4GMocrenFileViewer.hh:62
G4GMocrenFileViewer::DrawView
void DrawView()
Definition:
G4GMocrenFileViewer.cc:137
G4GMocrenFileSceneHandler::kFlagInModeling
G4bool kFlagInModeling
Definition:
G4GMocrenFileSceneHandler.hh:199
G4GMocrenFileViewer::ClearView
void ClearView()
Definition:
G4GMocrenFileViewer.cc:120
G4GMocrenFileSceneHandler::GetGddFileName
const char * GetGddFileName()
Definition:
G4GMocrenFileSceneHandler.hh:127
G4Exception
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition:
G4Exception.cc:41
G4LogicalVolume.hh
GFDEBUG
const bool GFDEBUG
Definition:
G4GMocrenFileViewer.cc:58
G4GMocrenFileSceneHandler::GFBeginModeling
void GFBeginModeling()
Definition:
G4GMocrenFileSceneHandler.cc:504
G4GMocrenFileViewer.hh
G4ios.hh
FatalException
Definition:
G4ExceptionSeverity.hh:60
G4GMocrenFileSceneHandler::GFEndModeling
void GFEndModeling()
Definition:
G4GMocrenFileSceneHandler.cc:781
G4VisManager::GetVerbosity
static Verbosity GetVerbosity()
Definition:
G4VisManager.cc:2284
G4VViewer::NeedKernelVisit
void NeedKernelVisit()
Definition:
G4VViewer.cc:78
G4GMocrenFileSceneHandler
Definition:
G4GMocrenFileSceneHandler.hh:54
G4GMocrenFileViewer::~G4GMocrenFileViewer
virtual ~G4GMocrenFileViewer()
Definition:
G4GMocrenFileViewer.cc:103
G4GMocrenMessenger.hh
G4VisManager::errors
Definition:
G4VisManager.hh:141
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4VViewer::ProcessView
void ProcessView()
Definition:
G4VViewer.cc:105
G4Vector3D.hh
G4VSolid.hh
G4GMocrenFileViewer::SetView
void SetView()
Definition:
G4GMocrenFileViewer.cc:107
G4GMocrenFileSceneHandler::GFIsInModeling
G4bool GFIsInModeling()
Definition:
G4GMocrenFileSceneHandler.hh:119
G4String
Definition:
G4String.hh:45
geant4.10.03
source
visualization
gMocren
src
G4GMocrenFileViewer.cc
Generated on Thu Feb 14 2002 02:29:28 for Geant4 by
1.8.8