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