Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TVirtualGeoPainter.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 11/01/02
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TVirtualGeoPainter
13 \ingroup Geometry_classes
14 
15 Abstract class for geometry painters
16 */
17 
18 #include "TROOT.h"
19 #include "TVirtualGeoPainter.h"
20 #include "TPluginManager.h"
21 #include "TGeoManager.h"
22 
23 TVirtualGeoPainter *TVirtualGeoPainter::fgGeoPainter = 0;
24 
25 ClassImp(TVirtualGeoPainter);
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Geometry painter default constructor
29 
30 TVirtualGeoPainter::TVirtualGeoPainter(TGeoManager *)
31 {
32 }
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Geometry painter default destructor
36 
37 TVirtualGeoPainter::~TVirtualGeoPainter()
38 {
39  fgGeoPainter = 0;
40 }
41 
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Static function returning a pointer to the geometry painter.
45 /// The painter will paint objects from the specified geometry.
46 /// If the geometry painter does not exist a default painter is created.
47 
48 TVirtualGeoPainter *TVirtualGeoPainter::GeoPainter()
49 {
50  // if no painter set yet, create a default painter via the PluginManager
51  if (!fgGeoPainter) {
52  TPluginHandler *h;
53  if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualGeoPainter"))) {
54  if (h->LoadPlugin() == -1)
55  return 0;
56  fgGeoPainter = (TVirtualGeoPainter*)h->ExecPlugin(1,gGeoManager);
57  }
58  }
59  return fgGeoPainter;
60 }
61 
62 ////////////////////////////////////////////////////////////////////////////////
63 /// Static function to set an alternative histogram painter.
64 
65 void TVirtualGeoPainter::SetPainter(const TVirtualGeoPainter *painter)
66 {
67  fgGeoPainter = (TVirtualGeoPainter*)painter;
68 }