#include <Fireworks/Core/interface/FWGeoTopNode.h>
Public Types | |
enum | MenuOptions { kSetTopNode, kSetTopNodeCam, kVisSelfOff, kVisChldOn, kVisChldOff, kCamera, kPrintMaterial, kPrintPath, kPrintShape, kPrintOverlap, kOverlapVisibilityMotherOn, kOverlapVisibilityMotherOff } |
Public Member Functions | |
virtual FWGeometryTableViewBase * | browser () |
void | clearSelection () |
FWGeoTopNode (const char *n="FWGeoTopNode", const char *t="FWGeoTopNode") | |
int | getFirstSelectedTableIndex () |
virtual void | Paint (Option_t *option="") |
virtual void | popupMenu (int x, int y, TGLViewer *) |
void | printSelected () |
bool | selectPhysicalFromTable (int) |
virtual FWGeometryTableManagerBase * | tableManager () |
virtual void | UnHighlighted () |
virtual void | UnSelected () |
virtual | ~FWGeoTopNode () |
Public Attributes | |
std::set< TGLPhysicalShape * > | fHted |
std::set< TGLPhysicalShape * > | fSted |
FWGeoTopNodeGLScene * | m_scene |
Static Public Attributes | |
static TGLVector3 | s_pickedCamera3DCenter |
static TGLViewer * | s_pickedViewer = 0 |
Protected Member Functions | |
void | ClearSet (std::set< TGLPhysicalShape * > &sset) |
virtual void | ComputeBBox () |
void | EraseFromSet (std::set< TGLPhysicalShape * > &sset, TGLPhysicalShape *id) |
void | paintShape (Int_t idx, const TGeoHMatrix &nm, bool volumeColor, bool parentNode) |
void | ProcessSelection (TGLSelectRecord &rec, std::set< TGLPhysicalShape * > &sset, TGLPhysicalShape *id) |
FWPopupMenu * | setPopupMenu (int iX, int iY, TGLViewer *v, bool) |
void | SetStateOf (TGLPhysicalShape *id) |
void | setupBuffMtx (TBuffer3D &buff, const TGeoHMatrix &mat) |
Static Protected Member Functions | |
static UInt_t | phyID (int tableIdx) |
static int | tableIdx (TGLPhysicalShape *ps) |
Private Member Functions | |
ClassDef (FWGeoTopNode, 0) | |
FWGeoTopNode (const FWGeoTopNode &) | |
const FWGeoTopNode & | operator= (const FWGeoTopNode &) |
UChar_t | wrapTransparency (FWGeometryTableManagerBase::NodeInfo &data, bool leafNode) |
Friends | |
class | FWGeoTopNodeGL |
kSetTopNode | |
kSetTopNodeCam | |
kVisSelfOff | |
kVisChldOn | |
kVisChldOff | |
kCamera | |
kPrintMaterial | |
kPrintPath | |
kPrintShape | |
kPrintOverlap | |
kOverlapVisibilityMotherOn | |
kOverlapVisibilityMotherOff |
Definition at line 48 of file FWGeoTopNode.h.
FWGeoTopNode::FWGeoTopNode | ( | const char * | n = "FWGeoTopNode" , |
const char * | t = "FWGeoTopNode" |
||
) | [inline] |
Definition at line 63 of file FWGeoTopNode.h.
{}
virtual FWGeoTopNode::~FWGeoTopNode | ( | ) | [inline, virtual] |
Definition at line 64 of file FWGeoTopNode.h.
{}
FWGeoTopNode::FWGeoTopNode | ( | const FWGeoTopNode & | ) | [private] |
virtual FWGeometryTableViewBase* FWGeoTopNode::browser | ( | ) | [inline, virtual] |
Reimplemented in FWEveDetectorGeo, and FWEveOverlap.
Definition at line 70 of file FWGeoTopNode.h.
Referenced by wrapTransparency().
{ return 0; }
FWGeoTopNode::ClassDef | ( | FWGeoTopNode | , |
0 | |||
) | [private] |
void FWGeoTopNode::clearSelection | ( | ) | [inline] |
Definition at line 77 of file FWGeoTopNode.h.
Referenced by FWGeometryTableView::setPath(), and FWGeometryTableViewBase::setPath().
void FWGeoTopNode::ClearSet | ( | std::set< TGLPhysicalShape * > & | sset | ) | [protected] |
Definition at line 72 of file FWGeoTopNode.cc.
References SetStateOf().
Referenced by ProcessSelection(), UnHighlighted(), and UnSelected().
{ while (!sset.empty()) { TGLPhysicalShape *id = *sset.begin(); sset.erase(id); SetStateOf(id); } }
void FWGeoTopNode::ComputeBBox | ( | ) | [protected, virtual] |
Definition at line 224 of file FWGeoTopNode.cc.
References f.
{ // Fill bounding-box information. Virtual from TAttBBox. BBoxZero(1.0f); }
void FWGeoTopNode::EraseFromSet | ( | std::set< TGLPhysicalShape * > & | sset, |
TGLPhysicalShape * | id | ||
) | [protected] |
Definition at line 65 of file FWGeoTopNode.cc.
References SetStateOf().
Referenced by ProcessSelection().
{ sset.erase(id); SetStateOf(id); }
int FWGeoTopNode::getFirstSelectedTableIndex | ( | ) |
Definition at line 208 of file FWGeoTopNode.cc.
References fSted, i, FWGeometryTableManagerBase::kSelected, FWGeometryTableManagerBase::refEntries(), and tableManager().
Referenced by FWOverlapTableView::chosenItem(), FWGeometryTableViewBase::chosenItem(), and setPopupMenu().
{ // Note: if object would be rendered, this would return fSted.begin(). if (fSted.size() <= 1) { int cnt = 0; for (FWGeometryTableManagerBase::Entries_i i = tableManager()->refEntries().begin(); i != tableManager()->refEntries().end(); ++i, ++cnt) { if (i->testBit(FWGeometryTableManagerBase::kSelected)) return cnt; } } return -1; }
const FWGeoTopNode& FWGeoTopNode::operator= | ( | const FWGeoTopNode & | ) | [private] |
void FWGeoTopNode::Paint | ( | Option_t * | option = "" | ) | [virtual] |
Reimplemented in FWEveDetectorGeo, and FWEveOverlap.
Definition at line 330 of file FWGeoTopNode.cc.
References WDecay::kNone.
{ static const TEveException eh("FWGeoTopNode::Paint "); TBuffer3D buff(TBuffer3DTypes::kGeneric); // Section kCore buff.fID = this; buff.fColor = GetMainColor(); buff.fTransparency = GetMainTransparency(); if (HasMainTrans()) RefMainTrans().SetBuffer3D(buff); buff.SetSectionsValid(TBuffer3D::kCore); Int_t reqSections = gPad->GetViewer3D()->AddObject(1, buff); if (reqSections != TBuffer3D::kNone) { Warning(eh, "IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.", ClassName(), reqSections); } }
void FWGeoTopNode::paintShape | ( | Int_t | idx, |
const TGeoHMatrix & | nm, | ||
bool | volumeColor, | ||
bool | parentNode | ||
) | [protected] |
Definition at line 247 of file FWGeoTopNode.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, GetTransform(), WDecay::kNone, FWGeometryTableManagerBase::NodeInfo::m_color, FWGeometryTableManagerBase::NodeInfo::m_node, m_scene, FWGeoTopNodeGLScene::OpenCompositeWithPhyID(), phyID(), FWGeometryTableManagerBase::refEntries(), setupBuffMtx(), tableManager(), and wrapTransparency().
Referenced by FWEveOverlap::Paint(), FWEveDetectorGeo::Paint(), FWEveDetectorGeo::paintChildNodesRecurse(), and FWEveOverlap::paintChildNodesRecurse().
{ static const TEveException eh("FWGeoTopNode::paintShape "); // printf("paint sahpe id %d\n", tableIndex ); FWGeometryTableManagerBase::NodeInfo& data = tableManager()->refEntries().at(tableIndex); UChar_t transparency = wrapTransparency(data, isParentNode); // printf("trans %d \n", transparency ); if (transparency >= 100) return; TGeoShape* shape = data.m_node->GetVolume()->GetShape(); TGeoCompositeShape* compositeShape = dynamic_cast<TGeoCompositeShape*>(shape); if (compositeShape) { // m_scene->fNextCompositeID = phyID(tableIndex); Double_t halfLengths[3] = { compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ() }; TBuffer3D buff(TBuffer3DTypes::kComposite); buff.fID = data.m_node->GetVolume(); buff.fColor = volumeColor ? data.m_node->GetVolume()->GetLineColor() : data.m_color ; buff.fTransparency = transparency;// data.m_node->GetVolume()->GetTransparency(); nm.GetHomogenousMatrix(buff.fLocalMaster); buff.fLocalFrame = kTRUE; // Always enforce local frame (no geo manager). buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths); buff.SetSectionsValid(TBuffer3D::kCore|TBuffer3D::kBoundingBox); Bool_t paintComponents = kTRUE; // Start a composite shape, identified by this buffer if (TBuffer3D::GetCSLevel() == 0) { paintComponents = m_scene->OpenCompositeWithPhyID(phyID(tableIndex), buff); } TBuffer3D::IncCSLevel(); // Paint the boolean node - will add more buffers to viewer TGeoHMatrix xxx; TGeoMatrix *gst = TGeoShape::GetTransform(); TGeoShape::SetTransform(&xxx); if (paintComponents) compositeShape->GetBoolNode()->Paint(""); TGeoShape::SetTransform(gst); // Close the composite shape if (TBuffer3D::DecCSLevel() == 0) gPad->GetViewer3D()->CloseComposite(); // m_scene->fNextCompositeID = 0; } else { TBuffer3D& buff = (TBuffer3D&) shape->GetBuffer3D (TBuffer3D::kCore, kFALSE); setupBuffMtx(buff, nm); buff.fID = data.m_node->GetVolume(); buff.fColor = volumeColor ? data.m_node->GetVolume()->GetLineColor() : data.m_color ; buff.fTransparency = transparency;// data.m_node->GetVolume()->GetTransparency(); nm.GetHomogenousMatrix(buff.fLocalMaster); buff.fLocalFrame = kTRUE; // Always enforce local frame (no geo manager). Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific; shape->GetBuffer3D(sections, kTRUE); Int_t reqSec = gPad->GetViewer3D()->AddObject(phyID(tableIndex), buff); if (reqSec != TBuffer3D::kNone) { // This shouldn't happen, but I suspect it does sometimes. if (reqSec & TBuffer3D::kCore) Warning(eh, "Core section required again for shape='%s'. This shouldn't happen.", GetName()); shape->GetBuffer3D(reqSec, kTRUE); reqSec = gPad->GetViewer3D()->AddObject(phyID(tableIndex), buff); } if (reqSec != TBuffer3D::kNone) Warning(eh, "Extra section required: reqSec=%d, shape=%s.", reqSec, GetName()); } }
UInt_t FWGeoTopNode::phyID | ( | int | tableIdx | ) | [static, protected] |
Definition at line 54 of file FWGeoTopNode.cc.
Referenced by paintShape(), and selectPhysicalFromTable().
virtual void FWGeoTopNode::popupMenu | ( | int | x, |
int | y, | ||
TGLViewer * | |||
) | [inline, virtual] |
Reimplemented in FWEveDetectorGeo, and FWEveOverlap.
Definition at line 80 of file FWGeoTopNode.h.
Referenced by FWGeometryTableViewBase::cellClicked(), and FWGeoTopNodeGLScene::GeoPopupMenu().
{}
void FWGeoTopNode::printSelected | ( | ) |
Definition at line 198 of file FWGeoTopNode.cc.
References asciidump::at, fSted, mergeVDriftHistosByStation::name, tableIdx(), and tableManager().
void FWGeoTopNode::ProcessSelection | ( | TGLSelectRecord & | rec, |
std::set< TGLPhysicalShape * > & | sset, | ||
TGLPhysicalShape * | id | ||
) | [protected] |
Definition at line 106 of file FWGeoTopNode.cc.
References ClearSet(), FWTableManagerBase::dataChanged(), EraseFromSet(), WDecay::kNone, m_scene, SetStateOf(), and tableManager().
Referenced by FWGeoTopNodeGL::ProcessSelection().
{ // printf("FWGeoTopNode::ProcessSelection ===============================\n"); m_scene->BeginUpdate(); if (sset.empty()) { if (id) { sset.insert(id); rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection); } } else { if (id) { if (rec.GetMultiple()) { if (sset.find(id) == sset.end()) { sset.insert(id); rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection); } else { EraseFromSet(sset, id); if (sset.empty()) rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection); else rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection); } } else { if (sset.size() != 1 || sset.find(id) == sset.end()) { ClearSet(sset); sset.insert(id); rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection); } } } else { if (!rec.GetMultiple()) { ClearSet(sset); rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection); } } } if (id) { SetStateOf(id); } if (rec.GetSecSelResult() != TGLSelectRecord::kNone) { m_scene->EndUpdate(kTRUE, kFALSE, kTRUE); gEve->Redraw3D(); tableManager()->dataChanged(); } else { m_scene->EndUpdate(kFALSE, kFALSE, kFALSE); } }
bool FWGeoTopNode::selectPhysicalFromTable | ( | int | tableIndex | ) |
Definition at line 179 of file FWGeoTopNode.cc.
References asciidump::at, fSted, fwLog, fwlog::kInfo, FWGeometryTableManagerBase::kVisNodeSelf, m_scene, phyID(), and tableManager().
Referenced by FWGeometryTableViewBase::setColumnSelected().
{ // printf("FWGeoTopNode::selectPhysicalFromTable TGLPhysicalShape* ps = m_scene->FindPhysical(phyID(tableIndex)); if (ps) { fSted.insert(ps); ps->Select(1); // printf("selectPhysicalFromTable found physical \n"); return true; } else if ( tableManager()->refEntries().at(tableIndex).testBit(FWGeometryTableManagerBase::kVisNodeSelf)); { fwLog(fwlog::kInfo) << "Selected entry not drawn in GL viewer. \n" ; return false; } }
FWPopupMenu * FWGeoTopNode::setPopupMenu | ( | int | iX, |
int | iY, | ||
TGLViewer * | v, | ||
bool | overlap | ||
) | [protected] |
Definition at line 370 of file FWGeoTopNode.cc.
References fSted, fwLog, getFirstSelectedTableIndex(), kCamera, fwlog::kInfo, kPrintMaterial, kPrintOverlap, kPrintPath, kPrintShape, kSetTopNode, kSetTopNodeCam, kVisChldOff, kVisChldOn, kVisSelfOff, s_pickedCamera3DCenter, s_pickedViewer, v, x, and detailsBasic3DVector::y.
Referenced by FWEveOverlap::popupMenu(), and FWEveDetectorGeo::popupMenu().
{ if (getFirstSelectedTableIndex() < 0) { if (fSted.empty()) fwLog(fwlog::kInfo) << "No menu -- no node/entry selected \n"; return 0; } FWPopupMenu* nodePopup = new FWPopupMenu(); nodePopup->AddEntry("Set As Top Node", kSetTopNode); nodePopup->AddEntry("Set As Top Node And Reset Camera", kSetTopNodeCam); nodePopup->AddSeparator(); if (v) { nodePopup->AddEntry("Rnr Off", kVisSelfOff); } nodePopup->AddEntry("Rnr Off For All Children", kVisChldOff); nodePopup->AddEntry("Rnr On For All Children", kVisChldOn); nodePopup->AddSeparator(); if (overlap) nodePopup->AddEntry("Print Overlap", kPrintOverlap); nodePopup->AddEntry("Print Path", kPrintPath); nodePopup->AddEntry("Print Shape", kPrintShape); nodePopup->AddEntry("Print Material", kPrintMaterial); nodePopup->AddSeparator(); if (v) { Window_t wdummy; Int_t x,y; gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY, x, y, wdummy); TGLVector3 pnt(x, y, 0.5*v->GetSelRec().GetMinZ()); v->CurrentCamera().WindowToViewport(pnt); s_pickedCamera3DCenter = v->CurrentCamera().ViewportToWorld(pnt); // s_pickedCamera3DCenter.Dump(); s_pickedViewer = v; nodePopup->AddEntry("Set Camera Center", kCamera); } nodePopup->PlaceMenu(iX, iY,true,true); return nodePopup; }
void FWGeoTopNode::SetStateOf | ( | TGLPhysicalShape * | id | ) | [protected] |
Definition at line 82 of file FWGeoTopNode.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, fHted, fSted, FWGeometryTableManagerBase::kHighlighted, FWGeometryTableManagerBase::kSelected, FWGeometryTableManagerBase::refEntries(), FWGeometryTableManagerBase::NodeInfo::resetBit(), FWGeometryTableManagerBase::NodeInfo::setBit(), tableIdx(), and tableManager().
Referenced by ClearSet(), EraseFromSet(), and ProcessSelection().
{ FWGeometryTableManagerBase::NodeInfo& data = tableManager()->refEntries().at(tableIdx(id)); if (fSted.find(id) != fSted.end()) { id->Select(1); data.setBit(FWGeometryTableManagerBase::kSelected); } else if (fHted.find(id) != fHted.end()) { id->Select(3); data.setBit(FWGeometryTableManagerBase::kHighlighted); } else { id->Select(0); data.resetBit(FWGeometryTableManagerBase::kHighlighted); data.resetBit(FWGeometryTableManagerBase::kSelected); } }
void FWGeoTopNode::setupBuffMtx | ( | TBuffer3D & | buff, |
const TGeoHMatrix & | mat | ||
) | [protected] |
Definition at line 232 of file FWGeoTopNode.cc.
References m, alignCSCRings::r, alignCSCRings::s, and lumiQTWidget::t.
Referenced by paintShape().
{ const Double_t *r = mat.GetRotationMatrix(); const Double_t *t = mat.GetTranslation(); const Double_t *s = mat.GetScale(); Double_t *m = buff.fLocalMaster; m[0] = r[0]*s[0]; m[1] = r[1]*s[1]; m[2] = r[2]*s[2]; m[3] = 0; m[4] = r[3]*s[0]; m[5] = r[4]*s[1]; m[6] = r[5]*s[2]; m[7] = 0; m[8] = r[6]*s[0]; m[9] = r[7]*s[1]; m[10] = r[8]*s[2]; m[11] = 0; m[12] = t[0]; m[13] = t[1]; m[15] = t[2]; m[15] = 1; buff.fLocalFrame = kTRUE; }
int FWGeoTopNode::tableIdx | ( | TGLPhysicalShape * | ps | ) | [static, protected] |
Definition at line 60 of file FWGeoTopNode.cc.
Referenced by FWEveDetectorGeo::GetHighlightTooltip(), FWEveOverlap::GetHighlightTooltip(), printSelected(), and SetStateOf().
{
return ps->ID() - 2;
}
virtual FWGeometryTableManagerBase* FWGeoTopNode::tableManager | ( | ) | [inline, virtual] |
Reimplemented in FWEveDetectorGeo, and FWEveOverlap.
Definition at line 69 of file FWGeoTopNode.h.
Referenced by getFirstSelectedTableIndex(), paintShape(), printSelected(), ProcessSelection(), selectPhysicalFromTable(), SetStateOf(), UnHighlighted(), and UnSelected().
{ return 0; }
void FWGeoTopNode::UnHighlighted | ( | ) | [virtual] |
Definition at line 361 of file FWGeoTopNode.cc.
References begin, ClearSet(), fHted, i, FWGeometryTableManagerBase::kHighlighted, FWGeometryTableManagerBase::refEntries(), and tableManager().
Referenced by FWGeometryTableViewBase::setColumnSelected().
{ ClearSet(fHted); for (FWGeometryTableManagerBase::Entries_i i = tableManager()->refEntries().begin(); i != tableManager()->refEntries().end(); ++i) i->resetBit(FWGeometryTableManagerBase::kHighlighted); }
void FWGeoTopNode::UnSelected | ( | ) | [virtual] |
Definition at line 353 of file FWGeoTopNode.cc.
References begin, ClearSet(), fSted, i, FWGeometryTableManagerBase::kSelected, FWGeometryTableManagerBase::refEntries(), and tableManager().
Referenced by FWGeometryTableViewBase::setColumnSelected().
{ ClearSet(fSted); for (FWGeometryTableManagerBase::Entries_i i = tableManager()->refEntries().begin(); i != tableManager()->refEntries().end(); ++i) i->resetBit(FWGeometryTableManagerBase::kSelected); }
UChar_t FWGeoTopNode::wrapTransparency | ( | FWGeometryTableManagerBase::NodeInfo & | data, |
bool | leafNode | ||
) | [private] |
Definition at line 415 of file FWGeoTopNode.cc.
References browser(), FWGeometryTableViewBase::getLeafTransparencyFactor(), FWGeometryTableViewBase::getParentTransparencyFactor(), FWGeometryTableManagerBase::NodeInfo::m_transparency, and siStripFEDMonitor_P5_cff::Max.
Referenced by paintShape().
{ if (isParentNode) { return TMath::Max((Char_t)browser()->getMinParentTransparency(), data.m_transparency) * browser()->getParentTransparencyFactor(); } else { return TMath::Max((Char_t)browser()->getMinLeafTransparency(), data.m_transparency) * browser()->getLeafTransparencyFactor(); } }
friend class FWGeoTopNodeGL [friend] |
Definition at line 45 of file FWGeoTopNode.h.
std::set<TGLPhysicalShape*> FWGeoTopNode::fHted |
Definition at line 72 of file FWGeoTopNode.h.
Referenced by clearSelection(), FWEveDetectorGeo::GetHighlightTooltip(), FWEveOverlap::GetHighlightTooltip(), FWGeoTopNodeGL::ProcessSelection(), SetStateOf(), and UnHighlighted().
std::set<TGLPhysicalShape*> FWGeoTopNode::fSted |
Definition at line 73 of file FWGeoTopNode.h.
Referenced by clearSelection(), getFirstSelectedTableIndex(), printSelected(), FWGeoTopNodeGL::ProcessSelection(), selectPhysicalFromTable(), setPopupMenu(), SetStateOf(), and UnSelected().
Definition at line 67 of file FWGeoTopNode.h.
Referenced by FWGeometryTableViewBase::addTo(), FWGeometryTableView::FWGeometryTableView(), FWOverlapTableView::FWOverlapTableView(), paintShape(), ProcessSelection(), FWGeometryTableViewBase::refreshTable3D(), and selectPhysicalFromTable().
TGLVector3 FWGeoTopNode::s_pickedCamera3DCenter [static] |
Definition at line 85 of file FWGeoTopNode.h.
Referenced by FWGeometryTableViewBase::chosenItem(), and setPopupMenu().
TGLViewer * FWGeoTopNode::s_pickedViewer = 0 [static] |
Definition at line 86 of file FWGeoTopNode.h.
Referenced by FWGeometryTableViewBase::chosenItem(), and setPopupMenu().