VGM Version 5.3
Loading...
Searching...
No Matches
SolidMap.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The RootGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
12//
13// Class SolidMap
14// ---------------
15// The map between VGM and Root solids.
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
19#include "VGM/solids/ISolid.h"
20
22
23#include "TGeoShape.h"
24
25RootGM::SolidMap* RootGM::SolidMap::fgInstance = 0;
26
27//_____________________________________________________________________________
29{
31
32 if (!fgInstance) new RootGM::SolidMap();
33
34 return fgInstance;
35}
36
37//_____________________________________________________________________________
38RootGM::SolidMap::SolidMap() : fRootSolids(), fVgmSolids()
39{
41
42 fgInstance = this;
43}
44
45//_____________________________________________________________________________
47{
49}
50
51//_____________________________________________________________________________
53{
54 //
55 fgInstance = 0;
56}
57
58//_____________________________________________________________________________
59void RootGM::SolidMap::AddSolid(VGM::ISolid* iSolid, TGeoShape* rootSolid)
60{
62
63 fRootSolids[iSolid] = rootSolid;
64 fVgmSolids[rootSolid] = iSolid;
65}
66
67//_____________________________________________________________________________
69 VGM::ISolid* iSolid, TGeoShape* rootSolid)
70{
72
73 fRootSolids[iSolid] = rootSolid;
74}
75
76//_____________________________________________________________________________
78 VGM::ISolid* iSolid, TGeoShape* rootSolid)
79{
81
82 fVgmSolids[rootSolid] = iSolid;
83}
84
85//_____________________________________________________________________________
86TGeoShape* RootGM::SolidMap::GetSolid(VGM::ISolid* iSolid) const
87{
89
90 RootSolidMapCIterator i = fRootSolids.find(iSolid);
91 if (i != fRootSolids.end())
92 return (*i).second;
93 else
94 return 0;
95}
96
97//_____________________________________________________________________________
98VGM::ISolid* RootGM::SolidMap::GetSolid(TGeoShape* rootSolid) const
99{
101
102 VgmSolidMapCIterator i = fVgmSolids.find(rootSolid);
103 if (i != fVgmSolids.end())
104 return (*i).second;
105 else
106 return 0;
107}
The map between VGM and Root solids.
Definition SolidMap.h:36
TGeoShape * GetSolid(VGM::ISolid *iSolid) const
Definition SolidMap.cxx:86
virtual ~SolidMap()
Definition SolidMap.cxx:52
void AddSolidInRootMapOnly(VGM::ISolid *, TGeoShape *)
Definition SolidMap.cxx:68
void AddSolid(VGM::ISolid *, TGeoShape *)
Definition SolidMap.cxx:59
VgmSolidMap::const_iterator VgmSolidMapCIterator
Definition SolidMap.h:42
void AddSolidInVGMMapOnly(VGM::ISolid *, TGeoShape *)
Definition SolidMap.cxx:77
RootSolidMap::const_iterator RootSolidMapCIterator
Definition SolidMap.h:39
static SolidMap * Instance()
Definition SolidMap.cxx:28
The VGM interface to solids.
Definition ISolid.h:58