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 #include "G4RayTracerSceneHandler.hh" 00030 #include "G4VisManager.hh" 00031 00032 G4RayTracerSceneHandler::G4RayTracerSceneHandler(G4VGraphicsSystem& system, 00033 const G4String& name): 00034 G4VSceneHandler(system, fSceneIdCount++, name) 00035 { 00036 // Ray Tracer does not use the vis concept of scene (G4Scene) - keep 00037 // vis manager happy when someone opens a ray tracer with "/vis/open 00038 // RayTracer" but uses the ray tracer with "/vis/rayTracer" commands 00039 // before creating any scenes, for example, instead of using 00040 // "/vis/drawVolume"... 00041 G4VisManager* visManager = G4VisManager::GetInstance(); 00042 if(visManager) { 00043 G4Scene* pScene = visManager->GetCurrentScene(); 00044 if (!pScene) { 00045 // Create new scene like /vis/scene/create... 00046 fpScene = new G4Scene("dummy-ray-tracer-scene"); 00047 // Add dummy run-duration model to avoid world being added and 00048 // notifyHandler being invoked... 00049 fpScene->AddWorldIfEmpty(); 00050 // Add to vis manager list; ownership thereby passes to vis manager... 00051 visManager->SetSceneList().push_back(fpScene); 00052 // ...and make current... 00053 visManager->SetCurrentScene(fpScene); 00054 } 00055 } 00056 } 00057 00058 G4RayTracerSceneHandler::~G4RayTracerSceneHandler() 00059 {} 00060 00061 G4int G4RayTracerSceneHandler::fSceneIdCount = 0;