17using namespace std::string_literals;
35 if (use_server_threads)
39 fWebWindow->SetDefaultPage(
"file:rootui5sys/geom/index.html");
42 fDesc.AddSignalHandler(
this, [
this](
const std::string &kind) {
ProcessSignal(kind); });
50 fDesc.RemoveSignalHandler(
this);
60 if (arg.compare(0, 6,
"BRREQ:") == 0) {
62 auto json =
fDesc.ProcessBrowserRequest(arg.substr(6));
63 if (json.length() > 0)
65 }
else if (arg.compare(0, 7,
"SEARCH:") == 0) {
67 std::string query = arg.substr(7);
70 std::string hjson, json;
71 fDesc.SearchVisibles(query, hjson, json);
75 if (
fDesc.SetSearch(query, json))
76 fDesc.IssueSignal(
this, json.empty() ?
"ClearSearch" :
"ChangeSearch");
78 fDesc.SetSearch(
""s,
""s);
79 fDesc.IssueSignal(
this,
"ClearSearch");
82 auto connids =
fWebWindow->GetConnections(connid);
84 for (
auto id : connids)
87 }
else if (arg.compare(0, 7,
"SETTOP:") == 0) {
89 if (path &&
fDesc.SelectTop(*path)) {
90 fDesc.IssueSignal(
this,
"SelectTop");
91 auto connids =
fWebWindow->GetConnections(connid);
93 for (
auto id : connids)
96 }
else if (arg.compare(0, 6,
"HOVER:") == 0) {
99 auto stack =
fDesc.MakeStackByPath(*path);
100 if (
fDesc.SetHighlightedItem(stack))
101 fDesc.IssueSignal(
this,
"HighlightItem");
103 }
else if (arg.compare(0, 6,
"CLICK:") == 0) {
106 auto stack =
fDesc.MakeStackByPath(*path);
107 if (
fDesc.SetClickedItem(stack))
108 fDesc.IssueSignal(
this,
"ClickItem");
110 }
else if ((arg.compare(0, 7,
"SETVI0:") == 0) || (arg.compare(0, 7,
"SETVI1:") == 0)) {
115 bool on = (arg[5] ==
'1');
117 if (path &&
fDesc.ChangeNodeVisibility(*path, on))
118 fDesc.IssueSignal(
this,
"NodeVisibility");
120 }
else if ((arg.compare(0, 5,
"SHOW:") == 0) || (arg.compare(0, 5,
"HIDE:") == 0)) {
122 if (path &&
fDesc.SetPhysNodeVisibility(*path, arg.compare(0, 5,
"SHOW:") == 0))
123 fDesc.IssueSignal(
this,
"NodeVisibility");
124 }
else if (arg.compare(0, 6,
"CLEAR:") == 0) {
126 if (path &&
fDesc.ClearPhysNodeVisibility(*path))
127 fDesc.IssueSignal(
this,
"NodeVisibility");
128 }
else if (arg ==
"CLEARALL"s) {
129 if (
fDesc.ClearAllPhysVisibility())
130 fDesc.IssueSignal(
this,
"NodeVisibility");
142 fWebWindow->SetUserArgs(
"{ show_columns: true, only_hierarchy: true }");
169 if (kind ==
"HighlightItem") {
170 auto stack =
fDesc.GetHighlightedItem();
171 auto path =
fDesc.MakePathByStack(stack);
176 }
else if (kind ==
"NodeVisibility") {
180 }
else if (kind ==
"ActiveItem") {
void Show(const RWebDisplayArgs &args="")
Show hierarchy in web window.
void Update()
Update client - reload hierarchy.
RGeomHierarchy(RGeomDescription &desc, bool use_server_threads=false)
constructor
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
virtual ~RGeomHierarchy()
destructor
void ClearOnClose(const std::shared_ptr< void > &handle)
Set handle which will be cleared when connection is closed Must be called after window is shown.
void BrowseTo(const std::string &itemname)
Let browse to specified location.
void ProcessSignal(const std::string &kind)
Process signals from geometry description object.
virtual void WebWindowCallback(unsigned connid, const std::string &arg)
Process data from client.
RGeomDescription & fDesc
! geometry description, shared with external
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
const std::string & GetWidgetKind() const
returns widget kind
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
static unsigned ShowWindow(std::shared_ptr< RWebWindow > window, const RWebDisplayArgs &args="")
Static method to show web window Has to be used instead of RWebWindow::Show() when window potentially...
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
static Bool_t FromJSON(T *&obj, const char *json)