68 fExcHandler (nullptr),
72 fGeometries (nullptr),
73 fGeometryAliases (nullptr),
75 fMacroFolder (nullptr),
89 throw eh +
"There can be only one REve!";
101 fRedrawTimer.
Connect(
"Timeout()",
"ROOT::Experimental::REveManager",
this,
"DoRedraw3D()");
147 fWebWindow->SetDefaultPage(
"file:rootui5sys/eve7/index.html");
149 const char *gl_viewer =
gEnv->
GetValue(
"WebEve.GLViewer",
"Three");
150 const char *gl_dblclick =
gEnv->
GetValue(
"WebEve.DblClick",
"Off");
153 fWebWindow->SetUserArgs(
Form(
"{ GLViewer: \"%s\", DblClick: \"%s\", HTimeout: %d, TableRowHeight: %d }", gl_viewer, gl_dblclick, htimeout, table_row_height));
157 [
this](
unsigned connid,
const std::string &arg) {
WindowData(connid, arg); },
248 jobj[
"content"] =
"BeginChanges";
255 jobj[
"content"] =
"EndChanges";
292 if (parent ==
nullptr) {
327 static const REveException eh(
"REveManager::FindElementById ");
338 static const REveException eh(
"REveManager::AssignElementId ");
341 throw eh +
"ElementId map is full.";
363 msg[
"content"] =
"BrowseElement";
385 Error(
"REveManager::PreDeleteElement",
"ImpliedSelected not zero (%d) after cleanup of selections.", el->
fImpliedSelected);
394 if (it->second == el)
399 else Error(
"PreDeleteElement",
"element ptr in ElementIdMap does not match the argument element.");
401 else Error(
"PreDeleteElement",
"element id %u was not registered in ElementIdMap.", el->
fElementId);
403 else Error(
"PreDeleteElement",
"element with 0 ElementId passed in.");
519 if (re.
Match(filename) != 2) {
520 Error(
"SaveVizDB",
"filename does not match required format '(.+)\\.\\w+'.");
524 TString exp_filename(filename);
527 std::ofstream out(exp_filename, std::ios::out | std::ios::trunc);
528 out <<
"void " << re[1] <<
"()\n";
530 out <<
" REveManager::Create();\n";
543 var_name.
Form(
"x%03d", var_id++);
566 TString exp_filename = filename;
568 printf(
"REveManager::GetGeometry loading: '%s' -> '%s'.\n",
569 filename.
Data(), exp_filename.
Data());
580 Warning(
"REveManager::GetGeometry",
"TGeoManager is locked ... unlocking it.");
584 throw eh +
"TGeoManager::Import() failed for '" + exp_filename +
"'.";
594 TFile f(exp_filename,
"READ");
600 while ((vol = (
TGeoVolume*) next()) !=
nullptr)
627 throw eh +
"geometry alias '" + alias +
"' not registered.";
658 while((cls = (
TClass *)nextcl()))
670 fWebWindow->GetServer()->AddLocation(locationName.c_str(), path.c_str());
735 Info(
"Handle",
"Exception %s",
ex->what());
749 printf(
"connection established %u\n", connid);
752 printf(
"\nEVEMNG ............. streaming the world scene.\n");
767 printf(
"\nEVEMNG ............. streaming scene %s [%s]\n",
773 printf(
" sending json, len = %d\n", (
int) scene->
fOutputJson.size());
796 if (i->fId == connid)
804 printf(
"error, connection not found!");
806 printf(
"connection closed %u\n", connid);
829 if (conn.fId == connid) {
836 R__ERROR_HERE(
"webeve") <<
"Internal error - no connection with id " << connid <<
" found";
842 ::Info(
"REveManager::WindowData",
"MIR test %s", cj.dump().c_str());
843 std::string mir = cj[
"mir"];
844 int id = cj[
"fElementId"];
847 std::stringstream cmd;
850 cmd <<
"((ROOT::Experimental::REveManager *)" << std::hex << std::showbase << (size_t)
this <<
")->" << mir <<
";";
854 R__ERROR_HERE(
"webeve") <<
"Element with id " <<
id <<
" not found";
857 std::string ctype = cj[
"class"];
858 cmd <<
"((" << ctype <<
"*)" << std::hex << std::showbase << (size_t)el <<
")->" << mir <<
";";
865 ::Info(
"REveManager::WindowData",
"MIR cmd %s", cmd.str().c_str());
866 gROOT->ProcessLine(cmd.str().c_str());
905 jhdr[
"content"] =
"REveManager::DestroyElementsOf";
909 for (
auto &ep : els) {
910 jels.push_back(ep->GetElementId());
912 ep->DestroyElements();
915 jhdr[
"element_ids"] = jels;
917 jarr.push_back(jhdr);
919 std::string msg = jarr.dump();
935 assert (scene !=
nullptr);
937 printf(
"\nEVEMNG ............. streaming scene %s [%s]\n",
944 printf(
" sending json, len = %d --> to conn_id = %d\n", (
int)scene->
fOutputJson.size(), conn.fId);
946 printf(
" sending binary, len = %d --> to conn_id = %d\n", scene->
fTotalBinarySize, conn.fId);
966 printf(
"EVE URL %s\n", url.c_str());
978 Error(
"ShowGeometry",
"No geometry is loaded");
982 auto viewer = std::make_shared<REveGeomViewer>(
gGeoManager);
#define R__ERROR_HERE(GROUP)
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
R__EXTERN TEveManager * gEve
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TGeoIdentity * gGeoIdentity
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
const char * GetCTitle() const
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
virtual void DestroyElements()
Destroy all children of this element.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
Bool_t HasChildren() const
void IncDenyDestroy()
Increases the deny-destroy count of the element.
virtual void CopyVizParams(const REveElement *el)
Copy visualization parameters from element el.
void SetVizModel(REveElement *model)
Set visualization-parameter model element.
void SetChildClass(TClass *c)
std::list< REveElement * > List_t
virtual void RemoveElement(REveElement *el)
Remove el from the list of children.
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
REveException Exception-type thrown by Eve classes.
virtual EStatus Handle(std::exception &exc)
Handle exceptions deriving from REveException.
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
ElementId_t fMaxElementIds
void DestroyElementsOf(REveElement::List_t &els)
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
void PreDeleteElement(REveElement *element)
Called from REveElement prior to its destruction so the framework components (like object editor) can...
ElementId_t fNumElementIds
void ClearAllSelections()
Clear all selection objects.
RExceptionHandler * fExcHandler
exception handler
REveSelection * fSelection
void AssignElementId(REveElement *element)
Assign a unique ElementId to given element.
TGeoManager * GetDefaultGeometry()
Get the default geometry.
void SetDefaultHtmlPage(const std::string &path)
Set content of default window HTML page.
void AddLocation(const std::string &name, const std::string &path)
Register new directory to THttpServer.
void Send(unsigned connid, const std::string &data)
static void Terminate()
Properly terminate global REveManager.
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
std::unordered_map< ElementId_t, REveElement * > fElementIdMap
static REveManager * Create()
If global REveManager* REX::gEve is not set initialize it.
void WindowConnect(unsigned connid)
Process new connection from web window.
std::vector< Conn > fConnList
REveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
ElementId_t fLastElementId
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
std::shared_ptr< ROOT::Experimental::RWebWindow > fWebWindow
std::shared_ptr< REveGeomViewer > ShowGeometry(const RWebDisplayArgs &args="")
Show current geometry in web browser.
REveSelection * fHighlight
REveViewerList * fViewers
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
void RegisterRedraw3D()
Register a request for 3D redraw.
void SendBinary(unsigned connid, const void *data, std::size_t len)
void AddElement(REveElement *element, REveElement *parent=nullptr)
Add an element.
void SetClientVersion(const std::string &version)
Set client version, used as prefix in scripts URL When changed, web browser will reload all related J...
void AddGlobalElement(REveElement *element, REveElement *parent=nullptr)
Add a global element, i.e.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
REveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
void RemoveElement(REveElement *element, REveElement *parent)
Remove element from parent.
virtual ~REveManager()
Destructor.
void WindowDisconnect(unsigned connid)
Process disconnect of web window.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
REveElement * fSelectionList
REveViewer * SpawnNewViewer(const char *name, const char *title="")
Create a new GL viewer.
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
void BrowseElement(ElementId_t id)
Activate EVE browser (summary view) for specified element id.
void WindowData(unsigned connid, const std::string &arg)
Process data from web window.
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
void BroadcastElementsOf(REveElement::List_t &els)
void ProcessSceneChanges()
void DestroyScenes()
Destroy all scenes and their contents.
void AcceptChanges(bool)
Set accept changes flag on all scenes.
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
std::vector< char > fOutputBinary
!
void BeginAcceptingChanges()
void EndAcceptingChanges()
void RemoveSubscriber(unsigned int)
REveSelection Container for selected and highlighted elements.
int RemoveImpliedSelectedReferencesTo(REveElement *el)
Remove pointers to el from implied selected sets.
void SetHighlightMode()
Set to 'highlight' mode.
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
REveViewerList List of Viewers providing common operations on REveViewer collections.
void AddElement(REveElement *el) override
Call base-class implementation.
REveViewer Reve representation of TGLViewer.
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
virtual Color_t GetLineColor() const
Return the line color.
TClass instances represent classes, structs and namespaces in the ROOT type system.
The color creation and management class.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
static void SetColorThreshold(Float_t t)
This method specifies the color threshold used by GetColor to retrieve a color.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A TFolder object is a collection of objects and folders.
virtual TObject * FindObject(const char *name) const
Search object identified by name in the tree of folders inside this folder.
An identity transformation.
The manager class for any TGeo geometry.
static void UnlockGeometry()
Unlock current geometry.
TObjArray * GetListOfVolumes() const
TObjArray * GetListOfMatrices() const
static Bool_t IsLocked()
Check lock state.
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
static void LockGeometry()
Lock current geometry so that no other geometry can be imported.
TGeoVolume * GetTopVolume() const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
void VisibleDaughters(Bool_t vis=kTRUE)
set visibility for daughters
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Class supporting a collection of lines with C++ code.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
TObject * At(Int_t idx) const
Collectable string class.
Mother of all ROOT objects.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
Class used by TMap to store (key,value) pairs.
void SetValue(TObject *val)
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
static constexpr double s
basic_json<> json
default JSON class