28using namespace std::string_literals;
 
   37   if (!
gROOT->IsWebDisplayBatch()) {
 
   39      fWebWindow->SetDefaultPage(
"file:rootui5sys/geom/index.html");
 
 
  166   std::vector<int> *stack{
nullptr}, res;
 
 
  247      if (
json.find(
"GDRAW:") != 0) {
 
  248         printf(
"GDRAW missing!!!!\n");
 
 
  262   if (arg == 
"GETDRAW") {
 
  266   } 
else if (arg == 
"QUIT_ROOT") {
 
  270   } 
else if (arg.compare(0, 9, 
"HCHANNEL:") == 0) {
 
  272      int chid = std::stoi(arg.substr(9));
 
  278   } 
else if (arg.compare(0, 4, 
"GET:") == 0) {
 
  285      std::string 
json{
"SHAPE:"};
 
  291   } 
else if (arg.compare(0, 10, 
"HIGHLIGHT:") == 0) {
 
  292      auto stack = TBufferJSON::FromJSON<std::vector<int>>(arg.substr(10));
 
  295   } 
else if (arg.compare(0, 6, 
"IMAGE:") == 0) {
 
  296      auto separ = arg.find(
"::", 6);
 
  297      if (
separ == std::string::npos)
 
  306               fname += std::to_string(cnt);
 
  313      std::ofstream ofs(
fname);
 
  317      printf(
"Image file %s size %d has been created\n", 
fname.c_str(), (
int)
binary.Length());
 
  319   } 
else if (arg.compare(0, 4, 
"CFG:") == 0) {
 
  324   } 
else if (arg == 
"RELOAD") {
 
  328   } 
else if (arg.compare(0, 9, 
"ACTIVATE:") == 0) {
 
  331   } 
else if (arg.compare(0, 11, 
"INFOACTIVE:") == 0) {
 
  333   } 
else if (arg.compare(0, 11, 
"HIDE_ITEMS:") == 0) {
 
  334      auto items = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(11));
 
  344   } 
else if (arg == 
"SAVEMACRO") {
 
 
  367   if ((kind == 
"SelectTop") || (kind == 
"NodeVisibility")) {
 
  369   } 
else if (kind == 
"ChangeSearch") {
 
  375   } 
else if (kind == 
"ClearSearch") {
 
  378   } 
else if (kind == 
"HighlightItem") {
 
  382   } 
else if (kind == 
"ClickItem") {
 
 
  402   std::string prefix = 
"   ";
 
  406      fs << 
"void " << 
fname.substr(0, 
p) << 
"() { " << std::endl;
 
  408      fs << 
"{" << std::endl;
 
  415      fs << prefix << 
"// geometry is too large, please provide import like:" << std::endl << std::endl;
 
  416      fs << prefix << 
"// TGeoManager::Import(\"filename.root\");" << std::endl;
 
  421   fs << prefix << 
"auto viewer = std::make_shared<ROOT::RGeomViewer>(gGeoManager";
 
  424   fs << 
");" << std::endl;
 
  428   fs << prefix << 
"viewer->SetShowHierarchy(" << (
fShowHierarchy ? 
"true" : 
"false") << 
");" << std::endl;
 
  429   fs << prefix << 
"viewer->SetShowColumns(" << (
fShowColumns ? 
"true" : 
"false") << 
");" << std::endl;
 
  433   fs << prefix << 
"viewer->Show();" << std::endl << std::endl;
 
  435   fs << prefix << 
"ROOT::Experimental::RDirectory::Heap().Add(\"geom_viewer\", viewer);" << std::endl;
 
  437   fs << 
"}" << std::endl;
 
 
#define R__LOG_ERROR(...)
 
#define R__LOG_DEBUG(DEBUGLEVEL,...)
 
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 fs
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
 
R__EXTERN TSystem * gSystem
 
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.
 
void IssueSignal(const void *handler, const std::string &kind)
Issue signal, which distributed on all handlers - excluding source handler.
 
bool SetHighlightedItem(const std::vector< int > &stack)
 
void SetPreferredOffline(bool on)
Set preference of offline operations.
 
void ClearCache()
Clear cached data, need to be clear when connection broken.
 
std::string GetDrawJson() const
 
std::vector< int > MakeStackByIds(const std::vector< int > &ids)
Creates stack for given array of ids, first element always should be 0.
 
void SavePrimitive(std::ostream &fs, const std::string &name)
Save geometry configuration as C++ macro.
 
bool SetActiveItem(const std::string &itemname)
 
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...
 
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...
 
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.
 
std::vector< int > GetClickedItem() const
 
void ProduceSearchData()
Produces search data if necessary.
 
void SetJsonComp(int comp=0)
Set JSON compression level for data transfer.
 
void SetBuildShapes(int lvl=1)
Instruct to build binary 3D model already on the server (true) or send TGeoShape as is to client,...
 
void SetDrawOptions(const std::string &opt="")
Set draw options as string for JSROOT TGeoPainter.
 
std::vector< int > GetHighlightedItem() const
 
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.
 
std::string GetSearchJson() const
 
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....
 
RGeomViewer(TGeoManager *mgr=nullptr, const std::string &volname="")
constructor
 
void Show(const RWebDisplayArgs &args="", bool always_start_new_browser=false)
Show or update geometry in web window If web browser already started - just refresh drawing like "rel...
 
void SetGeometry(TGeoManager *mgr, const std::string &volname="")
assign new geometry to the viewer
 
std::vector< int > GetStackFromJson(const std::string &json, bool node_ids=false)
convert JSON into stack array
 
virtual ~RGeomViewer()
destructor
 
void SendGeometry(unsigned connid=0, bool first_time=false)
Send data for principal geometry draw Should be used when essential settings were changed in geometry...
 
std::string GetWindowAddr() const
Return web window address (name) used for geometry viewer.
 
std::shared_ptr< RGeomHierarchy > fWebHierarchy
! web handle for hierarchy part
 
void WebWindowDisconnect(unsigned connid)
Process disconnect event Clear cache data and dependent connections.
 
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.
 
bool fShowHierarchy
! if hierarchy visible by default
 
bool GetShowColumns() const
 
void SaveAsMacro(const std::string &fname)
Save viewer configuration as macro.
 
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
 
void Update()
Update geometry drawings in all web displays.
 
void ProcessSignal(const std::string &)
Process signal from geom description when it changed by any means.
 
bool GetShowHierarchy() const
Returns default hierarchy browser visibility.
 
void SetDrawOptions(const std::string &opt)
Configures draw option for geometry Normally has effect before first drawing of the geometry When geo...
 
TGeoManager * fGeoManager
! geometry to show
 
std::string GetWindowUrl(bool remote)
Return web window URL which can be used for connection See ROOT::RWebWindow::GetUrl docu for more det...
 
bool fShowColumns
! show columns in hierarchy
 
std::string fSelectedVolume
! name of selected volume
 
void WebWindowCallback(unsigned connid, const std::string &arg)
Process data from client.
 
bool fInfoActive
! true when info page active and node info need to be provided
 
void SetOnlyVolume(TGeoVolume *vol)
Draw only specified volume, special case when volume stored without valid geomanager.
 
void SelectVolume(const std::string &volname)
Select visible top volume, all other volumes will be disabled.
 
void SaveImage(const std::string &fname="geometry.png", int width=0, int height=0)
Produce PNG image of the geometry If web-browser is shown and drawing completed, image is requested f...
 
RGeomDescription fDesc
! geometry description, send to the client as first message
 
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
 
const std::string & GetWidgetKind() const
returns widget kind
 
static bool ProduceImage(const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser...
 
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
 
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
 
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
 
@ kSkipTypeInfo
do not store typenames in JSON
 
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
 
@ kSameSuppression
zero suppression plus compress many similar values together
 
static Bool_t FromJSON(T *&obj, const char *json)
 
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
 
The manager class for any TGeo geometry.
 
Int_t GetVisLevel() const
Returns current depth to which geometry is drawn.
 
TGeoVolume * GetTopVolume() const
 
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
 
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
 
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
 
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
 
Experimental::RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.