Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VGraphicsSystem.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: G4VGraphicsSystem.cc 99418 2016-09-21 09:18:42Z gcosmo $
28 //
29 //
30 // John Allison 27th March 1996
31 // Abstract interface class for graphics systems.
32 
33 #include "G4VGraphicsSystem.hh"
34 
35 #include "G4VisManager.hh"
36 
38 
40  Functionality f):
41  fName (name),
42  fDescription ("No description"),
43  fFunctionality (f)
44 {
45  fNicknames.push_back("No Nickname");
46 }
47 
49  const G4String& nickname,
50  Functionality f):
51  fName (name),
52  fDescription ("No description"),
53  fFunctionality (f)
54 {
55  fNicknames.push_back(nickname);
56 }
57 
59  const G4String& nickname,
60  const G4String& description,
61  Functionality f):
62  fName (name),
63  fDescription (description),
64  fFunctionality (f)
65 {
66  fNicknames.push_back(nickname);
67 }
68 
70 {
71  return true;
72 }
73 
74 std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs)
75 {
76  os << "Graphics System: " << gs.GetName ();
77  os << ", nicknames:"; for (const auto& nickname: gs.GetNicknames())
78  {os << ' ' << nickname;}
79  os << "\n Description: " << gs.GetDescription ();
80  os << "\n Functionality: ";
81  switch (gs.GetFunctionality()) {
83  os << "None";
84  break;
86  os << "nonEuclidian, e.g., tree representation of geometry hierarchy.";
87  break;
89  os << "twoD: Simple 2D, e.g., X (no stored structures).";
90  break;
92  os << "twoDStore: 2D with stored structures.";
93  break;
95  os << "threeD: Passive 3D (with stored structures)";
96  break;
98  os << "threeDInteractive: 3D with \"pick\" functionality.";
99  break;
101  os << "virtualReality";
102  break;
104  os << "fileWriter";
105  break;
106  default:
107  os << "unknown";
108  break;
109  }
110 
112  const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
113  if (pVMan -> GetVerbosity() >= G4VisManager::parameters) {
114  size_t nScenes = scenes.size ();
115  if (nScenes) {
116  G4int nScenesOfThisSystem = 0;
117  for (size_t i = 0; i < nScenes; i++) {
118  if (scenes [i] -> GetGraphicsSystem () == &gs) {
119  nScenesOfThisSystem++;
120  }
121  }
122  if (nScenesOfThisSystem) {
123  os << "\n Its scenes are: ";
124  for (size_t i = 0; i < nScenes; i++) {
125  if (scenes [i] -> GetGraphicsSystem () == &gs) {
126  os << "\n " << *(scenes [i]);
127  }
128  }
129  }
130  else {
131  os << "\n It has no scenes at present.";
132  }
133  }
134  else {
135  os << "\n There are no scenes instantiated at present.";
136  }
137  }
138 
139  return os;
140 }
const XML_Char * name
Definition: expat.h:151
std::vector< G4String > fNicknames
const std::vector< G4String > & GetNicknames() const
G4String fName
Definition: G4AttUtils.hh:55
int G4int
Definition: G4Types.hh:78
virtual G4bool IsUISessionCompatible() const
bool G4bool
Definition: G4Types.hh:79
static G4VisManager * GetInstance()
G4VGraphicsSystem(const G4String &name, Functionality f)
virtual ~G4VGraphicsSystem()
const G4String & GetName() const
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
const G4String & GetDescription() const
Functionality GetFunctionality() const