33 #include "KeySymbols.h" 35 #include "TGComboBox.h" 37 #include "TGListBox.h" 38 #include "TGLViewer.h" 39 #include "TGeoMatrix.h" 41 #include "TVirtualX.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" 57 mutable std::vector<const char*>
m_list;
64 m_list.push_back(
v->GetMaterial()->GetName());
67 m_list.push_back(
v->GetMaterial()->GetTitle());
70 m_list.push_back(
v->GetShape()->GetName());
73 m_list.push_back(
v->GetShape()->ClassName());
76 std::cerr <<
"FWGeoMaterialValidator unhandeled case. \n";
79 for (
int i = 0;
i <
v->GetNdaughters(); ++
i)
99 unsigned int part_size =
part.size();
102 oOptions.push_back(std::make_pair(std::make_shared<std::string>(*
m_list.begin()),
h));
103 std::vector<const char*>::iterator startIt =
m_list.begin();
105 for (std::vector<const char*>::iterator
i = startIt;
i !=
m_list.end(); ++
i) {
107 if ((strlen(*
i) >= part_size) && strncmp(*
i,
part.c_str(), part_size) == 0) {
108 oOptions.push_back(std::make_pair(std::make_shared<std::string>((*
i)), &((*
i)[part_size])));
125 m_tableManager(nullptr),
126 m_filterEntry(nullptr),
127 m_filterValidator(nullptr),
128 m_mode(this,
"Mode", 0
l, 0
l, 1
l),
129 m_disableTopNode(this,
"HideTopNode",
true),
130 m_visLevel(this,
"VisLevel", 3
l, 1
l, 100
l),
131 m_filter(this,
"Materials",
std::
string()),
132 m_filterType(this,
"FilterType:", 0
l, 0
l, 3
l),
133 m_visLevelFilter(this,
"IgnoreVisLevelOnFilter",
true),
134 m_selectRegion(this,
"SelectNearCameraCenter",
false),
135 m_regionRadius(this,
"SphereRadius", 10.0, 1.0, 300.0),
136 m_proximityAlgo(this,
"Proximity algorithm", 1
l, 0
l, 1
l) {
138 #if ROOT_VERSION_CODE < ROOT_VERSION(5, 32, 0) 139 m_eveScene =
new FWGeoTopNodeEveScene(gls,
"TopGeoNodeScene",
"");
141 m_eveScene =
new TEveScene(gls,
"TopGeoNodeScene",
"");
154 TGHorizontalFrame*
hp =
new TGHorizontalFrame(
m_frame);
156 TGTextButton* rb =
new TGTextButton(
hp,
"CdTop");
157 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
158 rb->Connect(
"Clicked()",
"FWGeometryTableViewBase",
this,
"cdTop()");
161 TGTextButton* rb =
new TGTextButton(
hp,
"CdUp");
162 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
163 rb->Connect(
"Clicked()",
"FWGeometryTableViewBase",
this,
"cdUp()");
167 hp->AddFrame(
m_viewBox,
new TGLayoutHints(kLHintsExpandY, 2, 2, 0, 0));
178 TGFrame* pframe = ptr->build(
hp,
false);
179 hp->AddFrame(pframe,
new TGLayoutHints(kLHintsLeft));
183 hp->AddFrame(
new TGLabel(
hp,
"FilterExp:"),
new TGLayoutHints(kLHintsBottom, 0, 0, 0, 2));
188 hp->AddFrame(
m_filterEntry,
new TGLayoutHints(kLHintsExpandX, 0, 2, 1, 0));
191 m_filterEntry->Connect(
"ReturnPressed()",
"FWGeometryTableView",
this,
"filterTextEntryCallback()");
193 gVirtualX->GrabKey(
m_filterEntry->GetId(), gVirtualX->KeysymToKeycode((
int)kKey_A), kKeyControlMask,
true);
195 m_frame->AddFrame(
hp,
new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 2, 0));
307 TGTextButton* butt =
new TGTextButton(gui.
getTabContainer(),
"ReloadColors");
331 if (strstr(
v->GetElementName(),
"3D")) {
332 for (TEveElement::List_i eit =
v->BeginChildren(); eit !=
v->EndChildren(); ++eit) {
333 TEveScene*
s = ((TEveSceneInfo*)*eit)->GetScene();
334 if (el &&
s->HasChildren() &&
s->FirstChild() == el)
343 double* center =
nullptr;
344 for (TEveElement::List_i
it = gEve->GetViewers()->BeginChildren();
it != gEve->GetViewers()->EndChildren(); ++
it) {
345 TEveViewer*
v = ((TEveViewer*)(*
it));
350 center =
v->GetGLViewer()->CurrentCamera().GetCenterVec();
352 "Center picked (%.1f, %.1f, %.1f) from first selected 3D view \n", center[0], center[1], center[2]);
379 (*it)->setFrom(iFrom);
FWGeometryTableView * m_browser
FWGeoTopNode * m_eveTopNode
std::vector< const char * > m_list
TGListBox * getListBox() const
void autoExpandCallback()
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)
ViewerParameterGUI & requestTab(const char *)
FWGeometryTableView(TEveWindowSlot *iParent, FWColorManager *colMng)
const FWConfiguration * m_viewersConfig
ViewerParameterGUI & separator()
FWBoolParameter m_selectRegion
FWLongParameter m_autoExpand
void checkRegionOfInterest(double *center, double radius, long algo)
void checkRegionOfInterest()
FWLongParameter m_minParentTransparency
FWBoolParameter m_disableTopNode
std::vector< FWParameterBase * >::const_iterator const_iterator
virtual void refreshTable3D()
const_iterator end() const
const std::string & name() 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 *)
virtual void addDaughtersRec(TGeoVolume *v) const
bool addEntry(Long_t id, const std::string &txt)
FWLongParameter m_topNodeIdx
std::shared_ptr< FWParameterSetterBase > m_filterTypeSetter
FWGeometryTableManager * m_tableManager
TGCompositeFrame * m_frame
void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const override
FWGeoMaterialValidator(FWGeometryTableView *v)
bool isStringValid(std::string &exp)
void setMaxListBoxHeight(UInt_t x)
int getTopNodeIdx() const
int getFilterType() const
FWLongParameter m_minLeafTransparency
bool viewIsChecked(TEveViewer *v, TEveElement *el)
void setFrom(const FWConfiguration &) override
void loadGeometry(TGeoNode *iGeoTopNode, TObjArray *iVolumes)
ViewerParameterGUI & addParam(const FWParameterBase *)
FWGeometryTableManagerBase * getTableManager() override
TGCompositeFrame * getTabContainer()
static TGeoManager * getGeoMangeur()
const FWConfiguration * valueForKey(const std::string &iKey) const
static std::shared_ptr< FWParameterSetterBase > makeSetterFor(FWParameterBase *)
void updateVisibilityTopNode()
void setVisibility(NodeInfo &nodeInfo, bool) override
FWBoolParameter m_visLevelFilter
FWEnumParameter m_proximityAlgo
void filterTextEntryCallback()
sigc::signal< void(T)> changed_
void populateController(ViewerParameterGUI &) const override
Entries_v::iterator Entries_i
FWGUIValidatingTextEntry * m_filterEntry
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void redrawTable(bool setExpand=false)
void filterListCallback()
~FWGeoMaterialValidator() override
~FWGeometryTableView() override
void setVisibilityChld(NodeInfo &nodeInfo, bool) override