22#include <nlohmann/json.hpp>
41REveScene::REveScene(
const std::string&
n,
const std::string& t) :
82 auto pred = [&](std::unique_ptr<REveClient> &client) {
83 return client->fId ==
id;
99 throw eh +
"Element id and dictionary has to be defined";
144 nlohmann::json
jarr = nlohmann::json::array();
146 nlohmann::json
jhdr = {};
147 jhdr[
"content"] =
"REveScene::StreamElements";
151 jhdr[
"commands"] = nlohmann::json::array();
153 nlohmann::json
jcmd = {};
156 jcmd[
"elementid"] =
cmd.fElementId;
157 jcmd[
"elementclass"] =
cmd.fElementClass;
188 nlohmann::json
jobj = {};
195 if (
el->fScene ==
el &&
el !=
this)
208 for (
auto &&
c :
el->fChildren)
223 if (
c->GetMother() ==
el)
241 nlohmann::json
jarr = nlohmann::json::array();
243 nlohmann::json
jhdr = {};
244 jhdr[
"content"] =
"ElementsRepresentaionChanges";
247 jhdr[
"removedElements"] = nlohmann::json::array();
249 jhdr[
"removedElements"].push_back(re);
259 nlohmann::json
jobj = {};
260 jobj[
"fElementId"] =
el->GetElementId();
261 jobj[
"changeBit"] = bits;
267 Info(
"REveScene::StreamRepresentationChanges",
"new element change %s %d\n",
268 el->GetCName(), bits);
282 jobj[
"fRnrSelf"] =
el->GetRnrSelf();
283 jobj[
"fRnrChildren"] =
el->GetRnrChildren();
288 el->WriteCoreJson(
jobj, -1);
317 nlohmann::json
msg = { {
"header",
jhdr}, {
"arr",
jarr}};
321 Info(
"REveScene::StreamRepresentationChanges",
"class: %s changes %s ...",
GetCName(),
msg.dump(1).c_str() );
329 printf(
" sending json, len = %d --> to conn_id = %d\n", (
int)
fOutputJson.size(), client->fId);
330 client->fWebWindow->Send(client->fId,
fOutputJson);
347 ::Info(
"REveScene::IsChanged",
"%s (changed_or_added=%d, removed=%d)",
GetCName(),
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
virtual void DestroyOrWarn()
Destroy this element. Prints a warning if deny-destroy is in force.
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
const char * GetCName() const
virtual void DestroyElements()
Destroy all children of this element.
void SetChildClass(TClass *c)
virtual void RemoveElement(REveElement *el)
Remove el from the list of children.
REveException Exception-type thrown by Eve classes.
REveSceneList * GetScenes() const
void SceneSubscriberWaitingResponse(unsigned cinnId)
REveViewerList * GetViewers() const
void EndAcceptingChanges()
REveSceneList(const REveSceneList &)=delete
void BeginAcceptingChanges()
Loop-wrapers over Scene children, element type checked on insertion.
void DestroyScenes()
Destroy all scenes and their contents.
std::vector< std::unique_ptr< REveClient > > fSubscribers
!
Bool_t HasSubscribers() const
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
void AddSubscriber(std::unique_ptr< REveClient > &&sub)
std::vector< char > fOutputBinary
!
~REveScene() override
Destructor.
Bool_t fAcceptingChanges
!
void SceneElementRemoved(ElementId_t id)
void StreamRepresentationChanges()
Prepare data for sending element changes.
void StreamJsonRecurse(REveElement *el, nlohmann::json &jobj)
std::vector< SceneCommand > fCommands
!
void SendChangesToSubscribers()
void BeginAcceptingChanges()
List_t fElsWithBinaryData
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
std::vector< ElementId_t > fRemovedElements
!
void SceneElementChanged(REveElement *element)
void EndAcceptingChanges()
void RemoveSubscriber(unsigned int)
void SceneDestructing(REveScene *scene)
Callback done from a REveScene destructor allowing proper removal of the scene from affected viewers.
R__EXTERN REveManager * gEve