ATLAS Offline Software
AssociatedObjectHandleBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Implementation of class AssociatedObjectHandleBase //
9 // //
10 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11 // Initial version: March 2008 //
12 // //
14 
21 #include "VP1Base/VP1Msg.h"
22 
23 #include <Inventor/nodes/SoSeparator.h>
24 #include <optional>
25 
26 //____________________________________________________________________
28 public:
29  static int nascobjs;
30  Imp() : sep_simple(nullptr),
31  sep_detailed(nullptr),
32  attachhandle(nullptr)
33  //,transform(0)
34  {}
35  SoSeparator * sep_simple;
36  SoSeparator * sep_detailed;
38 
39  //SoTransform * transform;
40  void detach() const;
41  void attach(AssociatedObjectHandleBase * theclass );
44 };
45 
47 
48 //____________________________________________________________________
50 {
52  return;
53  if (!sep_simple&&!sep_detailed) {
55  if (!sep_simple&&!sep_detailed) {
56  VP1Msg::messageDebug("AssociatedObjectHandleBase WARNING: Got null shapes! Replacing with simple points.");
57  sep_simple = new SoSeparator;//Fixme: Shared point!!!
58  }
59  if (sep_simple)
60  sep_simple->ref();
61  if (sep_detailed)
62  sep_detailed->ref();
63  }
64  if (!sep_detailed) {
66  sep_detailed->ref();
67  }
68  if (!sep_simple) {
70  sep_simple->ref();
71  }
72 
74 }
75 
76 //____________________________________________________________________
78 {
79  if (sep_simple||sep_detailed) {
80  theclass->unregisterShapes(sep_simple,sep_detailed);
81  if (sep_simple) {
82  sep_simple->unref();
83  sep_simple = nullptr;
84  }
85  if (sep_detailed) {
86  sep_detailed->unref();
87  sep_detailed = nullptr;
88  }
89  }
90 }
91 
92 //____________________________________________________________________
93 void AssociatedObjectHandleBase::registerShapes(SoSeparator*simple,SoSeparator*detailed)
94 {
96 }
97 
98 //____________________________________________________________________
99 void AssociatedObjectHandleBase::unregisterShapes(SoSeparator*simple,SoSeparator*detailed)
100 {
102 }
103 
104 //____________________________________________________________________
106 {
107  return m_trackHandle->common();
108 }
109 
110 //____________________________________________________________________
112  : m_d(new Imp),m_trackHandle(th), m_visible(false), m_pickStyle(UNPICKABLE/*better default?*/)
113 {
114  ++Imp::nascobjs;
115 }
116 
117 //____________________________________________________________________
119 {
122  }
123  m_d->ensureShapesErased(this );
124  delete m_d;
125  --Imp::nascobjs;
126 
127 }
128 
129 //____________________________________________________________________
131 {
132  return Imp::nascobjs;
133 }
134 
135 //____________________________________________________________________
137 {
138  if (m_pickStyle==ps)
139  return;
140  m_pickStyle=ps;
141 
142  //Fixme...
143 
144 }
145 
146 //____________________________________________________________________
148 {
149  if (!attachhandle)
150  return;//Can't have been attached.
152 }
153 
154 //____________________________________________________________________
156 {
158 }
159 
160 
161 //____________________________________________________________________
163 {
164  if (!attachhandle)
165  attachhandle = theclass->getAttachmentHandle();
166  attachhandle->attachNodes(sep_simple,sep_detailed,(theclass->pickStyle()!=UNPICKABLE));
167 }
168 
169 
170 //____________________________________________________________________
172 {
173  if (m_visible==b)
174  return;
175  m_visible=b;
176  if (b) {
177  m_d->ensureShapesBuild(this);
178  m_d->attach(this);
179  } else {
180  m_d->detach();
181  }
182 }
183 
184 //____________________________________________________________________
186 {
187  VP1Msg::messageVerbose("AssociatedObjectHandleBase update3DObjects.");
188 
189  if (m_visible) {
190  m_d->detach();
191  m_d->ensureShapesErased(this);
192  m_d->ensureShapesBuild(this);
193  m_d->attach(this);
194  } else {
195  m_d->ensureShapesErased(this);
196  }
197 }
198 
199 //____________________________________________________________________
201 {
202  return m_d->sep_simple;
203 }
204 
205 //____________________________________________________________________
207 {
208  return m_d->sep_detailed;
209 }
AssociatedObjectHandleBase::m_d
Imp * m_d
Definition: AssociatedObjectHandleBase.h:81
AssociatedObjectHandleBase::UNPICKABLE
@ UNPICKABLE
Definition: AssociatedObjectHandleBase.h:48
AscObjSelectionManager::registerAscObj
void registerAscObj(SoSeparator *simple, SoSeparator *detailed, AssociatedObjectHandleBase *)
Definition: AscObjSelectionManager.cxx:140
AssociatedObjectHandleBase
Definition: AssociatedObjectHandleBase.h:33
TrackCollHandleBase.h
AssociatedObjectHandleBase::lodCrossOverValue
virtual double lodCrossOverValue() const
Definition: AssociatedObjectHandleBase.h:73
AssociatedObjectHandleBase::Imp::Imp
Imp()
Definition: AssociatedObjectHandleBase.cxx:30
AssociatedObjectHandleBase::Imp
Definition: AssociatedObjectHandleBase.cxx:27
AssociatedObjectHandleBase::Imp::attach
void attach(AssociatedObjectHandleBase *theclass)
Definition: AssociatedObjectHandleBase.cxx:162
AssociatedObjectHandleBase::regionIndex
virtual int regionIndex() const
Definition: AssociatedObjectHandleBase.h:72
AssociatedObjectHandleBase::m_trackHandle
TrackHandleBase * m_trackHandle
Definition: AssociatedObjectHandleBase.h:84
VP1Msg.h
TrackHandleBase.h
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
TrackHandleBase::collHandle
TrackCollHandleBase * collHandle() const
Definition: TrackHandleBase.h:68
AssociatedObjectHandleBase::Imp::attachhandle
AssocObjAttachmentHandle * attachhandle
Definition: AssociatedObjectHandleBase.cxx:37
TrackSysCommonData::ascObjSelectionManager
AscObjSelectionManager * ascObjSelectionManager() const
Definition: TrackSysCommonData.h:115
AssociatedObjectHandleBase::update3DObjects
void update3DObjects()
Definition: AssociatedObjectHandleBase.cxx:185
AssocObjAttachmentHandle::detachNodes
void detachNodes(SoNode *simple, SoNode *detailed)
Definition: TrackHandleBase.cxx:1903
TrackSysCommonData.h
AssociatedObjectHandleBase::Imp::detach
void detach() const
Definition: AssociatedObjectHandleBase.cxx:147
AssociatedObjectHandleBase::Imp::sep_detailed
SoSeparator * sep_detailed
Definition: AssociatedObjectHandleBase.cxx:36
AssociatedObjectHandleBase::~AssociatedObjectHandleBase
virtual ~AssociatedObjectHandleBase()
Definition: AssociatedObjectHandleBase.cxx:118
AssociatedObjectHandleBase::getAttachmentHandle
AssocObjAttachmentHandle * getAttachmentHandle()
Definition: AssociatedObjectHandleBase.cxx:155
AssociatedObjectHandleBase::setPickable
void setPickable(PICKSTYLE)
Definition: AssociatedObjectHandleBase.cxx:136
python.TriggerHandler.th
th
Definition: TriggerHandler.py:296
AssociatedObjectHandleBase::pickStyle
PICKSTYLE pickStyle() const
Definition: AssociatedObjectHandleBase.h:50
AssociatedObjectHandleBase::m_visible
bool m_visible
Definition: AssociatedObjectHandleBase.h:85
TrackSysCommonData
Definition: TrackSysCommonData.h:47
AssociatedObjectHandleBase.h
AssociatedObjectHandleBase::common
TrackSysCommonData * common() const
Definition: AssociatedObjectHandleBase.cxx:105
AssocObjAttachmentHandle::attachNodes
void attachNodes(SoNode *simple, SoNode *detailed, bool unpickable)
Definition: TrackHandleBase.cxx:1768
AssociatedObjectHandleBase::m_pickStyle
PICKSTYLE m_pickStyle
Definition: AssociatedObjectHandleBase.h:86
AssocObjAttachmentHandle
Definition: TrackHandleBase.h:197
AssociatedObjectHandleBase::PICKSTYLE
PICKSTYLE
Definition: AssociatedObjectHandleBase.h:48
AssociatedObjectHandleBase::Imp::sep_simple
SoSeparator * sep_simple
Definition: AssociatedObjectHandleBase.cxx:35
AssociatedObjectHandleBase::buildShapes
virtual void buildShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)=0
AssociatedObjectHandleBase::unregisterShapes
void unregisterShapes(SoSeparator *simple, SoSeparator *detailed)
Definition: AssociatedObjectHandleBase.cxx:99
AssociatedObjectHandleBase::numberOfInstances
static int numberOfInstances()
Definition: AssociatedObjectHandleBase.cxx:130
AscObjSelectionManager.h
AssociatedObjectHandleBase::setVisible
virtual void setVisible(bool)
Definition: AssociatedObjectHandleBase.cxx:171
TrackHandleBase::common
TrackSysCommonData * common() const
Definition: TrackHandleBase.cxx:255
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
AssociatedObjectHandleBase::Imp::ensureShapesBuild
void ensureShapesBuild(AssociatedObjectHandleBase *theclass)
Definition: AssociatedObjectHandleBase.cxx:49
AscObjSelectionManager::unregisterAscObj
void unregisterAscObj(SoSeparator *simple, SoSeparator *detailed)
Definition: AscObjSelectionManager.cxx:164
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
AssociatedObjectHandleBase::Imp::ensureShapesErased
void ensureShapesErased(AssociatedObjectHandleBase *theclass)
Definition: AssociatedObjectHandleBase.cxx:77
AssociatedObjectHandleBase::shapeSimple
SoSeparator * shapeSimple() const
Definition: AssociatedObjectHandleBase.cxx:200
TrackHandleBase::getAttachmentHandle
AssocObjAttachmentHandle * getAttachmentHandle(int regionIndex, const double &crossoverval)
Definition: TrackHandleBase.cxx:1451
AssociatedObjectHandleBase::shapeDetailed
SoSeparator * shapeDetailed() const
Definition: AssociatedObjectHandleBase.cxx:206
TrackCollHandleBase::common
TrackSysCommonData * common() const
Definition: TrackCollHandleBase.h:79
TrackHandleBase
Definition: TrackHandleBase.h:56
AssociatedObjectHandleBase::Imp::nascobjs
static int nascobjs
Definition: AssociatedObjectHandleBase.cxx:29
AssociatedObjectHandleBase::AssociatedObjectHandleBase
AssociatedObjectHandleBase(TrackHandleBase *)
Definition: AssociatedObjectHandleBase.cxx:111
AssociatedObjectHandleBase::registerShapes
void registerShapes(SoSeparator *simple, SoSeparator *detailed)
Definition: AssociatedObjectHandleBase.cxx:93
VP1TrackSystem.h