101 if (node.chlds.size() == 0)
140 if (++
fChild >= prnt.chlds.size()) {
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;
266using namespace std::string_literals;
270int compare_stacks(
const std::vector<int> &stack1,
const std::vector<int> &stack2)
272 unsigned len1 = stack1.size(), len2 = stack2.size(),
len = (len1 < len2) ? len1 : len2, indx = 0;
274 if (stack1[indx] < stack2[indx])
276 if (stack1[indx] > stack2[indx])
295 std::vector<RGeomSignalFunc_t>
funcs;
300 if (!handler || (pair.first != handler))
301 funcs.emplace_back(pair.second);
305 for (
auto func :
funcs)
315 fSignals.emplace_back(handler, func);
326 if (handler == iter->first) {
355 if (!is_translate && !is_scale && !is_rotate) {
358 auto test = [](
double val,
double chk) {
return (val == chk) || (
TMath::Abs(val - chk) < 1
e-20); };
360 bool no_scale =
test(scale[0], 1) &&
test(scale[1], 1) &&
test(scale[2], 1);
361 bool no_trans =
test(trans[0], 0) &&
test(trans[1], 0) &&
test(trans[2], 0);
362 bool no_rotate =
test(rotate[0], 1) &&
test(rotate[1], 0) &&
test(rotate[2], 0) &&
test(rotate[3], 0) &&
363 test(rotate[4], 1) &&
test(rotate[5], 0) &&
test(rotate[6], 0) &&
test(rotate[7], 0) &&
366 if (no_scale && no_trans && no_rotate)
369 if (no_scale && no_trans && !no_rotate) {
371 }
else if (no_scale && !no_trans && no_rotate) {
373 }
else if (!no_scale && no_trans && no_rotate) {
397 for (
int n = 0;
n < 9; ++
n)
413 vect[10] = rotate[8];
442 SetMaxVisFaces((maxnodes > 5000 ? 5000 : (maxnodes < 1000 ? 1000 : maxnodes)) * 100);
448 if (!volname.empty()) {
449 auto vol = mgr->
GetVolume(volname.c_str());
451 if (vol && (vol != topnode->GetVolume()) && iter.
Navigate(vol))
497 std::vector<int> numbers;
505 numbers.emplace_back(
offset);
506 fNodes.emplace_back(
nullptr);
511 numbers.emplace_back(snode->
GetNumber());
513 fNodes.emplace_back(snode);
515 }
while ((snode = iter()) !=
nullptr);
521 std::vector<RGeomNode *> sortarr;
522 sortarr.reserve(
fNodes.size());
526 for (
auto node :
fNodes) {
528 fDesc.emplace_back(node ? node->GetNumber() -
offset : 0);
529 TGeoVolume *vol = node ? node->GetVolume() : topvolume;
531 auto &desc =
fDesc[cnt++];
533 sortarr.emplace_back(&desc);
539 desc.vol =
TMath::Sqrt(shape->GetDX() * shape->GetDX() + shape->GetDY() * shape->GetDY() +
540 shape->GetDZ() * shape->GetDZ());
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) {
552 auto chld =
dynamic_cast<TGeoNode *
>(chlds->At(
n));
553 desc.chlds.emplace_back(chld->GetNumber() -
offset);
559 for (
auto node :
fNodes) {
560 auto number = numbers[cnt++];
562 node->SetNumber(number);
566 std::sort(sortarr.begin(), sortarr.end(), [](
RGeomNode *
a,
RGeomNode *
b) { return a->vol > b->vol; });
569 for (
auto &elem : sortarr) {
571 elem->sortid = cnt++;
585 auto node =
fNodes[nodeid];
587 return node->GetVolume();
597 for (
int nodeid = 0; nodeid < (
int)
fNodes.size(); nodeid++) {
599 auto node =
fNodes[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.size() > 0) && !desc.nochlds)
619 if (desc.IsVisible() && desc.CanDisplay())
631 for (
auto &node :
fDesc)
636 ScanFunc_t scan_func = [&,
this](
RGeomNode &node) {
637 if (node.idshift < 0) {
639 for (
auto id : node.chlds)
640 node.idshift += scan_func(
fDesc[
id]);
643 return node.idshift + 1;
646 if (
fDesc.size() > 0)
658 std::vector<int> stack;
663 using ScanFunc_t = std::function<
int(
int,
int,
bool)>;
665 ScanFunc_t scan_func = [&,
this](
int nodeid,
int lvl,
bool is_inside) {
669 auto &desc =
fDesc[nodeid];
670 auto desc_vis = desc.vis;
673 if (desc.nochlds && (lvl > 0))
676 bool can_display = desc.CanDisplay(), scan_childs =
true;
678 if ((viter !=
fVisibility.end()) && (compare_stacks(viter->stack, stack) == 0)) {
679 can_display = scan_childs = viter->visible;
680 desc_vis = !viter->visible ? 0 : (desc.chlds.size() > 0 ? 1 : 99);
685 bool is_visible = (lvl >= 0) && (desc_vis > lvl) && can_display && is_inside;
687 if (is_visible || !only_visible)
688 if (func(desc, stack, is_visible, counter))
693 if ((desc.chlds.size() > 0) && (((lvl > 0) && scan_childs) || !only_visible)) {
694 auto pos = stack.size();
695 stack.emplace_back(0);
696 for (
unsigned k = 0; k < desc.chlds.size(); ++k) {
698 res += scan_func(desc.chlds[k], is_inside ? lvl - 1 : lvl, is_inside);
702 counter += desc.idshift;
715 return scan_func(0, maxlvl,
false);
728 for (
auto &node :
fDesc)
729 drawing.
nodes.emplace_back(&node);
734 for (
auto &node :
fDesc)
735 node.useflag =
false;
737 for (
auto &item : drawing.
visibles) {
739 for (
auto &chindx : item.stack) {
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);
773 auto request = TBufferJSON::FromJSON<RBrowserRequest>(msg);
776 request = std::make_unique<RBrowserRequest>();
778 request->number = 100;
786 std::vector<RGeomNodeBase *> vect(
fDesc.size(),
nullptr);
789 for (
auto &item :
fDesc)
795 res +=
":__PHYSICAL_VISIBILITY__:";
799 res +=
":__SELECTED_STACK__:";
803 std::vector<RGeoItem> temp_nodes;
804 bool toplevel = request->path.empty();
808 reply.
path = request->path;
809 reply.
first = request->first;
818 while ((request->first > 0) && iter.
Next()) {
825 while (iter.
IsValid() && (request->number > 0)) {
830 temp_nodes.back().SetExpanded(
true);
832 temp_nodes.back().SetTop(
true);
835 if (stack.size() > 0)
836 stack[stack.size() - 1]++;
844 for (
auto &
n : temp_nodes)
845 reply.
nodes.emplace_back(&
n);
860 if (descr.fShape == shape)
876 std::unique_ptr<RootCsg::TBaseMesh> res;
884 for (
UInt_t i = 0; i < b3d->NbPnts(); ++i) {
886 buf[1] =
v[i * 3 + 1];
887 buf[2] =
v[i * 3 + 2];
892 res.reset(RootCsg::ConvertToMesh(*b3d.get()));
902 mleft.
Multiply(node->GetLeftMatrix());
903 auto left =
MakeGeoMesh(&mleft, node->GetLeftShape());
905 mright.
Multiply(node->GetRightMatrix());
906 auto right =
MakeGeoMesh(&mright, node->GetRightShape());
909 res.reset(RootCsg::BuildUnion(left.get(), right.get()));
911 res.reset(RootCsg::BuildIntersection(left.get(), right.get()));
913 res.reset(RootCsg::BuildDifference(left.get(), right.get()));
931 return nsegm > min ? nsegm : min;
942 auto countTubeFaces = [
this](
const std::array<Double_t, 2> &outerR,
const std::array<Double_t, 2> &innerR,
943 Double_t thetaLength = 360.) ->
int {
944 auto hasrmin = (innerR[0] > 0) || (innerR[1] > 0);
949 int numfaces = radiusSegments * (((outerR[0] <= 0) || (outerR[1] <= 0)) ? 1 : 2);
953 numfaces += radiusSegments * (((innerR[0] <= 0) || (innerR[1] <= 0)) ? 1 : 2);
957 numfaces += radiusSegments * ((innerR[0] > 0) ? 2 : 1);
960 numfaces += radiusSegments * ((innerR[1] > 0) ? 2 : 1);
962 if (thetaLength < 360)
963 numfaces += ((outerR[0] > innerR[0]) ? 2 : 0) + ((outerR[1] > innerR[1]) ? 2 : 0);
971 auto heightSegments = sphere->
GetNz();
973 auto noInside = sphere->
GetRmin() <= 0;
975 auto numoutside = widthSegments * heightSegments * 2;
976 auto numtop = widthSegments * (noInside ? 1 : 2);
977 auto numbottom = widthSegments * (noInside ? 1 : 2);
978 auto numcut = (phiLength == 360.) ? 0 : heightSegments * (noInside ? 2 : 4);
980 return numoutside * (noInside ? 1 : 2) + numtop + numbottom + numcut;
983 return countTubeFaces({cone->GetRmax2(), cone->GetRmax1()}, {cone->GetRmin2(), cone->GetRmin1()});
986 return countTubeFaces({cone->GetRmax2(), cone->GetRmax1()}, {cone->GetRmin2(), cone->GetRmin1()},
987 cone->GetPhi2() - cone->GetPhi1());
990 return countTubeFaces({tube->GetRmax(), tube->GetRmax()}, {tube->GetRmin(), tube->GetRmin()});
993 return countTubeFaces({tube->GetRmax(), tube->GetRmax()}, {tube->GetRmin(), tube->GetRmin()},
994 tube->GetPhi2() - tube->GetPhi1());
997 return countTubeFaces({tube->GetRmax(), tube->GetRmax()}, {tube->GetRmin(), tube->GetRmin()},
998 tube->GetPhi2() - tube->GetPhi1());
1005 return (torus->GetRmin() > 0 ? 4 : 2) * radialSegments * (tubularSegments + (torus->GetDphi() != 360. ? 1 : 0));
1009 bool hasrmin =
false;
1011 for (
int layer = 0; layer < pcon->GetNz(); ++layer)
1012 if (pcon->GetRmin(layer) > 0.)
1014 return (hasrmin ? 4 : 2) * radiusSegments * (pcon->GetNz() - 1);
1018 bool hasrmin =
false;
1020 for (
int layer = 0; layer < pgon->GetNz(); ++layer)
1021 if (pgon->GetRmin(layer) > 0.)
1023 return (hasrmin ? 4 : 2) * radiusSegments * (pgon->GetNz() - 1);
1026 return (xtru->GetNz() - 1) * xtru->GetNvert() * 2 + xtru->GetNvert() * 3;
1030 int numfaces = (heightSegments + 1) * radiusSegments * 2;
1031 if (para->GetRlo() == 0.)
1032 numfaces -= radiusSegments * 2;
1033 if (para->GetRhi() == 0.)
1034 numfaces -= radiusSegments * 2;
1041 return radiusSegments * (heightSegments + 1) * ((hype->
GetRmin() > 0.) ? 4 : 2);
1045 for (
int i = 0; i < tess->GetNfacets(); ++i) {
1046 if (tess->GetFacet(i).GetNvert() == 4)
1057 if (!comp->GetBoolNode())
1074 if (elem.nfaces == 0) {
1087 elem.fShapeInfo.shape = shape;
1101 Int_t num_vertices =
mesh->NumberOfVertices(), num_polynoms = 0;
1103 for (
unsigned polyIndex = 0; polyIndex <
mesh->NumberOfPolys(); ++polyIndex) {
1105 auto size_of_polygon =
mesh->SizeOfPoly(polyIndex);
1107 if (size_of_polygon >= 3)
1108 num_polynoms += (size_of_polygon - 2);
1111 Int_t index_buffer_size = num_polynoms * 3,
1112 vertex_buffer_size = num_vertices * 3;
1114 elem.nfaces = num_polynoms;
1116 std::vector<float> vertices(vertex_buffer_size);
1118 for (
Int_t i = 0; i < num_vertices; ++i) {
1119 auto v =
mesh->GetVertex(i);
1120 vertices[i * 3] =
v[0];
1121 vertices[i * 3 + 1] =
v[1];
1122 vertices[i * 3 + 2] =
v[2];
1125 elem.fRawInfo.raw.resize(vertices.size() *
sizeof(
float));
1127 memcpy(
reinterpret_cast<char *
>(elem.fRawInfo.raw.data()), vertices.data(), vertices.size() *
sizeof(
float));
1129 auto &indexes = elem.fRawInfo.idx;
1131 indexes.resize(index_buffer_size);
1134 for (
unsigned polyIndex = 0; polyIndex <
mesh->NumberOfPolys(); ++polyIndex) {
1135 auto size_of_polygon =
mesh->SizeOfPoly(polyIndex);
1138 if (size_of_polygon >= 3)
1139 for (
int i = 0; i < 3; ++i)
1140 indexes[pos++] =
mesh->GetVertexIndex(polyIndex, i);
1143 if (size_of_polygon > 3)
1145 indexes[pos++] =
mesh->GetVertexIndex(polyIndex, 0);
1146 indexes[pos++] =
mesh->GetVertexIndex(polyIndex,
vertex - 1);
1147 indexes[pos++] =
mesh->GetVertexIndex(polyIndex,
vertex);
1175 node.
material = material->GetName();
1177 auto fillstyle = material->GetFillStyle();
1178 if ((fillstyle >= 3000) && (fillstyle <= 3100))
1179 node.
opacity = (3100 - fillstyle) / 100.;
1188 colbuf.
Form(
"#%02x%02x%02x", (
int)(col->
GetRed() * 255), (
int)(col->
GetGreen() * 255),
1234 std::vector<int> viscnt(
fDesc.size(), 0);
1239 int numnodes =
ScanNodes(
true, level, [&viscnt](
RGeomNode &node, std::vector<int> &,
bool,
int) {
1247 viscnt.assign(viscnt.size(), 0);
1248 numnodes =
ScanNodes(
true, level, [&viscnt](
RGeomNode &node, std::vector<int> &,
bool,
int) {
1258 int totalnumfaces = 0, totalnumnodes = 0;
1266 auto &desc =
fDesc[sid];
1268 if ((viscnt[sid] <= 0) || (desc.vol <= 0))
1279 if (shape_descr.nfaces <= 0) {
1280 R__LOG_ERROR(
RGeomLog()) <<
"No faces for the shape " << shape->GetName() <<
" class " << shape->ClassName();
1285 totalnumfaces += shape_descr.nfaces * viscnt[sid];
1290 totalnumnodes += viscnt[sid];
1302 bool has_shape =
false;
1304 ScanNodes(
true, level, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool,
int seqid) {
1306 drawing.visibles.emplace_back(node.id, seqid, stack);
1308 auto &item = drawing.visibles.back();
1309 item.color = node.color;
1310 item.opacity = node.opacity;
1312 auto volume = GetVolume(node.id);
1314 auto &sd = MakeShapeDescr(volume->GetShape());
1316 item.ri = sd.rndr_info();
1398 if ((nodeid < 0) || (nodeid >= (
int)
fDesc.size()))
1401 auto &desc =
fDesc[nodeid];
1403 return (desc.sortid <
fDrawIdCut) && desc.IsVisible() && desc.CanDisplay() && (desc.chlds.size() == 0);
1419 hjson =
"FOUND:RESET";
1423 std::vector<int> nodescnt(
fDesc.size(), 0), viscnt(
fDesc.size(), 0);
1426 std::string
test = find;
1428 if (
test.compare(0, 2,
"c:") == 0) {
1431 }
else if (
test.compare(0, 2,
"m:") == 0) {
1438 auto match_func = [®exp, kind](
RGeomNode &node) {
1439 return (node.vol > 0) && (
TString(node.GetArg(kind)).
Index(regexp) >= 0);
1444 [&nodescnt, &viscnt, &match_func, &nmatches](
RGeomNode &node, std::vector<int> &,
bool is_vis,
int) {
1445 if (match_func(node)) {
1447 nodescnt[node.
id]++;
1455 if (nmatches == 0) {
1461 hjson =
"FOUND:Too many " + std::to_string(nmatches);
1467 int totalnumfaces = 0, totalnumnodes = 0, scnt = 0;
1468 bool send_rawdata =
true;
1475 if (viscnt[sid] == 0)
1478 auto &desc =
fDesc[sid];
1479 if ((viscnt[sid] <= 0) && (desc.vol <= 0))
1490 if (shape_descr.nfaces <= 0) {
1491 R__LOG_ERROR(
RGeomLog()) <<
"No faces for the shape " << shape->GetName() <<
" class " << shape->ClassName();
1496 totalnumfaces += shape_descr.nfaces * viscnt[sid];
1498 send_rawdata =
false;
1503 totalnumnodes += viscnt[sid];
1505 send_rawdata =
false;
1516 std::vector<RGeomNodeBase> found_desc;
1517 std::vector<int> found_map(
fDesc.size(), -1);
1521 found_desc.emplace_back(0);
1522 found_desc[0].vis =
fDesc[0].vis;
1523 found_desc[0].name =
fDesc[0].name;
1524 found_desc[0].color =
fDesc[0].color;
1530 bool has_shape =
true;
1532 ScanNodes(
false, 0, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool is_vis,
int seqid) {
1534 if (!match_func(node))
1539 for (
auto &s : stack) {
1540 int chldid =
fDesc[prntid].chlds[s];
1541 if (found_map[chldid] <= 0) {
1542 int newid = found_desc.size();
1543 found_desc.emplace_back(newid);
1544 found_map[chldid] = newid;
1546 found_desc.back().vis =
fDesc[chldid].vis;
1547 found_desc.back().name =
fDesc[chldid].name;
1548 found_desc.back().color =
fDesc[chldid].color;
1549 found_desc.back().material =
fDesc[chldid].material;
1552 auto pid = found_map[prntid];
1553 auto cid = found_map[chldid];
1556 auto &pchlds = found_desc[pid].chlds;
1557 if (std::find(pchlds.begin(), pchlds.end(), cid) == pchlds.end())
1558 pchlds.emplace_back(cid);
1567 drawing.
visibles.emplace_back(node.
id, seqid, stack);
1576 auto &item = drawing.
visibles.back();
1579 item.color = node.
color;
1584 item.ri = sd.rndr_info();
1608 for (
auto &chindx : stack) {
1609 auto &node =
fDesc[nodeid];
1610 if (chindx >= (
int)node.chlds.size())
1612 nodeid = node.chlds[chindx];
1625 std::vector<int> stack;
1627 if (ids.size() == 0)
1631 printf(
"Wrong first id\n");
1637 for (
unsigned k = 1; k < ids.size(); ++k) {
1639 int prntid = nodeid;
1642 if (nodeid >= (
int)
fDesc.size()) {
1643 printf(
"Wrong node id %d\n", nodeid);
1647 auto &chlds =
fDesc[prntid].chlds;
1648 auto pos = std::find(chlds.begin(), chlds.end(), nodeid);
1649 if (pos == chlds.end()) {
1650 printf(
"Wrong id %d not a child of %d - fail to find stack num %d\n", nodeid, prntid, (
int)chlds.size());
1655 stack.emplace_back(std::distance(chlds.begin(), pos));
1669 std::vector<int> res;
1687 std::vector<int> ids;
1689 ids.emplace_back(0);
1691 bool failure =
false;
1693 for (
auto s : stack) {
1694 auto &chlds =
fDesc[nodeid].chlds;
1695 if (s >= (
int)chlds.size()) {
1700 ids.emplace_back(chlds[s]);
1706 printf(
"Fail to convert stack into list of nodes\n");
1720 std::vector<std::string> path;
1723 for (
auto &
id : ids)
1724 path.emplace_back(
fDesc[
id].name);
1737 std::vector<RGeomNodeBase *> nodes;
1744 for (
auto &desc :
fDesc)
1746 nodes.emplace_back(&desc);
1771 ScanNodes(
true, 0, [&,
this](
RGeomNode &node, std::vector<int> &stack,
bool,
int seq_id) {
1778 if (node.
id != nodeid)
1782 drawing.
visibles.emplace_back(node.
id, seq_id, stack);
1784 auto &item = drawing.
visibles.back();
1786 item.color = node.
color;
1792 if (drawing.
visibles.size() == 0) {
1799 bool has_shape =
false, has_raw =
false;
1804 for (
auto &item : drawing.
visibles) {
1805 item.ri = sd.rndr_info();
1816 return has_raw || has_shape;
1836 json.SetSkipClassInfo(TClass::GetClass<RGeomDrawing>());
1837 json.SetSkipClassInfo(TClass::GetClass<RGeomNode>());
1838 json.SetSkipClassInfo(TClass::GetClass<RGeomVisible>());
1839 json.SetSkipClassInfo(TClass::GetClass<RGeomShapeRenderInfo>());
1840 json.SetSkipClassInfo(TClass::GetClass<RGeomRawRenderInfo>());
1842 return json.StoreObject(&drawing, TClass::GetClass<RGeomDrawing>()).Data();
1859 auto &dnode =
fDesc[nodeid];
1864 if (vol->IsVisible() == selected)
1867 dnode.vis = selected ? 99 : 0;
1868 vol->SetVisibility(selected);
1869 if (dnode.chlds.size() > 0) {
1872 vol->SetVisDaughters(selected);
1876 for (
auto &desc :
fDesc)
1878 desc.vis = dnode.vis;
1884 if (compare_stacks(iter->stack, stack) == 0) {
1904 std::unique_ptr<RGeomNodeInfo> res;
1914 res = std::make_unique<RGeomNodeInfo>();
1917 res->node_name = node ? node->GetName() :
"node_name";
1918 res->node_type = node ? node->ClassName() :
"no class";
1922 TGeoShape *shape = vol ? vol->GetShape() :
nullptr;
1925 res->shape_name = shape->
GetName();
1929 if (shape && desc.CanDisplay()) {
1933 res->ri = shape_descr.rndr_info();
1983 auto res = compare_stacks(iter->stack, stack);
1986 bool changed = iter->visible !=
on;
1992 if ((
fDesc[nodeid].vis > 0) ==
on)
2017 std::vector<std::string> path;
2018 std::string::size_type p1 = 0;
2020 while (p1 < itemname.length()) {
2021 if (itemname[p1] ==
'/') {
2025 auto p = itemname.find(
"/", p1);
2026 if (
p == std::string::npos) {
2027 path.emplace_back(itemname.substr(p1));
2028 p1 = itemname.length();
2030 path.emplace_back(itemname.substr(p1,
p - p1));
2045 unsigned sz = item.stack.size();
2046 if (stack.size() < sz)
2049 for (
unsigned n = 0;
n < sz; ++
n)
2050 if (stack[
n] != item.stack[
n]) {
2056 return item.visible ? 1 : 0;
2076 if (compare_stacks(iter->stack, stack) == 0) {
2106 auto cfg = TBufferJSON::FromJSON<RGeomConfig>(
json);
2144 std::string prefix =
" ";
2153 fs << prefix <<
name <<
"SetTopVisible(true);" << std::endl;
2157 fs << prefix <<
name <<
"SetNSegments(" <<
fCfg.
nsegm <<
");" << std::endl;
2159 fs << prefix <<
name <<
"SetDrawOptions(\"" <<
fCfg.
drawopt <<
"\");" << std::endl;
2161 fs << prefix <<
name <<
"SetJsonComp(" <<
fJsonComp <<
");" << std::endl;
2166 fs << prefix <<
name <<
"SetPhysNodeVisibility(";
2167 for (
int i = 0; i < (
int)path.size(); ++i)
2168 fs << (i == 0 ?
"{\"" :
", \"") << path[i] <<
"\"";
2169 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(...)
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
A log configuration for a channel, e.g.
Reply on browser request.
std::vector< std::string > path
reply path
std::vector< const Browsable::RItem * > nodes
list of pointers, no ownership!
int first
first node in returned list
int nchilds
total number of childs in the node
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
bool showtop
show geometry top volume, off by default
int maxnumfaces
maximal number of faces
int vislevel
visible level
int maxnumnodes
maximal number of nodes
std::string drawopt
draw options for TGeoPainter
int build_shapes
when shapes build on server 0 - never, 1 - TGeoComposite, 2 - plus non-cylindrical,...
int nsegm
number of segments for cylindrical shapes
RGeomConfig fCfg
! configuration parameter editable from GUI
std::vector< std::pair< const void *, RGeomSignalFunc_t > > fSignals
! registered signals
int IsPhysNodeVisible(const std::vector< int > &stack)
Check if there special settings for specified physical node returns -1 if nothing is found.
std::vector< int > fSelectedStack
! selected branch of geometry by stack
void SetMaxVisNodes(int cnt)
Set maximal number of nodes which should be selected for drawing.
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 SetVisLevel(int lvl=3)
Set maximal visible level.
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.
std::vector< RGeomNodeVisibility > fVisibility
! custom visibility flags for physical nodes
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...
int GetMaxVisNodes() const
Returns maximal visible number of nodes, ignored when non-positive.
int GetVisLevel() const
Returns maximal visible level.
int GetMaxVisFaces() const
Returns maximal visible number of faces, ignored when non-positive.
void ClearCache()
Clear cached data, need to be clear when connection broken.
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.
void SetMaxVisFaces(int cnt)
Set maximal number of faces which should be selected for drawing.
bool IsPreferredOffline() const
Is offline operations preferred.
std::vector< ShapeDescr > fShapes
! shapes with created descriptions
int fJsonComp
! default JSON compression
bool ChangeNodeVisibility(const std::vector< std::string > &path, bool on)
Change visibility for specified element Returns true if changes was performed.
std::string fSearch
! search string in hierarchy
std::string fSearchJson
! drawing json for search
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...
int fActualLevel
! level can be reduced when selecting nodes
TGeoVolume * GetVolume(int nodeid)
Get volume for specified nodeid If specific volume was configured, it will be returned for nodeid==0.
int GetNumNodes() const
Number of unique nodes in the geometry.
void ProduceDrawData()
Collect all information required to draw geometry on the client This includes list of each visible no...
void SetNSegments(int n=0)
Set number of segments for cylindrical shapes, if 0 - default value will be used.
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::vector< int > fSortMap
! nodes in order large -> smaller volume
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 raw data. Will be rebuild when next connection will be established.
std::vector< std::string > MakePathByStack(const std::vector< int > &stack)
Returns path string for provided stack.
TVirtualMutex * fMutex
! external mutex used to protect all data
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.
int IsBuildShapes() const
Returns true if binary 3D model build already by C++ server (default)
void ProduceSearchData()
Produces search data if necessary.
void CollectNodes(RGeomDrawing &drawing, bool all_nodes=false)
Collect nodes which are used in visibles.
int fDrawIdCut
! sortid used for selection of most-significant nodes
TGeoVolume * fDrawVolume
! select volume independent from TGeoManager
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.
std::string fDrawJson
! JSON with main nodes drawn by client
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.
int GetNSegments() const
Return of segments for cylindrical shapes, if 0 - default value will be used.
std::vector< TGeoNode * > fNodes
! flat list of all nodes
int GetJsonComp() const
Returns JSON compression level for data transfer.
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
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.
TGeoBoolNode * GetBoolNode() const
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...
Double_t GetStOut() const
void Skip()
Stop iterating the current branch.
The manager class for any TGeo geometry.
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
Int_t GetMaxVisNodes() const
TGeoNode * GetTopNode() const
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
Int_t GetVisLevel() const
Returns current depth to which geometry is drawn.
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...
void SetNumber(Int_t number)
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...
Int_t GetNumberOfDivisions() const
virtual Double_t GetRmin() const
The torus is defined by its axial radius, its inner and outer radius.
A tube segment is a tube having a range in phi.
virtual Double_t GetRmin() const
virtual Double_t GetRmax() const
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.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
std::function< void(const std::string &)> RGeomSignalFunc_t
Experimental::RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.
std::function< bool(RGeomNode &, std::vector< int > &, bool, int)> RGeomScanFunc_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.