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" 42 #include "TVirtualX.h" 64 while (!sset.empty()) {
65 TGLPhysicalShape*
id = *sset.begin();
96 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
100 if (rec.GetMultiple()) {
101 if (sset.find(
id) == sset.end()) {
103 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
107 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
109 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
112 if (sset.size() != 1 || sset.find(
id) == sset.end()) {
115 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
119 if (!rec.GetMultiple()) {
121 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
131 m_scene->EndUpdate(kTRUE, kFALSE, kTRUE);
136 m_scene->EndUpdate(kFALSE, kFALSE, kFALSE);
144 TGLPhysicalShape* ps =
m_scene->FindPhysical(
phyID(tableIndex));
157 for (std::set<TGLPhysicalShape*>::iterator
it =
fSted.begin();
it !=
fSted.end(); ++
it) {
167 if (
fSted.size() <= 1) {
188 const Double_t*
r = mat.GetRotationMatrix();
189 const Double_t*
t = mat.GetTranslation();
190 const Double_t*
s = mat.GetScale();
191 Double_t*
m = buff.fLocalMaster;
209 buff.fLocalFrame = kTRUE;
214 static const TEveException eh(
"FWGeoTopNode::paintShape ");
221 if (transparency >= 100)
224 if (
data.m_node->GetVolume()->IsAssembly())
226 TGeoShape*
shape =
data.m_node->GetVolume()->GetShape();
228 TGeoCompositeShape* compositeShape =
dynamic_cast<TGeoCompositeShape*
>(
shape);
229 if (compositeShape) {
232 Double_t halfLengths[3] = {compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ()};
234 TBuffer3D buff(TBuffer3DTypes::kComposite);
235 buff.fID =
data.m_node->GetVolume();
236 buff.fColor = volumeColor ?
data.m_node->GetVolume()->GetLineColor() :
data.m_color;
237 buff.fTransparency = transparency;
239 nm.GetHomogenousMatrix(buff.fLocalMaster);
240 buff.fLocalFrame = kTRUE;
241 buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
242 buff.SetSectionsValid(TBuffer3D::kCore | TBuffer3D::kBoundingBox);
244 Bool_t paintComponents = kTRUE;
246 if (TBuffer3D::GetCSLevel() == 0) {
250 TBuffer3D::IncCSLevel();
255 TGeoShape::SetTransform(&
xxx);
258 compositeShape->GetBoolNode()->Paint(
"");
259 TGeoShape::SetTransform(gst);
261 if (TBuffer3D::DecCSLevel() == 0)
262 gPad->GetViewer3D()->CloseComposite();
266 TBuffer3D& buff = (TBuffer3D&)
shape->GetBuffer3D(TBuffer3D::kCore, kFALSE);
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;
275 Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
276 shape->GetBuffer3D(sections, kTRUE);
278 Int_t reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
282 if (reqSec & TBuffer3D::kCore)
283 Warning(eh,
"Core section required again for shape='%s'. This shouldn't happen.", GetName());
284 shape->GetBuffer3D(reqSec, kTRUE);
285 reqSec = gPad->GetViewer3D()->AddObject(
phyID(tableIndex), buff);
289 Warning(eh,
"Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
295 static const TEveException eh(
"FWGeoTopNode::Paint ");
297 TBuffer3D buff(TBuffer3DTypes::kGeneric);
301 buff.fColor = GetMainColor();
302 buff.fTransparency = GetMainTransparency();
304 RefMainTrans().SetBuffer3D(buff);
306 buff.SetSectionsValid(TBuffer3D::kCore);
308 Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff);
311 "IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
345 nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
346 nodePopup->AddEntry(
"Set As Top Node and Reset Camera",
kSetTopNodeCam);
347 nodePopup->AddSeparator();
351 nodePopup->AddEntry(
"Turn Render On For Children",
kVisChldOn);
352 nodePopup->AddEntry(
"Turn Render Off For Children",
kVisChldOff);
353 nodePopup->AddEntry(
"Apply Color To Children",
kApplyChldCol);
355 nodePopup->AddSeparator();
359 nodePopup->AddEntry(
"Print Path",
kPrintPath);
363 nodePopup->AddSeparator();
367 gVirtualX->TranslateCoordinates(
368 gClient->GetDefaultRoot()->GetId(),
v->GetGLWidget()->GetId(), iX, iY,
x,
y, wdummy);
369 TGLVector3 pnt(
x,
y, 0.5 *
v->GetSelRec().GetMinZ());
370 v->CurrentCamera().WindowToViewport(pnt);
375 nodePopup->AddEntry(
"Set Camera Center",
kCamera);
378 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)
void EraseFromSet(std::set< TGLPhysicalShape *> &sset, TGLPhysicalShape *id)
FWPopupMenu * setPopupMenu(int iX, int iY, TGLViewer *v, bool)
void ProcessSelection(TGLSelectRecord &rec, std::set< TGLPhysicalShape *> &sset, TGLPhysicalShape *id)
virtual FWGeometryTableViewBase * browser()
bool selectPhysicalFromTable(int)
static TGLViewer * s_pickedViewer
long getLeafTransparencyFactor() const
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 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)