G4VGraphicsSystem.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // John Allison  27th March 1996
00031 // Abstract interface class for graphics systems.
00032 
00033 #include "G4VGraphicsSystem.hh"
00034 
00035 #include "G4VisManager.hh"
00036 
00037 G4VGraphicsSystem::~G4VGraphicsSystem () {}
00038 
00039 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
00040                                       Functionality f):
00041   fName (name),
00042   fNickname (""),
00043   fDescription (""),
00044   fFunctionality (f) {}
00045 
00046 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
00047                                       const G4String& nickname,
00048                                       Functionality f):
00049   fName (name),
00050   fNickname (nickname),
00051   fDescription (""),
00052   fFunctionality (f) {}
00053 
00054 G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
00055                                       const G4String& nickname,
00056                                       const G4String& description,
00057                                       Functionality f):
00058   fName (name),
00059   fNickname (nickname),
00060   fDescription (description),
00061   fFunctionality (f) {}
00062 
00063 G4bool G4VGraphicsSystem::IsUISessionCompatible () const
00064 {
00065   return true;
00066 }
00067 
00068 std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) {
00069   G4VisManager* pVMan = G4VisManager::GetInstance ();
00070   const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
00071   os << "Graphics System: " << gs.GetName ();
00072   if (gs.GetNickname () != "") {
00073     os << ", nickname: " << gs.GetNickname ();
00074   }
00075   if (gs.GetDescription () != "") {
00076     os << "\n  Description: " << gs.GetDescription ();
00077   }
00078   os << "\n  Functionality: " << G4int(gs.GetFunctionality());
00079   if (pVMan -> GetVerbosity() >= G4VisManager::parameters) {
00080     size_t nScenes = scenes.size ();
00081     if (nScenes) {
00082       G4int nScenesOfThisSystem = 0;
00083       for (size_t i = 0; i < nScenes; i++) {
00084         if (scenes [i] -> GetGraphicsSystem () == &gs) {
00085           nScenesOfThisSystem++;
00086         }
00087       }
00088       if (nScenesOfThisSystem) {
00089         os << "\n  Its scenes are: ";
00090         for (size_t i = 0; i < nScenes; i++) {
00091           if (scenes [i] -> GetGraphicsSystem () == &gs) {
00092             os << "\n  " << *(scenes [i]);
00093           }
00094         }
00095       }
00096       else {
00097         os << "\n  It has no scenes at present.";
00098       }
00099     }
00100     else {
00101       os << "\n  There are no scenes instantiated at present.";
00102     }
00103   }
00104   return os;
00105 }

Generated on Mon May 27 17:50:13 2013 for Geant4 by  doxygen 1.4.7