25static std::mutex &GetHeldCanvasesMutex()
27 static std::mutex sMutex;
31static std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> &GetHeldCanvases()
33 static std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> sCanvases;
45 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
47 return GetHeldCanvases();
55 return fPainter ? fPainter->IsCanvasModified(fModified) : fModified;
64 fPainter->CanvasUpdated(fModified, async, callback);
72 auto pCanvas = std::make_shared<RCanvas>();
73 pCanvas->SetTitle(title);
75 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
76 GetHeldCanvases().emplace_back(pCanvas);
98 bool isany = (fPainter->NumDisplays() > 0);
101 fPainter->NewDisplay(where);
113 fPainter->NewDisplay(where);
114 fPainter->CanvasUpdated(fModified,
true,
nullptr);
124 return fPainter->GetWindowAddr();
136 delete fPainter.release();
152 auto height =
fSize[1].fVal;
154 return fPainter->ProduceBatchOutput(filename,
width > 1 ? (
int)
width : 800, height > 1 ? (
int) height : 600);
162 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
163 auto &held = GetHeldCanvases();
164 auto indx = held.size();
166 if (held[indx].get() ==
this)
167 held.erase(held.begin() + indx);
216 std::this_thread::sleep_for(std::chrono::milliseconds(
int(tm*1000)));
231 for (
unsigned n = 0;
n < vect.size(); ++
n) {
232 if (vect[
n]->HasShared() || !vect[
n]->GetIOPtr())
continue;
234 auto shrd_ptr = vect[
n]->MakeShared();
236 for (
auto n2 =
n+1; n2 < vect.size(); ++n2) {
237 if (vect[n2]->GetIOPtr() == vect[
n]->GetIOPtr()) {
238 if (vect[n2]->HasShared())
239 R__ERROR_HERE(
"Gpadv7") <<
"FATAL Shared pointer for same IO ptr already exists";
241 vect[n2]->SetShared(shrd_ptr);
256 if (!canv)
return nullptr;
258 if ((ids.size() != names.size()) || (ids.size() != values.size())) {
259 R__ERROR_HERE(
"Gpadv7") <<
"Mismatch of arrays size in RChangeAttrRequest";
265 for(
int indx = 0; indx < (
int) ids.size(); indx++) {
266 if (ids[indx] ==
"canvas") {
267 if (canv->GetAttrMap().Change(names[indx], values[indx].get())) {
268 if (!vers) vers = canv->IncModified();
269 canv->SetDrawableVersion(vers);
272 auto drawable = canv->FindPrimitiveByDisplayId(ids[indx]);
273 if (drawable && drawable->GetAttrMap().Change(names[indx], values[indx].get())) {
274 if (!vers) vers = canv->IncModified();
275 drawable->SetDrawableVersion(vers);
280 fNeedUpdate = (vers > 0);
#define R__ERROR_HERE(GROUP)
include TDocParser_001 C image html pict1_TDocParser_001 png width
static std::unique_ptr< RVirtualCanvasPainter > Create(RCanvas &canv)
Loads the plugin that implements this class.
static const std::vector< std::shared_ptr< RCanvas > > GetCanvases()
Returns list of created canvases.
bool SaveAs(const std::string &filename)
Save canvas in image file.
bool IsModified() const
Returns true is canvas was modified since last painting.
void Show(const std::string &where="")
Display the canvas.
std::string GetWindowAddr() const
Returns window name used to display canvas.
void Remove()
Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.
void ResolveSharedPtrs()
To resolve problem with storing of shared pointers Call this method when reading canvas from the file...
void Run(double tm=0.)
Run canvas functionality for given time (in seconds)
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
void Update(bool async=false, CanvasCallback_t callback=nullptr)
update drawing
void Hide()
Hide all canvas displays.
std::unique_ptr< RDrawableReply > Process() override
Apply attributes changes to the drawable Return mask with actions which were really applied.
std::vector< RIOSharedBase * > RIOSharedVector_t
std::function< void(bool)> CanvasCallback_t