Go to the documentation of this file.00001 #include "Fireworks/Core/src/FWGeoTopNodeScene.h"
00002 #include "Fireworks/Core/interface/FWGeoTopNode.h"
00003 #include "Fireworks/Core/interface/fwLog.h"
00004 #include "TGLSelectRecord.h"
00005 #include "TGLPhysicalShape.h"
00006 #include "TGLLogicalShape.h"
00007 #include "TGeoVolume.h"
00008 #include "TEveManager.h"
00009 #include "TEveSelection.h"
00010 #include "TBuffer3D.h"
00011
00012
00013
00014 FWGeoTopNodeGLScene::FWGeoTopNodeGLScene(TVirtualPad* pad) :
00015 TGLScenePad(pad),
00016
00017 m_eveTopNode(0)
00018 {
00019
00020
00021 fTitle="GeoTopNodeScene";
00022 }
00023
00024
00025 Bool_t FWGeoTopNodeGLScene::OpenCompositeWithPhyID(UInt_t phyID, const TBuffer3D& buffer)
00026 {
00027
00028
00029
00030
00031 if (fComposite) {
00032 Error("FWGeoTopNodeGLScene::OpenComposite", "composite already open");
00033 return kFALSE;
00034 }
00035
00036 UInt_t extraSections = TGLScenePad::AddObject(phyID, buffer, 0);
00037 if (extraSections != TBuffer3D::kNone) {
00038 Error("FWGeoTopNodeGLScene::OpenComposite", "expected top level composite to not require extra buffer sections");
00039 }
00040
00041
00042
00043 if (fComposite) {
00044 return kTRUE;
00045 } else {
00046 return kFALSE;
00047 }
00048 }
00049
00050
00051 Int_t FWGeoTopNodeGLScene::AddObject(const TBuffer3D& buffer, Bool_t* addChildren)
00052 {
00053 if (fComposite)
00054 {
00055
00056 int ns = TGLScenePad::AddObject(1, buffer, addChildren);
00057 return ns;
00058 }
00059 else
00060 {
00061 fwLog(fwlog::kError)<< "FWGeoTopNodeGLScene::AddObject() should not be called if fNextCompositeID \n";
00062 return TGLScenePad::AddObject(buffer, addChildren);
00063 }
00064 }
00065
00066
00067 Bool_t FWGeoTopNodeGLScene::ResolveSelectRecord(TGLSelectRecord& rec, Int_t curIdx)
00068 {
00069
00070
00071
00072
00073
00074
00075 if (curIdx >= rec.GetN())
00076 return kFALSE;
00077
00078 TGLPhysicalShape* pshp = FindPhysical(rec.GetItem(curIdx));
00079
00080
00081
00082
00083
00084
00085 if (pshp)
00086 {
00087 rec.SetTransparent(pshp->IsTransparent());
00088 rec.SetPhysShape(pshp);
00089
00090 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,32,0)
00091 rec.SetLogShape(FindLogical(m_eveTopNode));
00092 #endif
00093 rec.SetObject(m_eveTopNode);
00094 rec.SetSpecific(0);
00095 return kTRUE;
00096 }
00097 return kFALSE;
00098 }
00099
00100
00101 Int_t FWGeoTopNodeGLScene::DestroyPhysicals()
00102 {
00103
00104
00105
00106 if (gEve->GetSelection()->HasChild( m_eveTopNode))
00107 gEve->GetSelection()->RemoveElement( m_eveTopNode);
00108
00109 if (gEve->GetHighlight()->HasChild( m_eveTopNode))
00110 gEve->GetHighlight()->RemoveElement( m_eveTopNode);
00111
00112
00113 return TGLScene::DestroyPhysicals();
00114 }
00115
00116
00117 Bool_t FWGeoTopNodeGLScene::DestroyPhysical(Int_t x)
00118 {
00119 fwLog(fwlog::kInfo) << "FWGeoTopNodeGLScene::DestroyPhysical()\n";
00120 return TGLScene::DestroyPhysical(x);
00121 }
00122
00123
00124 void FWGeoTopNodeGLScene::GeoPopupMenu(Int_t gx, Int_t gy, TGLViewer* v)
00125 {
00126 m_eveTopNode->popupMenu(gx, gy,v);
00127 }
00128
00129
00130
00131
00132 #if ROOT_VERSION_CODE < ROOT_VERSION(5,32,0)
00133
00134 #include "TEvePad.h"
00135 FWGeoTopNodeEveScene::FWGeoTopNodeEveScene(FWGeoTopNodeGLScene* gl_scene, const char* n, const char* t)
00136 {
00137
00138
00139 delete fGLScene;
00140
00141 gl_scene->SetPad(fPad);
00142 fGLScene = gl_scene;
00143
00144 fGLScene->SetName(n);
00145 fGLScene->SetAutoDestruct(kFALSE);
00146 fGLScene->SetSmartRefresh(kTRUE);
00147 }
00148 #endif