Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4VGraphicsSystem.cc,v 1.10 2003/06/16 17:14:16 gunter Exp $ >> 25 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 27 // 26 // 28 // 27 // 29 // John Allison 27th March 1996 28 // John Allison 27th March 1996 30 // Abstract interface class for graphics syste 29 // Abstract interface class for graphics systems. 31 30 32 #include "G4VGraphicsSystem.hh" 31 #include "G4VGraphicsSystem.hh" 33 32 34 #include "G4VisManager.hh" 33 #include "G4VisManager.hh" 35 34 36 G4VGraphicsSystem::~G4VGraphicsSystem () {} 35 G4VGraphicsSystem::~G4VGraphicsSystem () {} 37 36 38 G4VGraphicsSystem::G4VGraphicsSystem (const G4 37 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, 39 Functionality f): 38 Functionality f): 40 fName (name), 39 fName (name), 41 fDescription ("No description"), << 40 fNickname (""), 42 fFunctionality (f) << 41 fDescription (""), 43 { << 42 fFunctionality (f) {} 44 fNicknames.push_back("No Nickname"); << 45 } << 46 43 47 G4VGraphicsSystem::G4VGraphicsSystem (const G4 44 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, 48 const G4String& nickname, 45 const G4String& nickname, 49 Functionality f): 46 Functionality f): 50 fName (name), 47 fName (name), 51 fDescription ("No description"), << 48 fNickname (nickname), 52 fFunctionality (f) << 49 fDescription (""), 53 { << 50 fFunctionality (f) {} 54 fNicknames.push_back(nickname); << 55 } << 56 51 57 G4VGraphicsSystem::G4VGraphicsSystem (const G4 52 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name, 58 const G4String& nickname, 53 const G4String& nickname, 59 const G4String& description, 54 const G4String& description, 60 Functionality f): 55 Functionality f): 61 fName (name), 56 fName (name), >> 57 fNickname (nickname), 62 fDescription (description), 58 fDescription (description), 63 fFunctionality (f) << 59 fFunctionality (f) {} 64 { << 65 fNicknames.push_back(nickname); << 66 } << 67 << 68 G4bool G4VGraphicsSystem::IsUISessionCompatibl << 69 { << 70 return true; << 71 } << 72 << 73 std::ostream& operator << (std::ostream& os, c << 74 { << 75 os << "Graphics System: " << gs.GetName (); << 76 os << ", nicknames:"; for (const auto& nickn << 77 {os << ' ' << nickname;} << 78 os << "\n Description: " << gs.GetDescripti << 79 os << "\n Functionality: "; << 80 switch (gs.GetFunctionality()) { << 81 case G4VGraphicsSystem::noFunctionality: << 82 os << "None"; << 83 break; << 84 case G4VGraphicsSystem::nonEuclidian: << 85 os << "nonEuclidian, e.g., tree represen << 86 break; << 87 case G4VGraphicsSystem::twoD: << 88 os << "twoD: Simple 2D, e.g., X (no stor << 89 break; << 90 case G4VGraphicsSystem::twoDStore: << 91 os << "twoDStore: 2D with stored structu << 92 break; << 93 case G4VGraphicsSystem::threeD: << 94 os << "threeD: Passive 3D (with stored s << 95 break; << 96 case G4VGraphicsSystem::threeDInteractive: << 97 os << "threeDInteractive: 3D with mouse << 98 break; << 99 case G4VGraphicsSystem::virtualReality: << 100 os << "virtualReality"; << 101 break; << 102 case G4VGraphicsSystem::fileWriter: << 103 os << "fileWriter"; << 104 break; << 105 default: << 106 os << "unknown"; << 107 break; << 108 } << 109 60 >> 61 std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) { 110 G4VisManager* pVMan = G4VisManager::GetInsta 62 G4VisManager* pVMan = G4VisManager::GetInstance (); 111 const G4SceneHandlerList& scenes = pVMan -> 63 const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers (); >> 64 os << "Graphics System: " << gs.GetName (); >> 65 if (gs.GetNickname () != "") { >> 66 os << ", nickname: " << gs.GetNickname (); >> 67 } >> 68 if (gs.GetDescription () != "") { >> 69 os << "\n Description: " << gs.GetDescription (); >> 70 } >> 71 os << "\n Functionality: " << G4int(gs.GetFunctionality()); 112 if (pVMan -> GetVerbosity() >= G4VisManager: 72 if (pVMan -> GetVerbosity() >= G4VisManager::parameters) { 113 size_t nScenes = scenes.size (); 73 size_t nScenes = scenes.size (); 114 if (nScenes) { 74 if (nScenes) { 115 G4int nScenesOfThisSystem = 0; 75 G4int nScenesOfThisSystem = 0; 116 for (size_t i = 0; i < nScenes; i++) { 76 for (size_t i = 0; i < nScenes; i++) { 117 if (scenes [i] -> GetGraphicsSystem () << 77 if (scenes [i] -> GetGraphicsSystem () == &gs) { 118 nScenesOfThisSystem++; << 78 nScenesOfThisSystem++; 119 } << 79 } 120 } 80 } 121 if (nScenesOfThisSystem) { 81 if (nScenesOfThisSystem) { 122 os << "\n Its scenes are: "; << 82 os << "\n Its scenes are: "; 123 for (size_t i = 0; i < nScenes; i++) { << 83 for (size_t i = 0; i < nScenes; i++) { 124 if (scenes [i] -> GetGraphicsSystem << 84 if (scenes [i] -> GetGraphicsSystem () == &gs) { 125 os << "\n " << *(scenes [i]); << 85 os << "\n " << *(scenes [i]); 126 } << 86 } 127 } << 87 } 128 } 88 } 129 else { 89 else { 130 os << "\n It has no scenes at present << 90 os << "\n It has no scenes at present."; 131 } 91 } 132 } 92 } 133 else { 93 else { 134 os << "\n There are no scenes instantia 94 os << "\n There are no scenes instantiated at present."; 135 } 95 } 136 } 96 } 137 << 138 return os; 97 return os; 139 } 98 } 140 99