![]() |
![]() |
#include <Iguana/GLModels/interface/Ig3DBaseRep.h>
Public Member Functions | |
virtual Ig3DBaseRep * | child (SbString name) const |
virtual Ig3DBaseRep * | child (int n) const |
virtual int | children (void) const |
virtual void | clear (void) |
virtual IgRepContext * | context (void) const |
virtual SoNode * | findMagic (SbName name) const |
Ig3DBaseRep (Ig3DBaseModel *model, Ig3DBaseRep *parent, Ig3DBaseRep *prev, SoGroup *node) | |
virtual SoGroup * | magic (SoGroup *node) |
virtual SoGroup * | magic (void) const |
virtual IgModel * | model (void) const |
virtual SoGroup * | node (SoGroup *node) |
virtual SoGroup * | node (void) const |
~Ig3DBaseRep (void) | |
Static Public Member Functions | |
static Ig3DBaseRep * | asRep (SoNode *node) |
Checked conversion of the node to a rep; use this whenever you wanted to do a dynamic_cast of a node to a rep. | |
Protected Member Functions | |
virtual void | context (IgRepContext *context) |
virtual void | zap (bool search=false, bool kill=true) |
Private Member Functions | |
Ig3DBaseRep (const Ig3DBaseRep &) | |
Ig3DBaseRep & | operator= (const Ig3DBaseRep &) |
Private Attributes | |
IgRepContext * | m_context |
Ig3DBaseModel * | m_model |
Definition at line 25 of file Ig3DBaseRep.h.
Ig3DBaseRep::Ig3DBaseRep | ( | Ig3DBaseModel * | model, | |
Ig3DBaseRep * | parent, | |||
Ig3DBaseRep * | prev, | |||
SoGroup * | node | |||
) |
Definition at line 57 of file Ig3DBaseRep.cc.
References Ig3DBaseModel::add(), ASSERT, Ig3DBaseModel::change(), index, and m_model.
00061 : m_context (0), 00062 m_model (model) 00063 { 00064 ASSERT (m_model); 00065 ASSERT (node); 00066 00067 // Ref myself -- I'll be pointed to from outside! 00068 ref (); 00069 00070 // Give myself a magic recognisable name. 00071 setName ("IGUANA_3D_REP"); 00072 00073 // Turn off render caching in intermediate nodes 00074 renderCaching = OFF; 00075 00076 // Add the magic group. 00077 ASSERT (getNumChildren () == 0); 00078 addChild (new SoGroup); 00079 00080 // Add the node. 00081 // ASSERT (node is a separator or switch, not a group!) 00082 addChild (node); 00083 00084 // Tell parent/model; this will broadcast a model change. 00085 ASSERT (! prev || parent); 00086 if (parent) 00087 { 00088 // If `prev' was given, insert right after it; otherwise make 00089 // this the first child (but skip the two non-rep children!). 00090 ASSERT (parent->findChild (this) == -1); 00091 ASSERT (parent->getNumChildren () >= 2); 00092 ASSERT (! prev || parent->findChild (prev) != -1); 00093 int index = prev ? parent->findChild (prev)+1 : 2; 00094 if (index < parent->getNumChildren ()) 00095 parent->insertChild (this, index); 00096 else 00097 parent->addChild (this); 00098 00099 m_model->change (parent); 00100 } 00101 else 00102 m_model->add (this); 00103 }
Ig3DBaseRep::~Ig3DBaseRep | ( | void | ) |
Definition at line 105 of file Ig3DBaseRep.cc.
References ASSERT, IgRepContext::erase(), m_context, m_model, IgRepContext::rep(), and zap().
00106 { 00107 // The destruction may come upon me in two ways: the object is 00108 // going away and the context is deleting me, or `zap' unref'd 00109 // myself (called from the parent). In the former case Inventor 00110 // reference count may not yet be zero and I have to remove myself 00111 // from the scene graph. Note however that I can never be deleted 00112 // by Inventor -- I ref'ed myself in the constructor. The only I 00113 // can die is via `zap', which is only called here, meaning that 00114 // either myself or one of my ancestors had its context deleted. 00115 // However if my context *was* deleted, I must not delete it 00116 // again; if so, it has already set its rep to null, which we use 00117 // as a clue. 00118 00119 // FIXME: `destroy()' does some useful work in Inventor, and it 00120 // isn't getting called for reps getting deleted via context 00121 // deletion. Is that a problem? 00122 00123 if (getRefCount () > 0) 00124 // NB: This cannot kill us again since the constructor ref'ed 00125 // myself, even though all Inventor references will go away. 00126 zap (true, false); 00127 00128 // Make sure `zap' has ran and cleaned up everything. 00129 ASSERT (getRefCount () == 0); 00130 ASSERT (! m_model); 00131 00132 // We should have no rep children now, `zap' removed them. My 00133 // parent class takes care of deleting the remaining children. 00134 ASSERT (getNumChildren () == 2); 00135 00136 // Make the context go away if we are not being deleted by it. 00137 ASSERT (m_context); 00138 if (m_context->rep ()) 00139 { 00140 ASSERT (m_context->rep () == this); 00141 m_context->erase (false); 00142 delete m_context; 00143 } 00144 }
Ig3DBaseRep::Ig3DBaseRep | ( | const Ig3DBaseRep & | ) | [private] |
Ig3DBaseRep * Ig3DBaseRep::asRep | ( | SoNode * | node | ) | [static] |
Checked conversion of the node to a rep; use this whenever you wanted to do a dynamic_cast
of a node to a rep.
Required for TGS brain-deadness, they refuse to build Inventor libraries for MSVC++ with RTTI, so we need another mechanism. This one avoids having to declare Ig3DBaseRep as a node type, but has the drawback in that it has no way of verifying whether the separator really is a rep or not -- we just hope it is.
Definition at line 29 of file Ig3DBaseRep.cc.
Referenced by Ig3DBaseBrowser::onDeselect(), Ig3DBaseBrowser::onPick(), and Ig3DBaseBrowser::onSelect().
00030 { 00031 return (node 00032 && node->isOfType (SoSeparator::getClassTypeId ()) 00033 && node->getName () == "IGUANA_3D_REP" 00034 ? static_cast<Ig3DBaseRep *> (node) : 0); 00035 }
Ig3DBaseRep * Ig3DBaseRep::child | ( | SbString | name | ) | const [virtual] |
Ig3DBaseRep * Ig3DBaseRep::child | ( | int | n | ) | const [virtual] |
Definition at line 205 of file Ig3DBaseRep.cc.
References ASSERT.
Referenced by child(), Ig2DModel::closestMatchName(), Ig2DModel::getLayer(), Ig2DRep::repositionChildren(), and Ig2DModel::setCutTransform().
00206 { 00207 ASSERT (i >= 0); 00208 ASSERT (getNumChildren () >= 2); 00209 ASSERT (i + 2 < getNumChildren ()); 00210 ASSERT (getChild (i+2) 00211 && getChild (i+2)->isOfType (Ig3DBaseRep::getClassTypeId ())); 00212 00213 return static_cast<Ig3DBaseRep *> (getChild (i+2)); 00214 }
Definition at line 198 of file Ig3DBaseRep.cc.
References ASSERT.
Referenced by child(), Ig2DRep::repositionChildren(), and Ig2DModel::setCutTransform().
00199 { 00200 ASSERT (getNumChildren () >= 2); 00201 return getNumChildren () - 2; 00202 }
Definition at line 281 of file Ig3DBaseRep.cc.
References ASSERT, and node().
Referenced by drawVolumeTwig(), MMM_DEFUN_FUNC(), VisHepMCProductTwig::update(), VisCSCSeg2HETwig::update(), VisGenMETTwig::update(), VisTkSimHitTwig::update(), VisTkRecTracksTwig::update(), VisDTDigiTwig::update(), VisHORecHitTwig::update(), VisPFRecHitTwig::update(), VisCSCStripDigiTwig::update(), VisCSCRecHit2DTwig::update(), VisEcalRecHitTwig::update(), VisRPCGeometryTwig::update(), VisPSimHitTwig::update(), VisPCaloHitTwig::update(), VisL1GlobalTriggerReadoutRecordTwig::update(), VisTrackerPiRechitTwig::update(), VisTrackerClusterTwig::update(), VisPFClusterTwig::update(), VisCSCALCTDigiTwig::update(), VisTrackerGeometryTwig::update(), VisTrajectorySeedTwig::update(), VisTrackerPiClusterTwig::update(), VisTkRecTrackDetsTwig::update(), VisPixelDigiTwig::update(), VisDT2DSegmentTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisGsfTrackTwig::update(), VisGenJetTwig::update(), VisCSCSegmentTwig::update(), VisCSCCorrelatedLCTDigiTwig::update(), VisCSCComparatorDigiTwig::update(), VisHBHERecHitTwig::update(), VisBasicClusterTwig::update(), VisRPCDigiTwig::update(), VisCaloMETTwig::update(), VisTrackerRechit2DTwig::update(), VisGsfPFRecTrackTwig::update(), VisTrackTwig::update(), VisHFRecHitTwig::update(), VisHFDataFrameTwig::update(), VisHcalDetTwig::update(), VisDetIvTwig::update(), VisSimVertexTwig::update(), VisTrackerPiDigiTwig::update(), VisTkIdealHelixTracksTwig::update(), VisCaloTowerTwig::update(), VisCaloJetTwig::update(), VisPFRecTrackTwig::update(), VisDTRecHitsTwig::update(), VisCSCCLCTDigiTwig::update(), VisMETTwig::update(), VisSuperClusterCollectionTwig::update(), VisBasicClusterCollectionTwig::update(), VisDetTextureTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisTrackingParticleTwig::update(), VisRPCRecHitTwig::update(), VisDT4DSegmentTwig::update(), VisCSCWireDigiTwig::update(), VisCuTkGeometryTwig::update(), VisCandidateTwig::update(), VisMuonTwig::update(), VisFEDRawDataCollectionTwig::update(), VisEventIdTwig::update(), VisDTGeometryTwig::update(), VisTkSimTrackTwig::update(), VisRefitTrackTwig::update(), VisQueuedTwig::update(), VisCSCGeometryTwig::update(), VisCaloGeometryTwig::update(), VisSimTrackTwig::update(), VisTrackingRecHitTwig::update(), VisMuonEnergyTwig::update(), VisTrackerDigiTwig::update(), VisSuperClusterTwig::update(), VisGenJetCollectionTwig::update(), and VisCSCRPCDigiTwig::update().
void Ig3DBaseRep::context | ( | IgRepContext * | context | ) | [protected, virtual] |
IgRepContext * Ig3DBaseRep::context | ( | void | ) | const [virtual] |
Implements IgRep.
Definition at line 189 of file Ig3DBaseRep.cc.
References m_context.
Referenced by Ig3DBaseBrowser::onSelect(), and Ig2DModel::setCutTransform().
00190 { return m_context; }
SoNode * Ig3DBaseRep::findMagic | ( | SbName | name | ) | const [virtual] |
Definition at line 250 of file Ig3DBaseRep.cc.
References j, magic(), and node().
Referenced by Ig3DAnimsCategory::deleteOne(), Ig3DLightsCategory::deleteOne(), IgSpareBrowser::drawGrid(), IgRPhiBrowser::drawGrid(), Ig3DBaseBrowser::Ig3DBaseBrowser(), IgRPhiBrowser::IgRPhiBrowser(), IgSpareBrowser::IgSpareBrowser(), Ig3DLightsCategory::lightTypeChanged(), Ig3DLightsCategory::makeOne(), Ig3DAnimsCategory::makeOne(), Ig3DLightsCategory::reconstruct(), Ig3DAnimsCategory::reconstruct(), Ig3DClipsCategory::reconstruct(), Ig3DGridCategory::reconstruct(), Ig3DSlicersCategory::reconstruct(), Ig3DViewpointsCategory::registerBrowser(), Ig2DRep::repositionChildren(), and Ig3DLightsCategory::toggleOne().
00251 { 00252 for (int j = 0; j < magic ()->getNumChildren (); j++) 00253 { 00254 SoNode *node = magic ()->getChild (j); 00255 if (node->getName () == name) 00256 return node; 00257 } 00258 return 0; 00259 }
SoGroup * Ig3DBaseRep::magic | ( | SoGroup * | node | ) | [virtual] |
Definition at line 239 of file Ig3DBaseRep.cc.
References ASSERT, Ig3DBaseModel::change(), and m_model.
00240 { 00241 ASSERT (getNumChildren () >= 2); 00242 ASSERT (getChild (0) && getChild (0)->isOfType(SoGroup::getClassTypeId())); 00243 ASSERT (node); 00244 replaceChild (0, node); 00245 m_model->change (this); 00246 return node; 00247 }
SoGroup * Ig3DBaseRep::magic | ( | void | ) | const [virtual] |
Definition at line 231 of file Ig3DBaseRep.cc.
References ASSERT.
Referenced by Ig3DAnimsCategory::buildDefaults(), Ig3DLightsCategory::buildDefaults(), IgSpareBrowser::drawGrid(), IgRPhiBrowser::drawGrid(), findMagic(), Ig2DModel::Ig2DModel(), Ig2DRep::Ig2DRep(), IgIVView::IgIVView(), Ig3DGridCategory::makeCustomOne(), Ig3DSlicersCategory::makeOne(), Ig3DClipsCategory::makeOne(), Ig3DGridCategory::makeOne(), MMM_DEFUN_FUNC(), Ig3DViewpointsCategory::registerBrowser(), Ig3DClipsCategory::repActiveClips(), Ig3DGridCategory::repActiveGrids(), Ig3DSlicersCategory::repActiveSlicers(), Ig3DClipsCategory::repAllClips(), Ig3DGridCategory::repAllGrids(), and Ig3DSlicersCategory::repAllSlicers().
00232 { 00233 ASSERT (getNumChildren () >= 2); 00234 ASSERT (getChild (0) && getChild (0)->isOfType(SoGroup::getClassTypeId())); 00235 return static_cast<SoGroup *> (getChild (0)); 00236 }
Implements IgRep.
Definition at line 193 of file Ig3DBaseRep.cc.
References m_model.
Referenced by MMM_DEFUN_FUNC(), Ig2DViewPropertiesCategory::setCuttingPlane(), and VisQueuedTwig::update().
00194 { return m_model; }
SoGroup * Ig3DBaseRep::node | ( | SoGroup * | node | ) | [virtual] |
Definition at line 270 of file Ig3DBaseRep.cc.
References ASSERT, Ig3DBaseModel::change(), and m_model.
00271 { 00272 ASSERT (getNumChildren () >= 2); 00273 ASSERT (getChild (1) && getChild (1)->isOfType(SoGroup::getClassTypeId())); 00274 ASSERT (node); 00275 replaceChild (1, node); 00276 m_model->change (this); 00277 return node; 00278 }
SoGroup * Ig3DBaseRep::node | ( | void | ) | const [virtual] |
Definition at line 262 of file Ig3DBaseRep.cc.
References ASSERT.
Referenced by child(), clear(), drawVolumeTwig(), findMagic(), Ig3DNodeCategory::focusIn(), IgIVView::IgIVView(), Ig3DGridCategory::makeCustomOne(), Ig3DSlicersCategory::makeOne(), Ig3DClipsCategory::makeOne(), Ig3DGridCategory::makeOne(), MMM_DEFUN_FUNC(), Ig2DRep::repositionChildren(), VisGenMETTwig::update(), VisCSCSeg2HETwig::update(), VisHORecHitTwig::update(), VisDTDigiTwig::update(), VisTkRecTracksTwig::update(), VisTkSimHitTwig::update(), VisRPCGeometryTwig::update(), VisEcalRecHitTwig::update(), VisCSCRecHit2DTwig::update(), VisCSCStripDigiTwig::update(), VisPFRecHitTwig::update(), VisTrackerGeometryTwig::update(), VisCSCALCTDigiTwig::update(), VisPFClusterTwig::update(), VisTrackerClusterTwig::update(), VisTrackerPiRechitTwig::update(), VisL1GlobalTriggerReadoutRecordTwig::update(), VisPCaloHitTwig::update(), VisPSimHitTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisDT2DSegmentTwig::update(), VisPixelDigiTwig::update(), VisTkRecTrackDetsTwig::update(), VisTrackerPiClusterTwig::update(), VisTrajectorySeedTwig::update(), VisBasicClusterTwig::update(), VisHBHERecHitTwig::update(), VisCSCComparatorDigiTwig::update(), VisCSCCorrelatedLCTDigiTwig::update(), VisCSCSegmentTwig::update(), VisGenJetTwig::update(), VisGsfTrackTwig::update(), VisCaloMETTwig::update(), VisRPCDigiTwig::update(), VisHcalDetTwig::update(), VisHFDataFrameTwig::update(), VisHFRecHitTwig::update(), VisTrackTwig::update(), VisGsfPFRecTrackTwig::update(), VisTrackerRechit2DTwig::update(), VisDetIvTwig::update(), VisDetTextureTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisMETTwig::update(), VisCSCCLCTDigiTwig::update(), VisDTRecHitsTwig::update(), VisPFRecTrackTwig::update(), VisCaloJetTwig::update(), VisCaloTowerTwig::update(), VisTkIdealHelixTracksTwig::update(), VisTrackerPiDigiTwig::update(), VisSimVertexTwig::update(), VisCuTkGeometryTwig::update(), VisCSCWireDigiTwig::update(), VisDT4DSegmentTwig::update(), VisRPCRecHitTwig::update(), VisTrackingParticleTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisMuonTwig::update(), VisCandidateTwig::update(), VisJetTagTwig::update(), VisG4TrackPtTwig::update(), VisDTGeometryTwig::update(), VisEventIdTwig::update(), VisCaloGeometryTwig::update(), VisCSCGeometryTwig::update(), VisQueuedTwig::update(), VisRefitTrackTwig::update(), VisTkSimTrackTwig::update(), VisTrackingRecHitTwig::update(), VisSimTrackTwig::update(), VisSuperClusterTwig::update(), VisTrackerDigiTwig::update(), VisCSCRPCDigiTwig::update(), VisGenJetCollectionTwig::update(), and zap().
00263 { 00264 ASSERT (getNumChildren () >= 2); 00265 ASSERT (getChild (1) && getChild (1)->isOfType(SoGroup::getClassTypeId())); 00266 return static_cast<SoGroup *> (getChild (1)); 00267 }
Ig3DBaseRep& Ig3DBaseRep::operator= | ( | const Ig3DBaseRep & | ) | [private] |
Definition at line 147 of file Ig3DBaseRep.cc.
References ASSERT, i, m_model, node(), and Ig3DBaseModel::remove().
Referenced by ~Ig3DBaseRep().
00148 { 00149 // Kill rep children. 00150 ASSERT (getNumChildren () >= 2); 00151 for (int i = getNumChildren () - 1; i >= 2; --i) 00152 { 00153 SoNode *node = getChild (i); 00154 ASSERT (node && node->isOfType (Ig3DBaseRep::getClassTypeId ())); 00155 00156 // Get it off the list; since we ref reps in the constructor, 00157 // this isn't fatal... 00158 removeChild (i); 00159 00160 // ... but this is -- blast it away. 00161 static_cast<Ig3DBaseRep *> (node)->zap (); 00162 } 00163 00164 // Make sure model knows I am gone. If I am not being zapped by 00165 // my parent, `search' will be true and the model will make sure 00166 // no references remain to me. 00167 m_model->remove (this, search); 00168 m_model = 0; 00169 00170 // ... and make the fatal unref (unless we are being called from 00171 // the destructor, in which case just let it finish its job). 00172 ASSERT (getRefCount () == 1); 00173 if (kill) 00174 unref (); 00175 else 00176 unrefNoDelete (); 00177 }
IgRepContext* Ig3DBaseRep::m_context [private] |
Ig3DBaseModel* Ig3DBaseRep::m_model [private] |
Definition at line 59 of file Ig3DBaseRep.h.
Referenced by Ig3DBaseRep(), magic(), model(), node(), zap(), and ~Ig3DBaseRep().