ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1TrackSystems
src
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
15
#include "
VP1TrackSystems/AssociatedObjectHandleBase.h
"
16
#include "
VP1TrackSystems/TrackHandleBase.h
"
17
#include "
VP1TrackSystems/TrackCollHandleBase.h
"
18
#include "
VP1TrackSystems/TrackSysCommonData.h
"
19
#include "
VP1TrackSystems/AscObjSelectionManager.h
"
20
#include "
VP1TrackSystems/VP1TrackSystem.h
"
21
#include "
VP1Base/VP1Msg.h
"
22
23
#include <Inventor/nodes/SoSeparator.h>
24
#include <optional>
25
26
//____________________________________________________________________
27
class
AssociatedObjectHandleBase::Imp
{
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
;
37
AssocObjAttachmentHandle
*
attachhandle
;
38
39
//SoTransform * transform;
40
void
detach
()
const
;
41
void
attach
(
AssociatedObjectHandleBase
* theclass );
42
void
ensureShapesBuild
(
AssociatedObjectHandleBase
* theclass );
43
void
ensureShapesErased
(
AssociatedObjectHandleBase
* theclass );
44
};
45
46
int
AssociatedObjectHandleBase::Imp::nascobjs
= 0;
47
48
//____________________________________________________________________
49
void
AssociatedObjectHandleBase::Imp::ensureShapesBuild
(
AssociatedObjectHandleBase
* theclass )
50
{
51
if
(
sep_simple
&&
sep_detailed
)
52
return
;
53
if
(!
sep_simple
&&!
sep_detailed
) {
54
theclass->
buildShapes
(
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
) {
65
sep_detailed
=
sep_simple
;
66
sep_detailed
->ref();
67
}
68
if
(!
sep_simple
) {
69
sep_simple
=
sep_detailed
;
70
sep_simple
->ref();
71
}
72
73
theclass->
registerShapes
(
sep_simple
,
sep_detailed
);
74
}
75
76
//____________________________________________________________________
77
void
AssociatedObjectHandleBase::Imp::ensureShapesErased
(
AssociatedObjectHandleBase
* theclass )
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
{
95
m_trackHandle
->collHandle()->common()->ascObjSelectionManager()->registerAscObj(simple,detailed,
this
);
96
}
97
98
//____________________________________________________________________
99
void
AssociatedObjectHandleBase::unregisterShapes
(SoSeparator*simple,SoSeparator*detailed)
100
{
101
m_trackHandle
->collHandle()->common()->ascObjSelectionManager()->unregisterAscObj(simple,detailed);
102
}
103
104
//____________________________________________________________________
105
TrackSysCommonData
*
AssociatedObjectHandleBase::common
()
const
106
{
107
return
m_trackHandle
->common();
108
}
109
110
//____________________________________________________________________
111
AssociatedObjectHandleBase::AssociatedObjectHandleBase
(
TrackHandleBase
*th)
112
:
m_d
(new
Imp
),
m_trackHandle
(th),
m_visible
(false),
m_pickStyle
(
UNPICKABLE
/*better default?*/
)
113
{
114
++
Imp::nascobjs
;
115
}
116
117
//____________________________________________________________________
118
AssociatedObjectHandleBase::~AssociatedObjectHandleBase
()
119
{
120
if
(
m_d
->attachhandle&&
m_visible
&&
m_d
->sep_simple&&
m_d
->sep_detailed) {
121
m_d
->attachhandle->detachNodes(
m_d
->sep_simple,
m_d
->sep_detailed);
122
}
123
m_d
->ensureShapesErased(
this
);
124
delete
m_d
;
125
--
Imp::nascobjs
;
126
127
}
128
129
//____________________________________________________________________
130
int
AssociatedObjectHandleBase::numberOfInstances
()
131
{
132
return
Imp::nascobjs
;
133
}
134
135
//____________________________________________________________________
136
void
AssociatedObjectHandleBase::setPickable
(
PICKSTYLE
ps )
137
{
138
if
(
m_pickStyle
==ps)
139
return
;
140
m_pickStyle
=ps;
141
142
//Fixme...
143
144
}
145
146
//____________________________________________________________________
147
void
AssociatedObjectHandleBase::Imp::detach
()
const
148
{
149
if
(!
attachhandle
)
150
return
;
//Can't have been attached.
151
attachhandle
->detachNodes(
sep_simple
,
sep_detailed
);
152
}
153
154
//____________________________________________________________________
155
AssocObjAttachmentHandle
*
AssociatedObjectHandleBase::getAttachmentHandle
()
156
{
157
return
m_trackHandle
->getAttachmentHandle(
regionIndex
(),
lodCrossOverValue
());
158
}
159
160
161
//____________________________________________________________________
162
void
AssociatedObjectHandleBase::Imp::attach
(
AssociatedObjectHandleBase
* theclass )
163
{
164
if
(!
attachhandle
)
165
attachhandle
= theclass->
getAttachmentHandle
();
166
attachhandle
->attachNodes(
sep_simple
,
sep_detailed
,(theclass->
pickStyle
()!=
UNPICKABLE
));
167
}
168
169
170
//____________________________________________________________________
171
void
AssociatedObjectHandleBase::setVisible
(
bool
b )
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
//____________________________________________________________________
185
void
AssociatedObjectHandleBase::update3DObjects
()
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
//____________________________________________________________________
200
SoSeparator*
AssociatedObjectHandleBase::shapeSimple
()
const
201
{
202
return
m_d
->sep_simple;
203
}
204
205
//____________________________________________________________________
206
SoSeparator*
AssociatedObjectHandleBase::shapeDetailed
()
const
207
{
208
return
m_d
->sep_detailed;
209
}
AscObjSelectionManager.h
AssociatedObjectHandleBase.h
TrackCollHandleBase.h
TrackHandleBase.h
TrackSysCommonData.h
VP1Msg.h
VP1TrackSystem.h
AssocObjAttachmentHandle
Definition
TrackHandleBase.h:203
AssociatedObjectHandleBase::Imp
Definition
AssociatedObjectHandleBase.cxx:27
AssociatedObjectHandleBase::Imp::detach
void detach() const
Definition
AssociatedObjectHandleBase.cxx:147
AssociatedObjectHandleBase::Imp::ensureShapesBuild
void ensureShapesBuild(AssociatedObjectHandleBase *theclass)
Definition
AssociatedObjectHandleBase.cxx:49
AssociatedObjectHandleBase::Imp::sep_simple
SoSeparator * sep_simple
Definition
AssociatedObjectHandleBase.cxx:35
AssociatedObjectHandleBase::Imp::attach
void attach(AssociatedObjectHandleBase *theclass)
Definition
AssociatedObjectHandleBase.cxx:162
AssociatedObjectHandleBase::Imp::attachhandle
AssocObjAttachmentHandle * attachhandle
Definition
AssociatedObjectHandleBase.cxx:37
AssociatedObjectHandleBase::Imp::ensureShapesErased
void ensureShapesErased(AssociatedObjectHandleBase *theclass)
Definition
AssociatedObjectHandleBase.cxx:77
AssociatedObjectHandleBase::Imp::sep_detailed
SoSeparator * sep_detailed
Definition
AssociatedObjectHandleBase.cxx:36
AssociatedObjectHandleBase::Imp::nascobjs
static int nascobjs
Definition
AssociatedObjectHandleBase.cxx:29
AssociatedObjectHandleBase::Imp::Imp
Imp()
Definition
AssociatedObjectHandleBase.cxx:30
AssociatedObjectHandleBase::setPickable
void setPickable(PICKSTYLE)
Definition
AssociatedObjectHandleBase.cxx:136
AssociatedObjectHandleBase::shapeSimple
SoSeparator * shapeSimple() const
Definition
AssociatedObjectHandleBase.cxx:200
AssociatedObjectHandleBase::PICKSTYLE
PICKSTYLE
Definition
AssociatedObjectHandleBase.h:57
AssociatedObjectHandleBase::UNPICKABLE
@ UNPICKABLE
Definition
AssociatedObjectHandleBase.h:57
AssociatedObjectHandleBase::numberOfInstances
static int numberOfInstances()
Definition
AssociatedObjectHandleBase.cxx:130
AssociatedObjectHandleBase::AssociatedObjectHandleBase
AssociatedObjectHandleBase(TrackHandleBase *)
Definition
AssociatedObjectHandleBase.cxx:111
AssociatedObjectHandleBase::pickStyle
PICKSTYLE pickStyle() const
Definition
AssociatedObjectHandleBase.h:59
AssociatedObjectHandleBase::m_pickStyle
PICKSTYLE m_pickStyle
Definition
AssociatedObjectHandleBase.h:95
AssociatedObjectHandleBase::registerShapes
void registerShapes(SoSeparator *simple, SoSeparator *detailed)
Definition
AssociatedObjectHandleBase.cxx:93
AssociatedObjectHandleBase::setVisible
virtual void setVisible(bool)
Definition
AssociatedObjectHandleBase.cxx:171
AssociatedObjectHandleBase::update3DObjects
void update3DObjects()
Definition
AssociatedObjectHandleBase.cxx:185
AssociatedObjectHandleBase::~AssociatedObjectHandleBase
virtual ~AssociatedObjectHandleBase()
Definition
AssociatedObjectHandleBase.cxx:118
AssociatedObjectHandleBase::m_trackHandle
TrackHandleBase * m_trackHandle
Definition
AssociatedObjectHandleBase.h:93
AssociatedObjectHandleBase::regionIndex
virtual int regionIndex() const
Definition
AssociatedObjectHandleBase.h:81
AssociatedObjectHandleBase::getAttachmentHandle
AssocObjAttachmentHandle * getAttachmentHandle()
Definition
AssociatedObjectHandleBase.cxx:155
AssociatedObjectHandleBase::common
TrackSysCommonData * common() const
Definition
AssociatedObjectHandleBase.cxx:105
AssociatedObjectHandleBase::buildShapes
virtual void buildShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)=0
AssociatedObjectHandleBase::m_visible
bool m_visible
Definition
AssociatedObjectHandleBase.h:94
AssociatedObjectHandleBase::m_d
Imp * m_d
Definition
AssociatedObjectHandleBase.h:91
AssociatedObjectHandleBase::TrackHandleBase
friend class TrackHandleBase
Definition
AssociatedObjectHandleBase.h:101
AssociatedObjectHandleBase::shapeDetailed
SoSeparator * shapeDetailed() const
Definition
AssociatedObjectHandleBase.cxx:206
AssociatedObjectHandleBase::unregisterShapes
void unregisterShapes(SoSeparator *simple, SoSeparator *detailed)
Definition
AssociatedObjectHandleBase.cxx:99
AssociatedObjectHandleBase::lodCrossOverValue
virtual double lodCrossOverValue() const
Definition
AssociatedObjectHandleBase.h:82
TrackSysCommonData
Definition
TrackSysCommonData.h:50
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition
VP1Msg.cxx:84
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition
VP1Msg.cxx:39
Generated on
for ATLAS Offline Software by
1.17.0