00001 // @(#)root/geom:$Id: TVirtualGeoPainter.cxx 21494 2007-12-19 15:50:40Z brun $ 00002 // Author: Andrei Gheata 11/01/02 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 //______________________________________________________________________________ 00013 // TVirtualGeoPainter 00014 // ================== 00015 // ABC for geometry painters 00016 //______________________________________________________________________________ 00017 00018 #include "TROOT.h" 00019 #include "TVirtualGeoPainter.h" 00020 #include "TPluginManager.h" 00021 #include "TGeoManager.h" 00022 00023 TVirtualGeoPainter *TVirtualGeoPainter::fgGeoPainter = 0; 00024 00025 ClassImp(TVirtualGeoPainter) 00026 00027 //______________________________________________________________________________ 00028 TVirtualGeoPainter::TVirtualGeoPainter(TGeoManager *) 00029 { 00030 //*-*-*-*-*-*-*-*-*-*-*Geometry painter default constructor*-*-*-*-*-*-*-*-* 00031 //*-* ==================================== 00032 } 00033 00034 //______________________________________________________________________________ 00035 TVirtualGeoPainter::~TVirtualGeoPainter() 00036 { 00037 //*-*-*-*-*-*-*-*-*-*-*Geometry painter default destructor*-*-*-*-*-*-*-*-* 00038 //*-* =================================== 00039 00040 fgGeoPainter = 0; 00041 } 00042 00043 00044 //______________________________________________________________________________ 00045 TVirtualGeoPainter *TVirtualGeoPainter::GeoPainter() 00046 { 00047 // Static function returning a pointer to the geometry painter. 00048 // The painter will paint objects from the specified geometry. 00049 // If the geometry painter does not exist a default painter is created. 00050 00051 // if no painter set yet, create a default painter via the PluginManager 00052 if (!fgGeoPainter) { 00053 TPluginHandler *h; 00054 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualGeoPainter"))) { 00055 if (h->LoadPlugin() == -1) 00056 return 0; 00057 fgGeoPainter = (TVirtualGeoPainter*)h->ExecPlugin(1,gGeoManager); 00058 } 00059 } 00060 return fgGeoPainter; 00061 } 00062 00063 //______________________________________________________________________________ 00064 void TVirtualGeoPainter::SetPainter(const TVirtualGeoPainter *painter) 00065 { 00066 // Static function to set an alternative histogram painter. 00067 00068 fgGeoPainter = (TVirtualGeoPainter*)painter; 00069 }