37 R__ERROR_HERE(
"Gpad") <<
"Cannot access canvas when unique object id should be assigned";
48 if (drawable->GetId() ==
id)
52 if (!pad_draw || !pad_draw->
Get())
continue;
56 if (!subelem)
continue;
64 std::vector<std::vector<ROOT::Experimental::TPad *>>
67 std::vector<std::vector<TPad *>> ret;
69 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 horizontal sub-pads!";
71 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 vertical sub-pads!";
72 if (!nHoriz || !nVert)
78 offset = (offset + padding);
79 offset *= {1. / nHoriz, 1. / nVert};
85 for (
int iHoriz = 0; iHoriz < nHoriz; ++iHoriz) {
86 ret[iHoriz].resize(nVert);
87 for (
int iVert = 0; iVert < nVert; ++iVert) {
89 subPos *= {1. * iHoriz, 1. * iVert};
90 auto uniqPad = std::make_unique<TPad>(*
this, size);
91 ret[iHoriz][iVert] = uniqPad.get();
92 Draw(std::move(uniqPad), subPos);
109 fFrame = std::make_unique<ROOT::Experimental::TFrame>();
120 if (
fFrame && dimension < fFrame->GetNDimensions())
121 return &
fFrame->GetUserAxis(dimension);
132 return &
fFrame->GetUserAxis(dimension);
168 if (vecBeginAndEnd.size() !=
fFrame->GetNDimensions()) {
170 <<
"Array of axis bound has wrong size " << vecBeginAndEnd.size()
171 <<
" versus numer of axes in frame " <<
fFrame->GetNDimensions();
175 for (
size_t i = 0,
n =
fFrame->GetNDimensions(); i <
n; ++i)
176 fFrame->GetUserAxis(i).SetBounds(vecBeginAndEnd[i][0], vecBeginAndEnd[i][1]);
185 if (vecBoundAndKind.size() !=
fFrame->GetNDimensions()) {
187 <<
"Array of axis bound has wrong size " << vecBoundAndKind.size()
188 <<
" versus numer of axes in frame " <<
fFrame->GetNDimensions();
192 for (
size_t i = 0,
n =
fFrame->GetNDimensions(); i <
n; ++i)
193 fFrame->GetUserAxis(i).SetBound(vecBoundAndKind[i].fKind, vecBoundAndKind[i].fBound);
202 fFrame->GetUserAxis(i).SetAutoBounds();
214 : fPad(
std::move(pPad)), fOpts(opts)
Draw a TPad, by drawing its contained graphical elements at the pad offset in the parent pad...
TPadUserAxisBase * GetOrCreateAxis(size_t dimension)
Get a pad axis from the TFrame.
std::vector< std::vector< TPad * > > Divide(int nHoriz, int nVert, const TPadExtent &padding={})
Divide this pad into a grid of subpads with padding in between.
TPadLength fVert
Vertical position.
TPadUserAxisBase * GetAxis(size_t dimension) const
Get a pad axis from the TFrame.
std::string GenerateUniqueId()
Generates unique ID inside the canvas.
A window's topmost TPad.
virtual const TCanvas * GetCanvas() const =0
Access to the top-most canvas, if any (const version).
Drawing options for a TPad.
std::shared_ptr< TDrawable > FindDrawable(const std::string &id) const
double fVal
Coordinate value.
void SetAllAxisBound(const std::vector< BoundKindAndValue > &vecBoundAndKind)
Set the range of an axis as bound kind and bound (up or down).
void SetBound(EAxisBoundsKind boundKind, double bound)
TPadLength fHoriz
Horizontal position.
void PaintDrawables(const TPadBase &pad)
std::unique_ptr< TFrame > fFrame
TFrame with user coordinate system, if used by this pad.
void Paint(Internal::TPadPainter &) final
Paint primitives from the pad.
std::unique_ptr< TPadDisplayItem > fPadDisplayItem
! display items for all drawables in the pad
virtual ~TPad()
Destructor to have a vtable.
A position (horizontal and vertical) in a TPad.
void AssignUniqueID(std::shared_ptr< TDrawable > &ptr)
const Primitives_t & GetPrimitives() const
Get the elements contained in the canvas.
Normal fNormal
The normalized coordinate summand.
const std::shared_ptr< TPad > fPad
The pad to be painted.
void GrowToDimensions(size_t nDimensions)
Create nDimensions default axes for the user coordinate system.
void SetBounds(double begin, double end)
void SetAllAxisBounds(const std::vector< std::array< double, 2 >> &vecBeginAndEnd)
Set the range of an axis as bound kind and bound (up or down).
TFrame * GetOrCreateFrame()
EAxisBoundsKind
Types of axis bounds to respect by the painter.
void SetAxisAutoBounds(int dimension)
Set the range of an axis as bound kind and bound (up or down).
void SetAxisBound(int dimension, TPadUserAxisBase::EAxisBoundsKind boundsKind, double bound)
Set the range of an axis as bound kind and bound (up or down).
TPadDrawingOpts & GetOptions()
Drawing options.
Abstract interface for object painting on the pad/canvas.
Holds a user coordinate system with a palette.
void CreateFrameIfNeeded()
void SetAllAxisAutoBounds()
Set the range of an axis as bound kind and bound (up or down).
virtual void AddDisplayItem(std::unique_ptr< TDisplayItem > &&item)
add display item to the canvas
An extent / size (horizontal and vertical) in a TPad.
TPadDrawable(std::shared_ptr< TPad > pPad, const TPadDrawingOpts &opts={})
Move a sub-pad into this (i.e. parent's) list of drawables.
void SetAxisBounds(int dimension, double begin, double end)
Set the range of an axis as begin, end.
#define R__ERROR_HERE(GROUP)
auto Draw(const std::shared_ptr< T > &what, ARGS... args)
Add something to be painted.