17 #include "TEveTrans.h" 18 #include "TEveViewer.h" 19 #include "TEveManager.h" 23 #include "TBuffer3D.h" 24 #include "TBuffer3DTypes.h" 25 #include "TVirtualViewer3D.h" 27 #include "TGLScenePad.h" 28 #include "TGLPhysicalShape.h" 29 #include "TGLSelectRecord.h" 30 #include "TGLViewer.h" 31 #include "TGLWidget.h" 33 #include "TGeoShape.h" 34 #include "TGeoVolume.h" 36 #include "TGeoShapeAssembly.h" 37 #include "TGeoCompositeShape.h" 38 #include "TGeoBoolNode.h" 39 #include "TGeoManager.h" 40 #include "TGeoMatrix.h" 41 #include "TVirtualGeoPainter.h" 63 while (!sset.empty()) {
64 TGLPhysicalShape*
id = *sset.begin();
95 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
99 if (rec.GetMultiple()) {
100 if (sset.find(
id) == sset.end()) {
102 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
106 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
108 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
111 if (sset.size() != 1 || sset.find(
id) == sset.end()) {
114 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
118 if (!rec.GetMultiple()) {
120 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
130 m_scene->EndUpdate(kTRUE, kFALSE, kTRUE);
135 m_scene->EndUpdate(kFALSE, kFALSE, kFALSE);
143 TGLPhysicalShape* ps =
m_scene->FindPhysical(
phyID(tableIndex));
156 for (std::set<TGLPhysicalShape*>::iterator it =
fSted.begin(); it !=
fSted.end(); ++it) {
166 if (
fSted.size() <= 1) {
187 const Double_t*
r = mat.GetRotationMatrix();
188 const Double_t*
t = mat.GetTranslation();
189 const Double_t*
s = mat.GetScale();
190 Double_t*
m = buff.fLocalMaster;
208 buff.fLocalFrame = kTRUE;
213 static const TEveException eh(
"FWGeoTopNode::paintShape ");
220 if (transparency >= 100)
223 if (data.
m_node->GetVolume()->IsAssembly())
225 TGeoShape* shape = data.
m_node->GetVolume()->GetShape();
227 TGeoCompositeShape* compositeShape =
dynamic_cast<TGeoCompositeShape*
>(shape);
228 if (compositeShape) {
231 Double_t halfLengths[3] = {compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ()};
233 TBuffer3D buff(TBuffer3DTypes::kComposite);
234 buff.fID = data.
m_node->GetVolume();
235 buff.fColor = volumeColor ? data.
m_node->GetVolume()->GetLineColor() : data.
m_color;
236 buff.fTransparency = transparency;
238 nm.GetHomogenousMatrix(buff.fLocalMaster);
239 buff.fLocalFrame = kTRUE;
240 buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
241 buff.SetSectionsValid(TBuffer3D::kCore | TBuffer3D::kBoundingBox);
243 Bool_t paintComponents = kTRUE;
245 if (TBuffer3D::GetCSLevel() == 0) {
249 TBuffer3D::IncCSLevel();
254 TGeoShape::SetTransform(&xxx);
257 compositeShape->GetBoolNode()->Paint(
"");
258 TGeoShape::SetTransform(gst);
260 if (TBuffer3D::DecCSLevel() == 0)
261 gPad->GetViewer3D()->CloseComposite();
265 TBuffer3D& buff = (TBuffer3D&)shape->GetBuffer3D(TBuffer3D::kCore, kFALSE);
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;
274 Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
275 shape->GetBuffer3D(sections, kTRUE);
277 Int_t reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
281 if (reqSec & TBuffer3D::kCore)
282 Warning(eh,
"Core section required again for shape='%s'. This shouldn't happen.", GetName());
283 shape->GetBuffer3D(reqSec, kTRUE);
284 reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
288 Warning(eh,
"Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
294 static const TEveException eh(
"FWGeoTopNode::Paint ");
296 TBuffer3D buff(TBuffer3DTypes::kGeneric);
300 buff.fColor = GetMainColor();
301 buff.fTransparency = GetMainTransparency();
303 RefMainTrans().SetBuffer3D(buff);
305 buff.SetSectionsValid(TBuffer3D::kCore);
307 Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff);
310 "IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
344 nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
345 nodePopup->AddEntry(
"Set As Top Node and Reset Camera",
kSetTopNodeCam);
346 nodePopup->AddSeparator();
350 nodePopup->AddEntry(
"Turn Render On For Children",
kVisChldOn);
351 nodePopup->AddEntry(
"Turn Render Off For Children",
kVisChldOff);
352 nodePopup->AddEntry(
"Apply Color To Children",
kApplyChldCol);
354 nodePopup->AddSeparator();
358 nodePopup->AddEntry(
"Print Path",
kPrintPath);
362 nodePopup->AddSeparator();
366 gVirtualX->TranslateCoordinates(
367 gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY,
x,
y, wdummy);
368 TGLVector3 pnt(x, y, 0.5 * v->GetSelRec().GetMinZ());
369 v->CurrentCamera().WindowToViewport(pnt);
374 nodePopup->AddEntry(
"Set Camera Center",
kCamera);
377 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)
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
int getFirstSelectedTableIndex()
void UnHighlighted() override
static const G4AffineTransform & GetTransform(const G4TouchableHistory *touchable, int depth)
FWGeoTopNodeGLScene * m_scene
void UnSelected() override
UChar_t wrapTransparency(FWGeometryTableManagerBase::NodeInfo &data, bool leafNode)
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]
void Paint(Option_t *option="") override
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)
void ComputeBBox() override
static TGLVector3 s_pickedCamera3DCenter
void setupBuffMtx(TBuffer3D &buff, const TGeoHMatrix &mat)
static UInt_t phyID(int tableIdx)