18 #include "TEveTrans.h"
19 #include "TEveViewer.h"
20 #include "TEveManager.h"
25 #include "TBuffer3D.h"
26 #include "TBuffer3DTypes.h"
27 #include "TVirtualViewer3D.h"
29 #include "TGLScenePad.h"
30 #include "TGLPhysicalShape.h"
31 #include "TGLSelectRecord.h"
32 #include "TGLViewer.h"
33 #include "TGLWidget.h"
35 #include "TGeoShape.h"
36 #include "TGeoVolume.h"
38 #include "TGeoShapeAssembly.h"
39 #include "TGeoCompositeShape.h"
40 #include "TGeoBoolNode.h"
41 #include "TGeoManager.h"
42 #include "TGeoMatrix.h"
43 #include "TVirtualGeoPainter.h"
56 return UInt_t(tableIdx + 2);
76 TGLPhysicalShape *
id = *sset.begin();
117 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
124 if (rec.GetMultiple())
126 if (sset.find(
id) == sset.end())
129 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
135 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
137 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
142 if (sset.size() != 1 || sset.find(
id) == sset.end())
146 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
152 if (!rec.GetMultiple())
155 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
167 m_scene->EndUpdate(kTRUE, kFALSE, kTRUE);
174 m_scene->EndUpdate(kFALSE, kFALSE, kFALSE);
183 TGLPhysicalShape* ps =
m_scene->FindPhysical(
phyID(tableIndex));
200 for (std::set<TGLPhysicalShape*>::iterator it =
fSted.begin(); it !=
fSted.end(); ++it)
212 if (
fSted.size() <= 1)
234 const Double_t *
r = mat.GetRotationMatrix();
235 const Double_t *
t = mat.GetTranslation();
236 const Double_t *
s = mat.GetScale();
237 Double_t *
m = buff.fLocalMaster;
238 m[0] = r[0]*s[0]; m[1] = r[1]*s[1]; m[2] = r[2]*s[2]; m[3] = 0;
239 m[4] = r[3]*s[0]; m[5] = r[4]*s[1]; m[6] = r[5]*s[2]; m[7] = 0;
240 m[8] = r[6]*s[0]; m[9] = r[7]*s[1]; m[10] = r[8]*s[2]; m[11] = 0;
241 m[12] = t[0]; m[13] = t[1]; m[15] = t[2]; m[15] = 1;
243 buff.fLocalFrame = kTRUE;
249 static const TEveException eh(
"FWGeoTopNode::paintShape ");
256 if (transparency >= 100)
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)
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)