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,v 1.11 2006/06/29 21:29:22 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // John Allison 27th March 1996 |
---|
32 | // Abstract interface class for graphics systems. |
---|
33 | |
---|
34 | #include "G4VGraphicsSystem.hh" |
---|
35 | |
---|
36 | #include "G4VisManager.hh" |
---|
37 | |
---|
38 | G4VGraphicsSystem::~G4VGraphicsSystem () {} |
---|
39 | |
---|
40 | G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, |
---|
41 | Functionality f): |
---|
42 | fName (name), |
---|
43 | fNickname (""), |
---|
44 | fDescription (""), |
---|
45 | fFunctionality (f) {} |
---|
46 | |
---|
47 | G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, |
---|
48 | const G4String& nickname, |
---|
49 | Functionality f): |
---|
50 | fName (name), |
---|
51 | fNickname (nickname), |
---|
52 | fDescription (""), |
---|
53 | fFunctionality (f) {} |
---|
54 | |
---|
55 | G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, |
---|
56 | const G4String& nickname, |
---|
57 | const G4String& description, |
---|
58 | Functionality f): |
---|
59 | fName (name), |
---|
60 | fNickname (nickname), |
---|
61 | fDescription (description), |
---|
62 | fFunctionality (f) {} |
---|
63 | |
---|
64 | std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) { |
---|
65 | G4VisManager* pVMan = G4VisManager::GetInstance (); |
---|
66 | const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers (); |
---|
67 | os << "Graphics System: " << gs.GetName (); |
---|
68 | if (gs.GetNickname () != "") { |
---|
69 | os << ", nickname: " << gs.GetNickname (); |
---|
70 | } |
---|
71 | if (gs.GetDescription () != "") { |
---|
72 | os << "\n Description: " << gs.GetDescription (); |
---|
73 | } |
---|
74 | os << "\n Functionality: " << G4int(gs.GetFunctionality()); |
---|
75 | if (pVMan -> GetVerbosity() >= G4VisManager::parameters) { |
---|
76 | size_t nScenes = scenes.size (); |
---|
77 | if (nScenes) { |
---|
78 | G4int nScenesOfThisSystem = 0; |
---|
79 | for (size_t i = 0; i < nScenes; i++) { |
---|
80 | if (scenes [i] -> GetGraphicsSystem () == &gs) { |
---|
81 | nScenesOfThisSystem++; |
---|
82 | } |
---|
83 | } |
---|
84 | if (nScenesOfThisSystem) { |
---|
85 | os << "\n Its scenes are: "; |
---|
86 | for (size_t i = 0; i < nScenes; i++) { |
---|
87 | if (scenes [i] -> GetGraphicsSystem () == &gs) { |
---|
88 | os << "\n " << *(scenes [i]); |
---|
89 | } |
---|
90 | } |
---|
91 | } |
---|
92 | else { |
---|
93 | os << "\n It has no scenes at present."; |
---|
94 | } |
---|
95 | } |
---|
96 | else { |
---|
97 | os << "\n There are no scenes instantiated at present."; |
---|
98 | } |
---|
99 | } |
---|
100 | return os; |
---|
101 | } |
---|