145{
146
147
148
149
150
151
152
153
154
155 assert(sw->getNumChildren()==2);
156
157 assert(sw->getChild(1)->getTypeId()==SoSeparator::getClassTypeId());
158
159 SoNode* shape = static_cast<SoShape*>(sw->getChild(0));
160 SoSeparator*
sep =
static_cast<SoSeparator*
>(sw->getChild(1));
161
162
163 if (sw->whichChild.getValue() != 0)
164 sw->whichChild = 0;
165
166
167 if (shape->getTypeId()==SoTubs::getClassTypeId()) {
168 m_d->volaroundZ_tubs[sw] = std::pair<SoTubs*,SoSeparator*>(
static_cast<SoTubs*
>(shape),sep);
169 } else if (shape->getTypeId()==SoPcons::getClassTypeId()) {
170 m_d->volaroundZ_pcons[sw] = std::pair<SoPcons*,SoSeparator*>(
static_cast<SoPcons*
>(shape),sep);
171 } else if (shape->getTypeId()==SoCons::getClassTypeId()) {
172 m_d->volaroundZ_cons[sw] = std::pair<SoCons*,SoSeparator*>(
static_cast<SoCons*
>(shape),sep);
173 } else {
174 assert(shape->getTypeId()==SoLAr::getClassTypeId());
175 m_d->volaroundZ_lar[sw] = std::pair<SoLAr*,SoSeparator*>(
static_cast<SoLAr*
>(shape),sep);
176 }
177
178
179 SbVec3f unitz (0.0f, 0.0f, 1.0f);
180 SbVec3f transfunitz;
181
182 SbVec3f translation; SbRotation
rotation; SbVec3f scaleFactor; SbRotation scaleOrientation;
183 transf.getTransform (translation, rotation, scaleFactor, scaleOrientation);
184
185 rotation.multVec(unitz,transfunitz);
186
188 transfunitz.getValue(
x,
y,
z);
189
190 bool rotaroundy = (
z<0&&std::fabs(
x)*10<std::fabs(
z));
191
192
193 SbVec3f unitx (1.0f, 0.0f, 0.0f);
194 SbVec3f transfunitx;
195 rotation.multVec(unitx,transfunitx);
196 transfunitx.getValue(
x,
y,
z);
198 m_d->volaroundZ_switch2transfinfo[sw] = std::pair<double,bool>(phirot,rotaroundy);
199
200
201 if (
m_d->subsysflag_2_volAroundZSepHelper.find(flag)!=
m_d->subsysflag_2_volAroundZSepHelper.end())
202 return m_d->subsysflag_2_volAroundZSepHelper[
flag];
203
204 SoSeparator * subsyssep_volaroundZ = new SoSeparator;
205 assert(
m_d->subsysflag2sep.find(flag)!=
m_d->subsysflag2sep.end());
206 m_d->subsysflag2sep[
flag]->addChild(subsyssep_volaroundZ);
207
208 subsyssep_volaroundZ->ref();
209 VP1ExtraSepLayerHelper * sephelper = new VP1ExtraSepLayerHelper(subsyssep_volaroundZ);
210 m_d->subsysflag_2_volAroundZSepHelper[
flag] = sephelper;
211 return sephelper;
212}