14 #include <boost/bind.hpp> 33 #include "KeySymbols.h" 35 #include "TGComboBox.h" 37 #include "TGListBox.h" 38 #include "TGLViewer.h" 39 #include "TGeoMatrix.h" 42 #include "TEveViewer.h" 43 #include "TEveScene.h" 44 #include "TEveSceneInfo.h" 45 #include "TEveManager.h" 46 #include "TGeoManager.h" 47 #include "TGLCamera.h" 61 mutable std::vector<const char*>
m_list;
70 m_list.push_back(v->GetMaterial()->GetName());
73 m_list.push_back(v->GetMaterial()->GetTitle());
76 m_list.push_back(v->GetShape()->GetName());
79 m_list.push_back(v->GetShape()->ClassName());
82 std::cerr <<
"FWGeoMaterialValidator unhandeled case. \n";
85 for (
int i = 0;
i < v->GetNdaughters(); ++
i)
90 void fillOptions(
const char* iBegin,
const char* iEnd, std::vector<std::pair<std::shared_ptr<std::string>,
std::string> >& oOptions)
const override 101 std::vector<const char*>::iterator
ui =
std::unique(m_list.begin(), m_list.end());
102 m_list.resize(ui - m_list.begin());
105 unsigned int part_size = part.size();
108 oOptions.push_back(std::make_pair(std::make_shared<std::string>(*m_list.begin()), h));
109 std::vector<const char*>::iterator startIt = m_list.begin(); startIt++;
110 for (std::vector<const char*>::iterator
i = startIt;
i!=m_list.end(); ++
i)
113 if ((strlen(*
i) >= part_size) && strncmp(*
i, part.c_str(), part_size ) == 0)
115 oOptions.push_back(std::make_pair(std::make_shared<std::string>((*
i)),&((*
i)[part_size]) ));
137 m_mode(this,
"Mode", 0
l, 0
l, 1
l),
138 m_disableTopNode(this,
"HideTopNode",
true),
139 m_visLevel(this,
"VisLevel", 3
l, 1
l, 100
l),
140 m_filter(this,
"Materials",
std::
string()),
141 m_filterType(this,
"FilterType:", 0
l, 0
l, 3
l),
142 m_visLevelFilter(this,
"IgnoreVisLevelOnFilter",
true),
143 m_selectRegion(this,
"SelectNearCameraCenter",
false),
144 m_regionRadius(this,
"SphereRadius", 10.0, 1.0, 300.0),
145 m_proximityAlgo(this,
"Proximity algorithm", 1
l, 0
l, 1
l)
148 #if ROOT_VERSION_CODE < ROOT_VERSION(5,32,0) 149 m_eveScene =
new FWGeoTopNodeEveScene(gls,
"TopGeoNodeScene",
"");
151 m_eveScene =
new TEveScene(gls,
"TopGeoNodeScene",
"");
164 TGHorizontalFrame *
hp =
new TGHorizontalFrame(
m_frame);
166 TGTextButton *rb =
new TGTextButton (hp,
"CdTop");
167 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0) );
168 rb->Connect(
"Clicked()",
"FWGeometryTableViewBase",
this,
"cdTop()");
171 TGTextButton *rb =
new TGTextButton (hp,
"CdUp");
172 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
173 rb->Connect(
"Clicked()",
"FWGeometryTableViewBase",
this,
"cdUp()");
177 hp->AddFrame(
m_viewBox,
new TGLayoutHints(kLHintsExpandY, 2, 2, 0, 0));
189 TGFrame* pframe = ptr->build(hp,
false);
190 hp->AddFrame(pframe,
new TGLayoutHints(kLHintsLeft));
194 hp->AddFrame(
new TGLabel(hp,
"FilterExp:"),
new TGLayoutHints(kLHintsBottom, 0, 0, 0, 2));
199 hp->AddFrame(
m_filterEntry,
new TGLayoutHints(kLHintsExpandX, 0, 2, 1, 0));
202 m_filterEntry->Connect(
"ReturnPressed()",
"FWGeometryTableView",
this,
"filterTextEntryCallback()");
204 gVirtualX->GrabKey(
m_filterEntry->GetId(),gVirtualX->KeysymToKeycode((
int)kKey_A), kKeyControlMask,
true);
206 m_frame->AddFrame(hp,
new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 2, 2, 2, 0));
327 TGTextButton* butt =
new TGTextButton(gui.
getTabContainer(),
"ReloadColors");
353 if (strstr( v->GetElementName(),
"3D") )
355 for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit )
357 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
358 if (el && s->HasChildren() && s->FirstChild() == el)
370 double* center =
nullptr;
371 for (TEveElement::List_i it = gEve->GetViewers()->BeginChildren(); it != gEve->GetViewers()->EndChildren(); ++it)
373 TEveViewer*
v = ((TEveViewer*)(*it));
379 center = v->GetGLViewer()->CurrentCamera().GetCenterVec();
380 fwLog(
fwlog::kInfo) << Form(
"Center picked (%.1f, %.1f, %.1f) from first selected 3D view \n",
381 center[0], center[1], center[2]);
413 (*it)->setFrom(iFrom);
FWGeometryTableView * m_browser
FWGeoTopNode * m_eveTopNode
std::vector< const char * > m_list
std::vector< FWParameterBase * >::const_iterator const_iterator
void autoExpandCallback()
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
FWGeoTopNode * m_eveTopNode
const_iterator begin() const
void updateFilter(std::string &)
void setPath(int, std::string &) override
FWGeoMaterialValidator * m_filterValidator
FWDoubleParameter m_regionRadius
void setTopNodePathFromConfig(const FWConfiguration &iFrom)
void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const override
ViewerParameterGUI & requestTab(const char *)
FWGeometryTableView(TEveWindowSlot *iParent, FWColorManager *colMng)
const FWConfiguration * m_viewersConfig
int getFilterType() const
FWBoolParameter m_selectRegion
FWLongParameter m_autoExpand
void checkRegionOfInterest(double *center, double radius, long algo)
void checkRegionOfInterest()
FWLongParameter m_minParentTransparency
FWBoolParameter m_disableTopNode
sigc::signal< void, T > changed_
virtual void refreshTable3D()
virtual void addDaughtersRec(TGeoVolume *v) const
FWEnumParameter m_filterType
FWGeoTopNodeGLScene * m_scene
void setLevelOffset(int x)
FWLongParameter m_visLevel
def unique(seq, keepstr=True)
FWStringParameter m_filter
void resetRegionOfInterest()
void setValidator(FWValidatorBase *)
const_iterator end() const
bool addEntry(Long_t id, const std::string &txt)
FWLongParameter m_topNodeIdx
std::shared_ptr< FWParameterSetterBase > m_filterTypeSetter
TGListBox * getListBox() const
FWGeometryTableManager * m_tableManager
TGCompositeFrame * m_frame
FWGeoMaterialValidator(FWGeometryTableView *v)
bool isStringValid(std::string &exp)
void setMaxListBoxHeight(UInt_t x)
FWLongParameter m_minLeafTransparency
bool viewIsChecked(TEveViewer *v, TEveElement *el)
void setFrom(const FWConfiguration &) override
void loadGeometry(TGeoNode *iGeoTopNode, TObjArray *iVolumes)
void populateController(ViewerParameterGUI &) const override
FWGeometryTableManagerBase * getTableManager() override
TGCompositeFrame * getTabContainer()
static TGeoManager * getGeoMangeur()
static std::shared_ptr< FWParameterSetterBase > makeSetterFor(FWParameterBase *)
void updateVisibilityTopNode()
void setVisibility(NodeInfo &nodeInfo, bool) override
int getTopNodeIdx() const
FWBoolParameter m_visLevelFilter
FWEnumParameter m_proximityAlgo
const FWConfiguration * valueForKey(const std::string &iKey) const
void filterTextEntryCallback()
Entries_v::iterator Entries_i
FWGUIValidatingTextEntry * m_filterEntry
void redrawTable(bool setExpand=false)
void filterListCallback()
~FWGeoMaterialValidator() override
~FWGeometryTableView() override
void setVisibilityChld(NodeInfo &nodeInfo, bool) override
const std::string & name() const