21using namespace std::string_literals;
34 drawable->UseStyle(
style);
44 if (drawable->GetId() ==
id)
45 return drawable.get_shared();
66 auto p =
id.find(
'_');
67 if (
p == std::string::npos)
74 auto subid =
id.substr(
p+1);
79 auto subpad = std::dynamic_pointer_cast<RPadBase>(prim);
81 return subpad ? subpad->FindPrimitiveByDisplayId(subid) :
nullptr;
89 auto p =
id.find(
'_');
90 if (
p == std::string::npos)
97 auto subid =
id.substr(
p+1);
102 auto subpad = std::dynamic_pointer_cast<RPadBase>(prim);
104 return subpad ? subpad->FindPadForPrimitiveWithDisplayId(subid) :
nullptr;
123 auto item = drawable->Display(ctxt);
126 item = std::make_unique<RDisplayItem>(
true);
128 item->SetObjectIDAsPtr(drawable.get());
131 paditem.
Add(std::move(item), drawable->fStyle.lock());
140 auto pad =
new RPad(pos, extent);
142 pad->SetParent(
this);
143 std::shared_ptr<RPad> pshared(pad);
153std::vector<std::vector<std::shared_ptr<RPad>>>
156 std::vector<std::vector<std::shared_ptr<RPad>>> ret;
161 if (!nHoriz || !nVert)
168 offset *= {1. / nHoriz, 1. / nVert};
171 for (
int iHoriz = 0; iHoriz < nHoriz; ++iHoriz) {
173 for (
int iVert = 0; iVert < nVert; ++iVert) {
175 subPos *= {1. * iHoriz, 1. * iVert};
179 ret.back().emplace_back(subpad);
205 if (
const std::shared_ptr<RFrame> frame = std::dynamic_pointer_cast<RFrame>(drawable.get_shared()))
217 if (std::shared_ptr<RFrame> frame = std::dynamic_pointer_cast<RFrame>(drawable.get_shared()))
229 vect.emplace_back(&handle);
230 auto drawable = handle.get();
231 if (drawable) drawable->CollectShared(vect);
243 drawable->SetDrawableVersion(vers);
#define R__LOG_ERROR(...)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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 id
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
void SetDrawable(RDrawable *dr, unsigned indx)
Set drawable and its index in list of primitives.
unsigned GetIndex() const
std::weak_ptr< RStyle > fStyle
! style applied for RDrawable, not stored when canvas is saved
virtual void SetDrawableVersion(Version_t vers)
virtual void UseStyle(const std::shared_ptr< RStyle > &style)
Holds an area where drawing on user coordinate-system can be performed.
class RPadBaseDisplayItem
void SetPadStyle(std::shared_ptr< RStyle > &&style)
Assign style for the pad.
void Add(std::unique_ptr< RDisplayItem > &&item, std::shared_ptr< RStyle > &&style)
Add display item and style which should be used for it.
void SetAttributes(const RAttrMap *f)
Base class for graphic containers for RDrawable-s.
void DisplayPrimitives(RPadBaseDisplayItem &paditem, RDisplayContext &ctxt)
Create display items for all primitives in the pad Each display item gets its special id,...
void SetDrawableVersion(Version_t vers) override
Assign drawable version - for pad itself and all primitives.
std::shared_ptr< RDrawable > FindPrimitiveByDisplayId(const std::string &display_id) const
Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification...
const RPadBase * FindPadForPrimitiveWithDisplayId(const std::string &display_id) const
Find subpad which contains primitive with given display id.
std::shared_ptr< RDrawable > GetPrimitive(unsigned num) const
returns primitive of given number
std::shared_ptr< RFrame > GetFrame()
Get a frame object if exists.
std::shared_ptr< RPad > AddPad(const RPadPos &, const RPadExtent &)
Add subpad.
std::shared_ptr< RDrawable > FindPrimitive(const std::string &id) const
Find primitive with specified id.
void CollectShared(Internal::RIOSharedVector_t &) override
Collect all shared items to resolve shared_ptr after IO.
std::vector< Primitive_t > fPrimitives
Content of the pad.
std::vector< std::vector< std::shared_ptr< RPad > > > Divide(int nHoriz, int nVert, const RPadExtent &padding={})
Divide this pad into a grid of subpads with padding in between.
std::shared_ptr< RFrame > AddFrame()
Add a frame object for the pad.
void UseStyle(const std::shared_ptr< RStyle > &style) override
Use provided style for pad and all primitives inside.
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.
Graphic container for RDrawable-s.
std::vector< RIOSharedBase * > RIOSharedVector_t
RLogChannel & GPadLog()
Log channel for GPad diagnostics.