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));
199 for (std::set<TGLPhysicalShape*>::iterator it =
fSted.begin(); it !=
fSted.end(); ++it)
211 if (
fSted.size() <= 1)
233 const Double_t *
r = mat.GetRotationMatrix();
234 const Double_t *
t = mat.GetTranslation();
235 const Double_t *
s = mat.GetScale();
236 Double_t *
m = buff.fLocalMaster;
237 m[0] = r[0]*s[0]; m[1] = r[1]*s[1]; m[2] = r[2]*s[2]; m[3] = 0;
238 m[4] = r[3]*s[0]; m[5] = r[4]*s[1]; m[6] = r[5]*s[2]; m[7] = 0;
239 m[8] = r[6]*s[0]; m[9] = r[7]*s[1]; m[10] = r[8]*s[2]; m[11] = 0;
240 m[12] = t[0]; m[13] = t[1]; m[15] = t[2]; m[15] = 1;
242 buff.fLocalFrame = kTRUE;
248 static const TEveException eh(
"FWGeoTopNode::paintShape ");
255 if (transparency >= 100)
return;
257 if (data.
m_node->GetVolume()->IsAssembly())
return;
258 TGeoShape* shape = data.
m_node->GetVolume()->GetShape();
260 TGeoCompositeShape* compositeShape =
dynamic_cast<TGeoCompositeShape*
>(shape);
265 Double_t halfLengths[3] = { compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ() };
267 TBuffer3D buff(TBuffer3DTypes::kComposite);
268 buff.fID = data.
m_node->GetVolume();
269 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
270 buff.fTransparency = transparency;
272 nm.GetHomogenousMatrix(buff.fLocalMaster);
273 buff.fLocalFrame = kTRUE;
274 buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
275 buff.SetSectionsValid(TBuffer3D::kCore|TBuffer3D::kBoundingBox);
277 Bool_t paintComponents = kTRUE;
279 if (TBuffer3D::GetCSLevel() == 0) {
283 TBuffer3D::IncCSLevel();
288 TGeoShape::SetTransform(&xxx);
290 if (paintComponents) compositeShape->GetBoolNode()->Paint(
"");
291 TGeoShape::SetTransform(gst);
293 if (TBuffer3D::DecCSLevel() == 0)
294 gPad->GetViewer3D()->CloseComposite();
301 TBuffer3D& buff = (TBuffer3D&) shape->GetBuffer3D (TBuffer3D::kCore, kFALSE);
303 buff.fID = data.
m_node->GetVolume();
304 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
305 buff.fTransparency = transparency;
308 nm.GetHomogenousMatrix(buff.fLocalMaster);
309 buff.fLocalFrame = kTRUE;
311 Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
312 shape->GetBuffer3D(sections, kTRUE);
314 Int_t reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
318 if (reqSec & TBuffer3D::kCore)
319 Warning(eh,
"Core section required again for shape='%s'. This shouldn't happen.", GetName());
320 shape->GetBuffer3D(reqSec, kTRUE);
321 reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
325 Warning(eh,
"Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
332 static const TEveException eh(
"FWGeoTopNode::Paint ");
334 TBuffer3D buff(TBuffer3DTypes::kGeneric);
338 buff.fColor = GetMainColor();
339 buff.fTransparency = GetMainTransparency();
340 if (HasMainTrans()) RefMainTrans().SetBuffer3D(buff);
342 buff.SetSectionsValid(TBuffer3D::kCore);
344 Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff);
347 Warning(eh,
"IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
380 nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
381 nodePopup->AddEntry(
"Set As Top Node and Reset Camera",
kSetTopNodeCam);
382 nodePopup->AddSeparator();
386 nodePopup->AddEntry(
"Turn Render On For Children",
kVisChldOn);
387 nodePopup->AddEntry(
"Turn Render Off For Children",
kVisChldOff);
388 nodePopup->AddEntry(
"Apply Color To Children",
kApplyChldCol);
390 nodePopup->AddSeparator();
394 nodePopup->AddEntry(
"Print Path",
kPrintPath);
398 nodePopup->AddSeparator();
402 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY,
x,
y, wdummy);
403 TGLVector3 pnt(x, y, 0.5*v->GetSelRec().GetMinZ());
404 v->CurrentCamera().WindowToViewport(pnt);
409 nodePopup->AddEntry(
"Set Camera Center",
kCamera);
412 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)
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)