73 const std::string &
GetName()
const {
return fDesc.
fDesc[fNodeId].name; }
75 const std::string &
GetColor()
const {
return fDesc.
fDesc[fNodeId].color; }
81 bool IsValid()
const {
return fNodeId >= 0; }
87 int NumChilds()
const {
return (fNodeId < 0) ? 1 : fDesc.
fDesc[fNodeId].chlds.size(); }
97 if (fNodeId >= (
int)fDesc.
fDesc.size())
100 auto &node = fDesc.
fDesc[fNodeId];
101 if (node.chlds.empty())
103 fStackParents.emplace_back(fParentId);
104 fStackChilds.emplace_back(fChild);
107 fNodeId = node.chlds[fChild];
113 if (fStackParents.empty()) {
117 fParentId = fStackParents.back();
118 fChild = fStackChilds.back();
120 fStackParents.pop_back();
121 fStackChilds.pop_back();
126 fNodeId = fDesc.
fDesc[fParentId].chlds[fChild];
134 if ((fNodeId <= 0) || (fParentId < 0)) {
140 if (++fChild >=
prnt.chlds.size()) {
145 fNodeId =
prnt.chlds[fChild];
154 fStackParents.clear();
155 fStackChilds.clear();
179 size_t pos = path.find(
'/');
185 while (++pos < path.length()) {
188 pos = path.find(
'/', last);
190 if (pos == std::string::npos)
193 std::string
folder = path.substr(last, pos - last);
201 find = (
folder.compare(GetName()) == 0);
202 }
while (!find && Next());
212 bool Navigate(
const std::vector<std::string> &path)
216 for (
auto &
folder : path) {
224 find = (
folder.compare(GetName()) == 0);
225 }
while (!find && Next());
250 std::vector<int> res;
252 for (
unsigned n = 1;
n < fStackParents.size(); ++
n)
253 res.emplace_back(fStackParents[
n]);
255 res.emplace_back(fParentId);
256 res.emplace_back(fNodeId);
266using namespace std::string_literals;
295 std::vector<RGeomSignalFunc_t>
funcs;
299 for (
auto &pair : fSignals)
300 if (!handler || (pair.first != handler))
301 funcs.emplace_back(pair.second);
305 for (
auto func :
funcs)
315 fSignals.emplace_back(handler, func);
325 for (
auto iter = fSignals.begin(); iter != fSignals.end(); ++iter)
326 if (handler == iter->first) {
327 fSignals.erase(iter);
397 for (
int n = 0;
n < 9; ++
n)
439 SetNSegments(
mgr->GetNsegments());
440 SetVisLevel(
mgr->GetVisLevel());
452 fSelectedStack = MakeStackByIds(iter.
CurrentIds());
470 fSelectedStack.clear();
472 BuildDescription(
nullptr, fDrawVolume);
487 fDrawVolume =
nullptr;
488 fSelectedStack.clear();
506 fNodes.emplace_back(
nullptr);
513 fNodes.emplace_back(
snode);
515 }
while ((
snode = iter()) !=
nullptr);
517 fDesc.reserve(fNodes.size());
518 fSortMap.reserve(fNodes.size());
521 std::vector<RGeomNode *>
sortarr;
522 sortarr.reserve(fNodes.size());
526 for (
auto node : fNodes) {
528 fDesc.emplace_back(node ? node->GetNumber() -
offset : 0);
531 auto &desc = fDesc[cnt++];
535 desc.name = node ? node->GetName() : vol->
GetName();
539 desc.vol =
TMath::Sqrt(shape->GetDX() * shape->GetDX() + shape->GetDY() * shape->GetDY() +
540 shape->GetDZ() * shape->GetDZ());
541 desc.nfaces = CountShapeFaces(shape);
544 CopyMaterialProperties(vol, desc);
546 auto chlds = node ? node->GetNodes() : vol->
GetNodes();
548 PackMatrix(desc.matr, node ? node->GetMatrix() :
nullptr);
551 for (
int n = 0;
n <= chlds->GetLast(); ++
n) {
553 desc.chlds.emplace_back(
chld->GetNumber() -
offset);
559 for (
auto node : fNodes) {
562 node->SetNumber(number);
570 fSortMap.emplace_back(
elem->id);
571 elem->sortid = cnt++;
585 auto node = fNodes[nodeid];
587 return node->GetVolume();
588 return nodeid == 0 ? fDrawVolume :
nullptr;
597 for (
int nodeid = 0; nodeid < (
int)fNodes.size(); nodeid++) {
599 auto node = fNodes[nodeid];
600 auto vol = GetVolume(nodeid);
601 auto &desc = fDesc[nodeid];
603 desc.nochlds =
false;
606 if (!node || node->IsOnScreen())
612 if (node && !node->IsVisDaughters())
615 if ((desc.vis > 0) && (!desc.chlds.empty()) && !desc.nochlds)
619 if (desc.IsVisible() && desc.CanDisplay())
631 for (
auto &node : fDesc)
637 if (node.idshift < 0) {
639 for (
auto id : node.chlds)
643 return node.idshift + 1;
658 std::vector<int> stack;
666 if (!
is_inside && (fSelectedStack == stack))
669 auto &desc = fDesc[nodeid];
673 if (desc.nochlds && (
lvl > 0))
680 desc_vis = !
viter->visible ? 0 : (!desc.chlds.empty() ? 1 : 99);
694 auto pos = stack.size();
695 stack.emplace_back(0);
696 for (
unsigned k = 0; k < desc.chlds.size(); ++k) {
702 counter += desc.idshift;
708 if (!
maxlvl && (GetVisLevel() > 0))
728 for (
auto &node : fDesc)
729 drawing.
nodes.emplace_back(&node);
734 for (
auto &node : fDesc)
735 node.useflag =
false;
740 auto &node = fDesc[nodeid];
743 drawing.
nodes.emplace_back(&node);
745 if (
chindx >= (
int)node.chlds.size())
747 nodeid = node.chlds[
chindx];
750 if (nodeid !=
item.nodeid)
751 printf(
"Nodeid mismatch %d != %d when extracting nodes for visibles\n", nodeid,
item.nodeid);
753 auto &node = fDesc[nodeid];
756 drawing.
nodes.emplace_back(&node);
780 return GetNumNodes() < (IsPreferredOffline() ? 1000000 : 1000);
793 auto request = TBufferJSON::FromJSON<RBrowserRequest>(
msg);
796 request = std::make_unique<RBrowserRequest>();
798 request->number = 100;
804 if (request->path.empty() && (request->first == 0) && IsFullModelStreamedAtOnce()) {
806 std::vector<RGeomNodeBase *>
vect(fDesc.size(),
nullptr);
809 for (
auto &
item : fDesc)
814 if (!fVisibility.empty()) {
815 res +=
":__PHYSICAL_VISIBILITY__:";
819 res +=
":__SELECTED_STACK__:";
824 bool toplevel = request->path.empty();
828 reply.path = request->path;
829 reply.first = request->first;
838 while ((request->first > 0) && iter.
Next()) {
843 auto stack = MakeStackByIds(iter.
CurrentIds());
845 while (iter.
IsValid() && (request->number > 0)) {
846 int pvis = IsPhysNodeVisible(stack);
851 if (stack == fSelectedStack)
859 stack[stack.size() - 1]++;
868 reply.nodes.emplace_back(&
n);
882 for (
auto &
descr : fShapes)
883 if (
descr.fShape == shape)
886 fShapes.emplace_back(shape);
887 auto &
elem = fShapes.back();
888 elem.id = fShapes.size() - 1;
899 std::unique_ptr<RootCsg::TBaseMesh> res;
907 for (
UInt_t i = 0; i <
b3d->NbPnts(); ++i) {
909 buf[1] =
v[i * 3 + 1];
910 buf[2] =
v[i * 3 + 2];
915 res.reset(RootCsg::ConvertToMesh(*
b3d.get()));
917 auto node =
comp->GetBoolNode();
925 mleft.
Multiply(node->GetLeftMatrix());
926 auto left =
MakeGeoMesh(&mleft, node->GetLeftShape());
928 mright.
Multiply(node->GetRightMatrix());
929 auto right =
MakeGeoMesh(&mright, node->GetRightShape());
932 res.reset(RootCsg::BuildUnion(left.get(), right.get()));
934 res.reset(RootCsg::BuildIntersection(left.get(), right.get()));
936 res.reset(RootCsg::BuildDifference(left.get(), right.get()));
949 if (GetNSegments() > 0)
950 nsegm = GetNSegments();
954 return nsegm > min ? nsegm : min;
1010 cone->GetPhi2() -
cone->GetPhi1());
1017 tube->GetPhi2() -
tube->GetPhi1());
1021 tube->GetPhi2() -
tube->GetPhi1());
1023 return GetUsedNSegments(4) * 4;
1049 return (
xtru->GetNz() - 1) *
xtru->GetNvert() * 2 +
xtru->GetNvert() * 3;
1054 if (
para->GetRlo() == 0.)
1056 if (
para->GetRhi() == 0.)
1061 if ((
hype->GetStIn() == 0) && (
hype->GetStOut() == 0))
1068 for (
int i = 0; i <
tess->GetNfacets(); ++i) {
1069 if (
tess->GetFacet(i).GetNvert() == 4)
1077 return CountShapeFaces(
scaled->GetShape());
1080 if (!
comp->GetBoolNode())
1082 return CountShapeFaces(
comp->GetBoolNode()->GetLeftShape()) +
1083 CountShapeFaces(
comp->GetBoolNode()->GetRightShape());
1095 auto &
elem = FindShapeDescr(shape);
1097 if (
elem.nfaces == 0) {
1110 elem.fShapeInfo.shape = shape;
1142 auto v =
mesh->GetVertex(i);
1143 vertices[i * 3] =
v[0];
1144 vertices[i * 3 + 1] =
v[1];
1145 vertices[i * 3 + 2] =
v[2];
1148 elem.fRawInfo.raw.resize(vertices.size() *
sizeof(
float));
1150 memcpy(
reinterpret_cast<char *
>(
elem.fRawInfo.raw.data()), vertices.data(), vertices.size() *
sizeof(
float));
1162 for (
int i = 0; i < 3; ++i)
1198 node.
material = material->GetName();
1200 auto fillstyle = material->GetFillStyle();
1226 for (
auto &s : fShapes)
1257 std::vector<int>
viscnt(fDesc.size(), 0);
1259 int level = GetVisLevel();
1262 int numnodes = ScanNodes(
true, level, [&
viscnt](
RGeomNode &node, std::vector<int> &,
bool,
int) {
1267 if (GetMaxVisNodes() > 0) {
1268 while ((numnodes > GetMaxVisNodes()) && (level > 1)) {
1271 numnodes = ScanNodes(
true, level, [&
viscnt](
RGeomNode &node, std::vector<int> &,
bool,
int) {
1278 fActualLevel = level;
1287 for (
auto &
sid : fSortMap) {
1289 auto &desc = fDesc[
sid];
1291 if ((
viscnt[
sid] <= 0) || (desc.vol <= 0))
1294 auto shape = GetVolume(
sid)->GetShape();
1303 R__LOG_ERROR(
RGeomLog()) <<
"No faces for the shape " << shape->GetName() <<
" class " << shape->ClassName();
1309 if ((GetMaxVisFaces() > 0) && (
totalnumfaces > GetMaxVisFaces()))
1314 if ((GetMaxVisNodes() > 0) && (
totalnumnodes > GetMaxVisNodes()))
1325 bool has_shape =
false;
1327 ScanNodes(
true, level, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool,
int seqid) {
1329 drawing.visibles.emplace_back(node.id, seqid, stack);
1331 auto &item = drawing.visibles.back();
1332 item.color = node.color;
1333 item.opacity = node.opacity;
1335 auto volume = GetVolume(node.id);
1337 auto &sd = MakeShapeDescr(volume->GetShape());
1339 item.ri = sd.rndr_info();
1348 return MakeDrawingJson(drawing, has_shape);
1357 return (fDrawJson.length() > 0) && (fDrawIdCut > 0);
1367 if (fSearch.empty() || !fSearchJson.empty())
1372 SearchVisibles(fSearch,
hjson, fSearchJson);
1383 auto json = ProduceJson();
1387 fDrawJson =
"GDRAW:"s +
json;
1422 if ((nodeid < 0) || (nodeid >= (
int)fDesc.size()))
1425 auto &desc = fDesc[nodeid];
1427 return (desc.sortid < fDrawIdCut) && desc.IsVisible() && desc.CanDisplay() && (desc.chlds.empty());
1443 hjson =
"FOUND:RESET";
1447 std::vector<int>
nodescnt(fDesc.size(), 0),
viscnt(fDesc.size(), 0);
1450 std::string
test = find;
1452 if (
test.compare(0, 2,
"c:") == 0) {
1455 }
else if (
test.compare(0, 2,
"m:") == 0) {
1463 return (node.vol > 0) && (
TString(node.GetArg(kind)).
Index(regexp) >= 0);
1484 if ((GetMaxVisNodes() > 0) && (
nmatches > 10 * GetMaxVisNodes())) {
1495 for (
auto &
sid : fSortMap) {
1496 if (
scnt++ < fDrawIdCut)
1502 auto &desc = fDesc[
sid];
1503 if ((
viscnt[
sid] <= 0) && (desc.vol <= 0))
1506 auto shape = GetVolume(
sid)->GetShape();
1515 R__LOG_ERROR(
RGeomLog()) <<
"No faces for the shape " << shape->GetName() <<
" class " << shape->ClassName();
1521 if ((GetMaxVisFaces() > 0) && (
totalnumfaces > GetMaxVisFaces())) {
1528 if ((GetMaxVisNodes() > 0) && (
totalnumnodes > GetMaxVisNodes())) {
1541 std::vector<int>
found_map(fDesc.size(), -1);
1554 bool has_shape =
true;
1556 ScanNodes(
false, 0, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool is_vis,
int seqid) {
1563 for (
auto &s : stack) {
1591 drawing.
visibles.emplace_back(node.
id, seqid, stack);
1601 auto volume = GetVolume(node.
id);
1606 auto &
sd = MakeShapeDescr(volume->GetShape());
1608 item.ri =
sd.rndr_info();
1616 CollectNodes(drawing);
1618 json =
"FDRAW:"s + MakeDrawingJson(drawing, has_shape);
1632 for (
auto &
chindx : stack) {
1633 auto &node = fDesc[nodeid];
1634 if (
chindx >= (
int)node.chlds.size())
1636 nodeid = node.chlds[
chindx];
1649 std::vector<int> stack;
1655 printf(
"Wrong first id\n");
1661 for (
unsigned k = 1; k < ids.size(); ++k) {
1666 if (nodeid >= (
int)fDesc.size()) {
1667 printf(
"Wrong node id %d\n", nodeid);
1671 auto &chlds = fDesc[
prntid].chlds;
1672 auto pos = std::find(chlds.begin(), chlds.end(), nodeid);
1673 if (pos == chlds.end()) {
1674 printf(
"Wrong id %d not a child of %d - fail to find stack num %d\n", nodeid,
prntid, (
int)chlds.size());
1679 stack.emplace_back(std::distance(chlds.begin(), pos));
1693 std::vector<int> res;
1711 std::vector<int> ids;
1713 ids.emplace_back(0);
1715 bool failure =
false;
1717 for (
auto s : stack) {
1718 auto &chlds = fDesc[nodeid].chlds;
1719 if (s >= (
int)chlds.size()) {
1724 ids.emplace_back(chlds[s]);
1730 printf(
"Fail to convert stack into list of nodes\n");
1744 std::vector<std::string> path;
1746 auto ids = MakeIdsByStack(stack);
1747 path.reserve(ids.size());
1749 path.emplace_back(fDesc[
id].name);
1762 std::vector<RGeomNodeBase *> nodes;
1763 auto vol = GetVolume(nodeid);
1769 for (
auto &desc : fDesc)
1770 if (GetVolume(
id++) == vol)
1771 nodes.emplace_back(&desc);
1787 TGeoVolume *vol = (nodeid < 0) ?
nullptr : GetVolume(nodeid);
1796 ScanNodes(
true, 0, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool,
int seq_id) {
1800 if (GetVolume(node.
id) != vol)
1803 if (node.
id != nodeid)
1824 bool has_shape =
false, has_raw =
false;
1830 item.ri =
sd.rndr_info();
1837 CollectNodes(drawing);
1839 json.append(MakeDrawingJson(drawing, has_shape));
1841 return has_raw || has_shape;
1852 int comp = GetJsonComp();
1861 json.SetSkipClassInfo(TClass::GetClass<RGeomDrawing>());
1862 json.SetSkipClassInfo(TClass::GetClass<RGeomNode>());
1863 json.SetSkipClassInfo(TClass::GetClass<RGeomVisible>());
1864 json.SetSkipClassInfo(TClass::GetClass<RGeomShapeRenderInfo>());
1865 json.SetSkipClassInfo(TClass::GetClass<RGeomRawRenderInfo>());
1867 return json.StoreObject(&drawing, TClass::GetClass<RGeomDrawing>()).Data();
1879 if (!
giter.Navigate(path))
1882 auto nodeid =
giter.GetNodeId();
1884 auto &
dnode = fDesc[nodeid];
1886 auto vol = GetVolume(nodeid);
1889 if (vol->IsVisible() == selected)
1892 dnode.vis = selected ? 99 : 0;
1893 vol->SetVisibility(selected);
1894 if (!
dnode.chlds.empty()) {
1897 vol->SetVisDaughters(selected);
1901 for (
auto &desc : fDesc)
1902 if (GetVolume(
id++) == vol)
1903 desc.vis =
dnode.vis;
1905 auto stack = MakeStackByIds(
giter.CurrentIds());
1908 for (
auto iter = fVisibility.begin(); iter != fVisibility.end(); iter++)
1910 fVisibility.erase(iter);
1925 auto path = MakePathByStack(stack);
1929 std::unique_ptr<RGeomNodeInfo> res;
1939 res = std::make_unique<RGeomNodeInfo>();
1942 res->node_name = node ? node->GetName() :
"node_name";
1943 res->node_type = node ? node->ClassName() :
"no class";
1947 TGeoShape *shape = vol ? vol->GetShape() :
nullptr;
1950 res->shape_name = shape->
GetName();
1954 if (shape && desc.CanDisplay()) {
1979 auto stack = MakeStackByIds(iter.
CurrentIds());
1980 if (stack == fSelectedStack)
1983 fSelectedStack = stack;
2000 if (!
giter.Navigate(path))
2003 auto stack = MakeStackByIds(
giter.CurrentIds());
2005 auto nodeid =
giter.GetNodeId();
2007 for (
auto iter = fVisibility.begin(); iter != fVisibility.end(); iter++) {
2017 if ((fDesc[nodeid].vis > 0) ==
on)
2018 fVisibility.erase(iter);
2025 fVisibility.emplace(iter, stack,
on);
2031 fVisibility.emplace_back(stack,
on);
2042 std::vector<std::string> path;
2043 std::string::size_type
p1 = 0;
2051 if (
p == std::string::npos) {
2060 return SetPhysNodeVisibility(path,
on);
2069 for (
auto &
item : fVisibility) {
2070 unsigned sz =
item.stack.size();
2071 if (stack.size() <
sz)
2074 for (
unsigned n = 0;
n <
sz; ++
n)
2075 if (stack[
n] !=
item.stack[
n]) {
2081 return item.visible ? 1 : 0;
2095 if (!
giter.Navigate(path))
2098 auto stack = MakeStackByIds(
giter.CurrentIds());
2100 for (
auto iter = fVisibility.begin(); iter != fVisibility.end(); iter++)
2102 fVisibility.erase(iter);
2117 if (fVisibility.empty())
2120 fVisibility.clear();
2131 auto cfg = TBufferJSON::FromJSON<RGeomConfig>(
json);
2169 std::string prefix =
" ";
2171 if (fCfg.vislevel != 0)
2172 fs << prefix <<
name <<
"SetVisLevel(" << fCfg.vislevel <<
");" << std::endl;
2173 if (fCfg.maxnumnodes != 0)
2174 fs << prefix <<
name <<
"SetMaxVisNodes(" << fCfg.maxnumnodes <<
");" << std::endl;
2175 if (fCfg.maxnumfaces != 0)
2176 fs << prefix <<
name <<
"SetMaxVisFaces(" << fCfg.maxnumfaces <<
");" << std::endl;
2178 fs << prefix <<
name <<
"SetTopVisible(true);" << std::endl;
2179 if (fCfg.build_shapes != 1)
2180 fs << prefix <<
name <<
"SetBuildShapes(" << fCfg.build_shapes <<
");" << std::endl;
2181 if (fCfg.nsegm != 0)
2182 fs << prefix <<
name <<
"SetNSegments(" << fCfg.nsegm <<
");" << std::endl;
2183 if (!fCfg.drawopt.empty())
2184 fs << prefix <<
name <<
"SetDrawOptions(\"" << fCfg.drawopt <<
"\");" << std::endl;
2186 fs << prefix <<
name <<
"SetJsonComp(" << fJsonComp <<
");" << std::endl;
2189 for (
auto &
item : fVisibility) {
2190 auto path = MakePathByStack(
item.stack);
2191 fs << prefix <<
name <<
"SetPhysNodeVisibility(";
2192 for (
int i = 0; i < (
int)path.size(); ++i)
2193 fs << (i == 0 ?
"{\"" :
", \"") << path[i] <<
"\"";
2194 fs <<
"}, " << (
item.visible ?
"true" :
"false") <<
");" << std::endl;
std::unique_ptr< RootCsg::TBaseMesh > MakeGeoMesh(TGeoMatrix *matr, TGeoShape *shape)
Function produces mesh for provided shape, applying matrix to the result.
#define R__LOG_ERROR(...)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
R__EXTERN TGeoManager * gGeoManager
Reply on browser request.
Representation of single item in the geometry browser.
Iterator of hierarchical geometry structures.
RGeomBrowserIter(RGeomDescription &desc)
std::vector< int > CurrentIds() const
Returns array of ids to currently selected node.
bool Navigate(TGeoVolume *vol)
Navigate to specified volume - find first occurrence.
std::vector< int > fStackChilds
bool Navigate(const std::string &path)
Navigate to specified path - path specified as string and should start with "/".
const std::string & GetMaterial() const
std::vector< int > fStackParents
const std::string & GetColor() const
const std::string & GetName() const
bool Navigate(const std::vector< std::string > &path)
Navigate to specified path
int IsPhysNodeVisible(const std::vector< int > &stack)
Check if there special settings for specified physical node returns -1 if nothing is found.
std::string ProcessBrowserRequest(const std::string &req="")
Find description object for requested shape If not exists - will be created.
std::vector< RGeomNode > fDesc
! converted description, send to client
void PackMatrix(std::vector< float > &arr, TGeoMatrix *matr)
Pack matrix into vector, which can be send to client Following sizes can be used for vector: 0 - Iden...
bool ProduceDrawingFor(int nodeid, std::string &json, bool check_volume=false)
Produce shape rendering data for given stack All nodes, which are referencing same shape will be tran...
std::unique_ptr< RGeomNodeInfo > MakeNodeInfo(const std::vector< int > &stack)
Change visibility for specified element Returns true if changes was performed.
bool HasDrawData() const
Check if there is draw data available.
std::vector< int > MakeIdsByStack(const std::vector< int > &stack)
Produce list of node ids for given stack If found nodes preselected - use their ids.
int MarkVisible(bool on_screen=false)
Set visibility flag for each nodes.
void IssueSignal(const void *handler, const std::string &kind)
Issue signal, which distributed on all handlers - excluding source handler.
int GetUsedNSegments(int min=20)
Returns really used number of cylindrical segments.
bool IsPrincipalEndNode(int nodeid)
return true when node used in main geometry drawing and does not have childs for such nodes one could...
bool SetSearch(const std::string &query, const std::string &json)
Change search query and belongs to it json string Returns true if any parameter was really changed.
bool SelectTop(const std::vector< std::string > &path)
Select top node by path Used by the client to change active node Returns true if selected node was ch...
void ClearCache()
Clear cached data, need to be clear when connection broken.
virtual void RefineGeoItem(RGeoItem &item, const std::vector< int > &stack)
Method which allows to add/modify information in RGeoItem which will be provided to client - like tit...
void ClearDescription()
Clear geometry description.
std::vector< int > MakeStackByIds(const std::vector< int > &ids)
Creates stack for given array of ids, first element always should be 0.
bool ChangeNodeVisibility(const std::vector< std::string > &path, bool on)
Change visibility for specified element Returns true if changes was performed.
void SavePrimitive(std::ostream &fs, const std::string &name)
Save geometry configuration as C++ macro.
bool ClearAllPhysVisibility()
Reset all custom visibility settings.
std::string MakeDrawingJson(RGeomDrawing &drawing, bool has_shapes=false)
Produce JSON for the drawing If TGeoShape appears in the drawing, one has to keep typeinfo But in thi...
TGeoVolume * GetVolume(int nodeid)
Get volume for specified nodeid If specific volume was configured, it will be returned for nodeid==0.
void ProduceDrawData()
Collect all information required to draw geometry on the client This includes list of each visible no...
bool SetPhysNodeVisibility(const std::vector< std::string > &path, bool on=true)
Set visibility of physical node by path It overrules TGeo visibility flags - but only for specific ph...
bool ClearPhysNodeVisibility(const std::vector< std::string > &path)
Reset custom visibility of physical node by path.
void BuildDescription(TGeoNode *topnode, TGeoVolume *topvolume)
Build geometry description.
int SearchVisibles(const std::string &find, std::string &hjson, std::string &json)
Search visible nodes for provided name If number of found elements less than 100, create description ...
std::string ProduceJson(bool all_nodes=false)
Produce JSON string which can be directly used with build function from JSROOT to create three....
void ClearDrawData()
Clear drawing data.
std::vector< std::string > MakePathByStack(const std::vector< int > &stack)
Returns path string for provided stack.
void AddSignalHandler(const void *handler, RGeomSignalFunc_t func)
Add signal handler.
bool ChangeConfiguration(const std::string &json)
Change configuration by client Returns true if any parameter was really changed.
void CopyMaterialProperties(TGeoVolume *vol, RGeomNode &node)
Copy material properties.
std::vector< int > MakeStackByPath(const std::vector< std::string > &path)
Produce stack based on string path Used to highlight geo volumes by browser hover event.
int ScanNodes(bool only_visible, int maxlvl, RGeomScanFunc_t func)
Iterate over all nodes and call function for visible.
void ProduceSearchData()
Produces search data if necessary.
void CollectNodes(RGeomDrawing &drawing, bool all_nodes=false)
Collect nodes which are used in visibles.
int CountShapeFaces(TGeoShape *shape)
Count number of faces for the shape.
ShapeDescr & MakeShapeDescr(TGeoShape *shape)
Find description object and create render information.
ShapeDescr & FindShapeDescr(TGeoShape *shape)
Find description object for requested shape If not exists - will be created.
void RemoveSignalHandler(const void *handler)
Remove signal handler.
int FindNodeId(const std::vector< int > &stack)
Returns nodeid for given stack array, returns -1 in case of failure.
void ProduceIdShifts()
Count total number of visible childs under each node.
std::string ProduceModifyReply(int nodeid)
Return string with only part of nodes description which were modified Checks also volume.
void ResetRndrInfos()
Reset shape info, which used to pack binary data.
virtual bool IsFullModelStreamedAtOnce() const
Decide if the whole model is streamed at once Function is called from ProcessBrowserRequest.
void Build(TGeoManager *mgr, const std::string &volname="")
Collect information about geometry hierarchy into flat list like it done in JSROOT ClonedNodes....
Object with full description for drawing geometry It includes list of visible items and list of nodes...
int numnodes
total number of nodes in description
std::vector< RGeomVisible > visibles
all visible items
RGeomConfig * cfg
current configurations
std::vector< RGeomNode * > nodes
all used nodes to display visible items and not known for client
std::string material
name of the material
int sortid
! place in sorted array, to check cuts, or id of original node when used search structures
std::string color
rgb code in hex format
int id
node id, index in array
Full node description including matrices and other attributes.
float opacity
! opacity of the color
A log configuration for a channel, e.g.
const_iterator begin() const
const_iterator end() const
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Color_t GetLineColor() const
Return the line color.
Class for serializing object to and from JavaScript Object Notation (JSON) format.
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kSkipTypeInfo
do not store typenames in JSON
void SetCompact(int level)
Set level of space/newline/array compression Lower digit of compact parameter define formatting rules...
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Composite shapes are Boolean combinations of two or more shape components.
A cone segment is a cone having a range in phi.
The cones are defined by 5 parameters:
The cut tubes constructor has the form:
Matrix class used for computing global transformations Should NOT be used for node definition.
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
void Skip()
Stop iterating the current branch.
The manager class for any TGeo geometry.
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
virtual const Double_t * GetTranslation() const =0
TClass * IsA() const override
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
virtual const Double_t * GetScale() const =0
Bool_t IsIdentity() const
virtual const Double_t * GetRotationMatrix() const =0
TGeoMaterial * GetMaterial() const
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
A paraboloid is defined by the revolution surface generated by a parabola and is bounded by two plane...
A polycone is represented by a sequence of tubes/cones, glued together at defined Z planes.
Polygons are defined in the same way as polycones, the difference being just that the segments betwee...
A shape scaled by a TGeoScale transformation.
Base abstract class for all shapes.
virtual Bool_t IsComposite() const
virtual Bool_t IsCylType() const =0
const char * GetName() const override
Get the shape name.
TClass * IsA() const override
virtual TBuffer3D * MakeBuffer3D() const
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
The torus is defined by its axial radius, its inner and outer radius.
A tube segment is a tube having a range in phi.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
TGeoMedium * GetMedium() const
static TGeoMedium * DummyMedium()
TGeoShape * GetShape() const
A TGeoXtru shape is represented by the extrusion of an arbitrary polygon with fixed outline between s...
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Regular expression class.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.
std::function< bool(RGeomNode &, std::vector< int > &, bool, int)> RGeomScanFunc_t
std::function< void(const std::string &)> RGeomSignalFunc_t
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.