ATLAS Offline Software
Loading...
Searching...
No Matches
VolumeHandleSharedData Class Reference

#include <VolumeHandleSharedData.h>

Collaboration diagram for VolumeHandleSharedData:

Classes

class  Imp

Public Member Functions

 VolumeHandleSharedData (GeoSysController *controller, VP1GeoFlags::SubSystemFlag, std::map< SoSeparator *, VolumeHandle * > *sonodesep2volhandle, const GeoPVConstLink &motherpV, PhiSectorManager *, SoMaterial *topMaterial, MatVisAttributes *, VolVisAttributes *, ZappedVolumeListModel *, VP1GeoTreeView *, SoSeparator *, std::optional< SbColor > outlineColour=std::nullopt)
 ~VolumeHandleSharedData ()
void ref ()
void unref ()
GeoPVConstLink geoPVConstLinkOfTreeTopsMother () const
PhiSectorManager * phiSectorManager () const
VP1GeoFlags::SubSystemFlag subSystemFlag () const
SoMaterial * fallBackTopLevelMaterial () const
VP1GeoTreeView * volumeBrowser () const
MatVisAttributes * matVisAttributes () const
VolVisAttributes * volVisAttributes () const
SoSeparator * textSep () const
GeoSysController * controller () const
void addZappedVolumeToGui (VolumeHandle *)
void removeZappedVolumesFromGui (VolumeHandle *)
SoNode * toShapeNode (const GeoPVConstLink &pV)
SoNode * getSoCylinderOrientedLikeGeoTube (const double &radius, const double &halfLength)
void registerNodeSepForVolumeHandle (SoSeparator *, VolumeHandle *)

Static Public Member Functions

static void setShowVolumeOutlines (SoGroup *nodesep, bool showvol)

Private Member Functions

 VolumeHandleSharedData (const VolumeHandleSharedData &)
VolumeHandleSharedData & operator= (const VolumeHandleSharedData &)

Private Attributes

Imp * m_d
VP1GeoTreeView * m_volumebrowser
SoSeparator * m_textSep
 base text sep

Detailed Description

Definition at line 27 of file VolumeHandleSharedData.h.

Constructor & Destructor Documentation

◆ VolumeHandleSharedData() [1/2]

VolumeHandleSharedData::VolumeHandleSharedData ( GeoSysController * controller,
VP1GeoFlags::SubSystemFlag flag,
std::map< SoSeparator *, VolumeHandle * > * sonodesep2volhandle,
const GeoPVConstLink & motherpV,
PhiSectorManager * psm,
SoMaterial * topMaterial,
MatVisAttributes * matVisAttributes,
VolVisAttributes * volVisAttributes,
ZappedVolumeListModel * zappedvolumelistmodel,
VP1GeoTreeView * volbrowser,
SoSeparator * textSep,
std::optional< SbColor > outlineColour = std::nullopt )

Definition at line 45 of file VolumeHandleSharedData.cxx.

51 : m_d(new Imp), m_volumebrowser(volbrowser), m_textSep(textSep)
52{
53 m_d->ref = 0;
54 m_d->controller=controller;
55 m_d->sonodesep2volhandle = sonodesep2volhandle;
56 m_d->motherpV = motherpV;
57 m_d->phisectormanager = psm;
58 m_d->subsysflag = flag;
59 m_d->topMaterial = topMaterial;
60 if (outlineColour) {
62 m_d->outlineColour = new SoOutlineColour;
63 m_d->outlineColour->ref();
64 m_d->outlineColour->colour = *outlineColour;
65 }
66 m_d->matVisAttributes = matVisAttributes;
67 m_d->volVisAttributes = volVisAttributes;
68 m_d->zappedvolumelistmodel = zappedvolumelistmodel;
69}
static void initClass()
SoSeparator * textSep() const
SoSeparator * m_textSep
base text sep
GeoSysController * controller() const
VolVisAttributes * volVisAttributes() const
MatVisAttributes * matVisAttributes() const
bool flag
Definition master.py:29

◆ ~VolumeHandleSharedData()

VolumeHandleSharedData::~VolumeHandleSharedData ( )

Definition at line 72 of file VolumeHandleSharedData.cxx.

73{
74 std::map<const GeoLogVol *, SoShape *>::iterator it, itE = m_d->logvol2shape.end();
75 for (it=m_d->logvol2shape.begin();it!=itE;++it) {
76 if (it->second)
77 it->second->unref();
78 }
79 std::map<double, SoNode *>::iterator it2, it2E = m_d->id2shape.end();
80 for (it2=m_d->id2shape.begin();it2!=it2E;++it2) {
81 if (it2->second)
82 it2->second->unref();
83 }
84 if (m_d->outlineColour)
85 m_d->outlineColour->unref();
86 delete m_d; m_d=0;
87}

◆ VolumeHandleSharedData() [2/2]

VolumeHandleSharedData::VolumeHandleSharedData ( const VolumeHandleSharedData & )
private

Member Function Documentation

◆ addZappedVolumeToGui()

void VolumeHandleSharedData::addZappedVolumeToGui ( VolumeHandle * handle)

Definition at line 237 of file VolumeHandleSharedData.cxx.

238{
239 m_d->zappedvolumelistmodel->addToZappedVolumes(handle);
240}

◆ controller()

GeoSysController * VolumeHandleSharedData::controller ( ) const

Definition at line 134 of file VolumeHandleSharedData.cxx.

135{
136 return m_d->controller;
137}

◆ fallBackTopLevelMaterial()

SoMaterial * VolumeHandleSharedData::fallBackTopLevelMaterial ( ) const

Definition at line 116 of file VolumeHandleSharedData.cxx.

117{
118 return m_d->topMaterial;
119}

◆ geoPVConstLinkOfTreeTopsMother()

GeoPVConstLink VolumeHandleSharedData::geoPVConstLinkOfTreeTopsMother ( ) const

Definition at line 231 of file VolumeHandleSharedData.cxx.

232{
233 return m_d->motherpV;
234}

◆ getSoCylinderOrientedLikeGeoTube()

SoNode * VolumeHandleSharedData::getSoCylinderOrientedLikeGeoTube ( const double & radius,
const double & halfLength )

Definition at line 209 of file VolumeHandleSharedData.cxx.

210{
211 double id = radius - 9999.0*halfLength;
212 std::map<double, SoNode *>::iterator it = m_d->id2shape.find(id);
213 if (it!=m_d->id2shape.end())
214 return it->second;
215
216 SoGroup * group = new SoGroup;
217 SoRotationXYZ * rot = new SoRotationXYZ;
218 rot->axis.setValue(SoRotationXYZ::X);
219 rot->angle.setValue(M_PI*0.5f);
220 group->addChild(rot);
221 SoCylinder * cyl = new SoCylinder;
222 cyl->radius.setValue(radius);
223 cyl->height.setValue(2.0*halfLength);
224 group->addChild(cyl);
225 group->ref();
226 m_d->id2shape[id]=group;
227 return group;
228}
#define M_PI

◆ matVisAttributes()

MatVisAttributes * VolumeHandleSharedData::matVisAttributes ( ) const

Definition at line 104 of file VolumeHandleSharedData.cxx.

105{
106 return m_d->matVisAttributes;
107}

◆ operator=()

VolumeHandleSharedData & VolumeHandleSharedData::operator= ( const VolumeHandleSharedData & )
private

◆ phiSectorManager()

PhiSectorManager * VolumeHandleSharedData::phiSectorManager ( ) const

Definition at line 128 of file VolumeHandleSharedData.cxx.

129{
130 return m_d->phisectormanager;
131}

◆ ref()

void VolumeHandleSharedData::ref ( )

Definition at line 90 of file VolumeHandleSharedData.cxx.

91{
92 ++(m_d->ref);
93}

◆ registerNodeSepForVolumeHandle()

void VolumeHandleSharedData::registerNodeSepForVolumeHandle ( SoSeparator * n,
VolumeHandle * vh )

Definition at line 140 of file VolumeHandleSharedData.cxx.

141{
142 assert(m_d->sonodesep2volhandle->find(n)==m_d->sonodesep2volhandle->end());
143 (*(m_d->sonodesep2volhandle))[n]=vh;
144 // The volume separator scopes this optional colour to its own geometry.
145 if (m_d->outlineColour)
146 n->insertChild(m_d->outlineColour, 0);
147 setShowVolumeOutlines(n,m_d->controller->showVolumeOutLines());
148}
static void setShowVolumeOutlines(SoGroup *nodesep, bool showvol)

◆ removeZappedVolumesFromGui()

void VolumeHandleSharedData::removeZappedVolumesFromGui ( VolumeHandle * handle)

Definition at line 243 of file VolumeHandleSharedData.cxx.

244{
245 m_d->zappedvolumelistmodel->removeFromZappedVolumes(handle);
246}

◆ setShowVolumeOutlines()

void VolumeHandleSharedData::setShowVolumeOutlines ( SoGroup * nodesep,
bool showvol )
static

Definition at line 151 of file VolumeHandleSharedData.cxx.

152{
153 for (int i = 0; i<nodegroup->getNumChildren();++i) {
154 SoNode * n = nodegroup->getChild(i);
155 if (n->getTypeId().isDerivedFrom(SoOutlineColour::getClassTypeId())) {
156 auto* colour = static_cast<SoOutlineColour*>(n);
157 if (colour->enabled.getValue() != showvol)
158 colour->enabled = showvol;
159 } else if (n->getTypeId().isDerivedFrom(SoGenericBox::getClassTypeId())) {
160 if (static_cast<SoGenericBox*>(n)->drawEdgeLines.getValue()!=showvol)
161 static_cast<SoGenericBox*>(n)->drawEdgeLines.setValue(showvol);
162 } else if (n->getTypeId().isDerivedFrom(SoTubs::getClassTypeId())) {
163 if (static_cast<SoTubs*>(n)->drawEdgeLines.getValue()!=showvol){
164 static_cast<SoTubs*>(n)->drawEdgeLines.setValue(showvol);
165 }
166 } else if (n->getTypeId().isDerivedFrom(SoPcons::getClassTypeId())) {
167 if (static_cast<SoPcons*>(n)->drawEdgeLines.getValue()!=showvol){
168 static_cast<SoPcons*>(n)->drawEdgeLines.setValue(showvol);
169 }
170 } else if (n->getTypeId().isDerivedFrom(SoTessellated::getClassTypeId())) {
171 if (static_cast<SoTessellated*>(n)->drawEdgeLines.getValue()!=showvol){
172 static_cast<SoTessellated*>(n)->drawEdgeLines.setValue(showvol);
173 }
174 } else if (n->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
175 setShowVolumeOutlines(static_cast<SoGroup*>(n),showvol);
176 }
177 }
178}

◆ subSystemFlag()

VP1GeoFlags::SubSystemFlag VolumeHandleSharedData::subSystemFlag ( ) const

Definition at line 122 of file VolumeHandleSharedData.cxx.

123{
124 return m_d->subsysflag;
125}

◆ textSep()

SoSeparator * VolumeHandleSharedData::textSep ( ) const
inline

Definition at line 46 of file VolumeHandleSharedData.h.

46{return m_textSep;}

◆ toShapeNode()

SoNode * VolumeHandleSharedData::toShapeNode ( const GeoPVConstLink & pV)

Definition at line 181 of file VolumeHandleSharedData.cxx.

182{
183 const GeoLogVol * logVolume = pV->getLogVol();
184
185 // if shape already stored for this volume, return that
186 SoShape * shape (0);
187 std::map<const GeoLogVol *, SoShape *>::iterator itShape = m_d->logvol2shape.find(logVolume);
188 if (itShape!=m_d->logvol2shape.end()) {
189 return itShape->second;
190 }
191
192 const GeoShape * geoshape = logVolume->getShape();
193
194 m_d->visaction.reset();
195 if (geoshape->typeID()==GeoShapeShift::getClassTypeID()) {
196 dynamic_cast<const GeoShapeShift*>(geoshape)->getOp()->exec(&(m_d->visaction));
197 //NB: the transformation part of the GeoShapeShift will be applied elsewhere
198 } else {
199 geoshape->exec(&(m_d->visaction));
200 }
201 shape = m_d->visaction.getShape();
202 if (shape)
203 shape->ref();
204 m_d->logvol2shape[logVolume] = shape;
205 return shape;
206}

◆ unref()

void VolumeHandleSharedData::unref ( )

Definition at line 96 of file VolumeHandleSharedData.cxx.

97{
98 --(m_d->ref);
99 if (!m_d->ref)
100 delete this;
101}

◆ volumeBrowser()

VP1GeoTreeView * VolumeHandleSharedData::volumeBrowser ( ) const
inline

Definition at line 43 of file VolumeHandleSharedData.h.

43{ return m_volumebrowser; }

◆ volVisAttributes()

VolVisAttributes * VolumeHandleSharedData::volVisAttributes ( ) const

Definition at line 110 of file VolumeHandleSharedData.cxx.

111{
112 return m_d->volVisAttributes;
113}

Member Data Documentation

◆ m_d

Imp* VolumeHandleSharedData::m_d
private

Definition at line 66 of file VolumeHandleSharedData.h.

◆ m_textSep

SoSeparator* VolumeHandleSharedData::m_textSep
private

base text sep

Definition at line 70 of file VolumeHandleSharedData.h.

◆ m_volumebrowser

VP1GeoTreeView* VolumeHandleSharedData::m_volumebrowser
private

Definition at line 69 of file VolumeHandleSharedData.h.


The documentation for this class was generated from the following files: