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 TGeoShape* shape = data.
m_node->GetVolume()->GetShape();
259 TGeoCompositeShape* compositeShape =
dynamic_cast<TGeoCompositeShape*
>(shape);
264 Double_t halfLengths[3] = { compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ() };
266 TBuffer3D buff(TBuffer3DTypes::kComposite);
267 buff.fID = data.
m_node->GetVolume();
268 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
269 buff.fTransparency = transparency;
271 nm.GetHomogenousMatrix(buff.fLocalMaster);
272 buff.fLocalFrame = kTRUE;
273 buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
274 buff.SetSectionsValid(TBuffer3D::kCore|TBuffer3D::kBoundingBox);
276 Bool_t paintComponents = kTRUE;
278 if (TBuffer3D::GetCSLevel() == 0) {
282 TBuffer3D::IncCSLevel();
287 TGeoShape::SetTransform(&xxx);
289 if (paintComponents) compositeShape->GetBoolNode()->Paint(
"");
290 TGeoShape::SetTransform(gst);
292 if (TBuffer3D::DecCSLevel() == 0)
293 gPad->GetViewer3D()->CloseComposite();
300 TBuffer3D& buff = (TBuffer3D&) shape->GetBuffer3D (TBuffer3D::kCore, kFALSE);
302 buff.fID = data.
m_node->GetVolume();
303 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color ;
304 buff.fTransparency = transparency;
307 nm.GetHomogenousMatrix(buff.fLocalMaster);
308 buff.fLocalFrame = kTRUE;
310 Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
311 shape->GetBuffer3D(sections, kTRUE);
313 Int_t reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
317 if (reqSec & TBuffer3D::kCore)
318 Warning(eh,
"Core section required again for shape='%s'. This shouldn't happen.", GetName());
319 shape->GetBuffer3D(reqSec, kTRUE);
320 reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
324 Warning(eh,
"Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
331 static const TEveException eh(
"FWGeoTopNode::Paint ");
333 TBuffer3D buff(TBuffer3DTypes::kGeneric);
337 buff.fColor = GetMainColor();
338 buff.fTransparency = GetMainTransparency();
339 if (HasMainTrans()) RefMainTrans().SetBuffer3D(buff);
341 buff.SetSectionsValid(TBuffer3D::kCore);
343 Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff);
346 Warning(eh,
"IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
379 nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
380 nodePopup->AddEntry(
"Set As Top Node And Reset Camera",
kSetTopNodeCam);
381 nodePopup->AddSeparator();
385 nodePopup->AddEntry(
"Rnr Off For All Children",
kVisChldOff);
386 nodePopup->AddEntry(
"Rnr On For All Children",
kVisChldOn);
387 nodePopup->AddSeparator();
391 nodePopup->AddEntry(
"Print Path",
kPrintPath);
395 nodePopup->AddSeparator();
399 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY,
x,
y, wdummy);
400 TGLVector3 pnt(x, y, 0.5*v->GetSelRec().GetMinZ());
401 v->CurrentCamera().WindowToViewport(pnt);
406 nodePopup->AddEntry(
"Set Camera Center",
kCamera);
409 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)