17 #include "TEveTrans.h"
18 #include "TEveViewer.h"
19 #include "TEveManager.h"
24 #include "TBuffer3D.h"
25 #include "TBuffer3DTypes.h"
26 #include "TVirtualViewer3D.h"
28 #include "TGLScenePad.h"
29 #include "TGLPhysicalShape.h"
30 #include "TGLSelectRecord.h"
31 #include "TGLViewer.h"
32 #include "TGLWidget.h"
34 #include "TGeoShape.h"
35 #include "TGeoVolume.h"
37 #include "TGeoShapeAssembly.h"
38 #include "TGeoCompositeShape.h"
39 #include "TGeoBoolNode.h"
40 #include "TGeoManager.h"
41 #include "TGeoMatrix.h"
42 #include "TVirtualGeoPainter.h"
55 return UInt_t(tableIdx + 2);
75 TGLPhysicalShape *
id = *sset.begin();
116 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
123 if (rec.GetMultiple())
125 if (sset.find(
id) == sset.end())
128 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
134 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
136 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
141 if (sset.size() != 1 || sset.find(
id) == sset.end())
145 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
151 if (!rec.GetMultiple())
154 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
166 m_scene->EndUpdate(kTRUE, kFALSE, kTRUE);
173 m_scene->EndUpdate(kFALSE, kFALSE, kFALSE);
182 TGLPhysicalShape* ps =
m_scene->FindPhysical(
phyID(tableIndex));
197 for (std::set<TGLPhysicalShape*>::iterator it =
fSted.begin(); it !=
fSted.end(); ++it)
209 if (
fSted.size() <= 1)
231 const Double_t *
r = mat.GetRotationMatrix();
232 const Double_t *
t = mat.GetTranslation();
233 const Double_t *
s = mat.GetScale();
234 Double_t *
m = buff.fLocalMaster;
235 m[0] = r[0]*s[0]; m[1] = r[1]*s[1]; m[2] = r[2]*s[2]; m[3] = 0;
236 m[4] = r[3]*s[0]; m[5] = r[4]*s[1]; m[6] = r[5]*s[2]; m[7] = 0;
237 m[8] = r[6]*s[0]; m[9] = r[7]*s[1]; m[10] = r[8]*s[2]; m[11] = 0;
238 m[12] = t[0]; m[13] = t[1]; m[15] = t[2]; m[15] = 1;
240 buff.fLocalFrame = kTRUE;
246 static const TEveException eh(
"FWGeoTopNode::paintShape ");
253 if (transparency >= 100)
return;
255 if (data.
m_node->GetVolume()->IsAssembly())
return;
256 TGeoShape* shape = data.
m_node->GetVolume()->GetShape();
258 TGeoCompositeShape* compositeShape =
dynamic_cast<TGeoCompositeShape*
>(shape);
263 Double_t halfLengths[3] = { compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ() };
265 TBuffer3D buff(TBuffer3DTypes::kComposite);
266 buff.fID = data.
m_node->GetVolume();
267 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
268 buff.fTransparency = transparency;
270 nm.GetHomogenousMatrix(buff.fLocalMaster);
271 buff.fLocalFrame = kTRUE;
272 buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
273 buff.SetSectionsValid(TBuffer3D::kCore|TBuffer3D::kBoundingBox);
275 Bool_t paintComponents = kTRUE;
277 if (TBuffer3D::GetCSLevel() == 0) {
281 TBuffer3D::IncCSLevel();
286 TGeoShape::SetTransform(&xxx);
288 if (paintComponents) compositeShape->GetBoolNode()->Paint(
"");
289 TGeoShape::SetTransform(gst);
291 if (TBuffer3D::DecCSLevel() == 0)
292 gPad->GetViewer3D()->CloseComposite();
299 TBuffer3D& buff = (TBuffer3D&) shape->GetBuffer3D (TBuffer3D::kCore, kFALSE);
301 buff.fID = data.
m_node->GetVolume();
302 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
303 buff.fTransparency = transparency;
306 nm.GetHomogenousMatrix(buff.fLocalMaster);
307 buff.fLocalFrame = kTRUE;
309 Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
310 shape->GetBuffer3D(sections, kTRUE);
312 Int_t reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
316 if (reqSec & TBuffer3D::kCore)
317 Warning(eh,
"Core section required again for shape='%s'. This shouldn't happen.", GetName());
318 shape->GetBuffer3D(reqSec, kTRUE);
319 reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
323 Warning(eh,
"Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
330 static const TEveException eh(
"FWGeoTopNode::Paint ");
332 TBuffer3D buff(TBuffer3DTypes::kGeneric);
336 buff.fColor = GetMainColor();
337 buff.fTransparency = GetMainTransparency();
338 if (HasMainTrans()) RefMainTrans().SetBuffer3D(buff);
340 buff.SetSectionsValid(TBuffer3D::kCore);
342 Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff);
345 Warning(eh,
"IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
378 nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
379 nodePopup->AddEntry(
"Set As Top Node and Reset Camera",
kSetTopNodeCam);
380 nodePopup->AddSeparator();
384 nodePopup->AddEntry(
"Turn Render On For Children",
kVisChldOn);
385 nodePopup->AddEntry(
"Turn Render Off For Children",
kVisChldOff);
386 nodePopup->AddEntry(
"Apply Color To Children",
kApplyChldCol);
388 nodePopup->AddSeparator();
392 nodePopup->AddEntry(
"Print Path",
kPrintPath);
396 nodePopup->AddSeparator();
400 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY,
x,
y, wdummy);
401 TGLVector3 pnt(x, y, 0.5*v->GetSelRec().GetMinZ());
402 v->CurrentCamera().WindowToViewport(pnt);
407 nodePopup->AddEntry(
"Set Camera Center",
kCamera);
410 nodePopup->PlaceMenu(iX, iY,
true,
true);
std::set< TGLPhysicalShape * > fSted
virtual FWGeometryTableManagerBase * tableManager()
void ClearSet(std::set< TGLPhysicalShape * > &sset)
long getParentTransparencyFactor() const
bool OpenCompositeWithPhyID(UInt_t phyID, const TBuffer3D &buffer)
virtual void Paint(Option_t *option="")
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
int getFirstSelectedTableIndex()
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
static const G4AffineTransform & GetTransform(const G4TouchableHistory *touchable, int depth)
FWGeoTopNodeGLScene * m_scene
UChar_t wrapTransparency(FWGeometryTableManagerBase::NodeInfo &data, bool leafNode)
virtual void ComputeBBox()
FWPopupMenu * setPopupMenu(int iX, int iY, TGLViewer *v, bool)
virtual FWGeometryTableViewBase * browser()
bool selectPhysicalFromTable(int)
static TGLViewer * s_pickedViewer
std::set< TGLPhysicalShape * > fHted
void paintShape(Int_t idx, const TGeoHMatrix &nm, bool volumeColor, bool parentNode)
char data[epos_bytes_allocation]
virtual void UnHighlighted()
void EraseFromSet(std::set< TGLPhysicalShape * > &sset, TGLPhysicalShape *id)
void ProcessSelection(TGLSelectRecord &rec, std::set< TGLPhysicalShape * > &sset, TGLPhysicalShape *id)
long getLeafTransparencyFactor() const
void SetStateOf(TGLPhysicalShape *id)
Entries_v::iterator Entries_i
static int tableIdx(TGLPhysicalShape *ps)
virtual void UnSelected()
static TGLVector3 s_pickedCamera3DCenter
void setupBuffMtx(TBuffer3D &buff, const TGeoHMatrix &mat)
static UInt_t phyID(int tableIdx)