23#include "ROOT/RDrawingAttr.hxx" 
   24#include "ROOT/RDrawingOptsBase.hxx" 
   32namespace Experimental {
 
   61   template <
class DRAWABLE>
 
   68      using Options_t = 
typename std::remove_reference<
decltype(uPtr->GetOptions())>::
type;
 
   69      auto spDrawable = std::static_pointer_cast<DRAWABLE>(
fPrimitives.back());
 
   72      return std::shared_ptr<Options_t>(spDrawable, &spDrawable->GetOptions());
 
   87   std::vector<std::vector<RPad *>> 
Divide(
int nHoriz, 
int nVert, 
const RPadExtent &padding = {});
 
   92   template <
class T, 
class... 
ARGS>
 
   93   auto Draw(
const std::shared_ptr<T> &what, 
ARGS... args)
 
  101   template <
class T, 
class... 
ARGS>
 
  110   template <
class T, 
class... 
ARGS, 
class = 
typename std::enable_if<!ROOT::TypeTraits::IsSmartOrDumbPtr<T>::value>
::type>
 
  114      return Draw(std::make_unique<T>(what), args...);
 
  120         [&opts](
const std::shared_ptr<RDrawable>& drawable) { return &drawable->GetOptionsBase() == &opts; });
 
  127   std::shared_ptr<RDrawable> 
FindDrawable(
const std::string &
id) 
const;
 
  147   void SetAllAxisBounds(
const std::vector<std::array<double, 2>> &vecBeginAndEnd);
 
  154   void SetAllAxisBound(
const std::vector<BoundKindAndValue> &vecBoundAndKind);
 
  161   virtual std::array<RPadLength::Normal, 2> 
PixelsToNormal(
const std::array<RPadLength::Pixel, 2> &pos) 
const = 0;
 
  170   std::array<RPadLength::Normal, 2> 
UserToNormal(
const std::array<RPadLength::User, 2> &pos)
 const 
  172      return fFrame->UserToNormal(pos);
 
  191   friend std::unique_ptr<RPadDrawable> 
GetDrawable(std::unique_ptr<RPad> &&pad);
 
  218   std::array<RPadLength::Normal, 2> 
PixelsToNormal(
const std::array<RPadLength::Pixel, 2> &pos)
 const override 
  221      std::array<RPadLength::Normal, 2> myPixelInNormal =
 
  223      std::array<RPadLength::Normal, 2> myUserInNormal =
 
  227      return {{posInParentNormal[0] / (
fSize.
fHoriz.
fNormal + myPixelInNormal[0] + myUserInNormal[0]),
 
  228               posInParentNormal[1] / (
fSize.
fVert.
fNormal + myPixelInNormal[1] + myUserInNormal[1])}};
 
  236      return {{pos.
fHoriz.
fNormal + pixelsInNormal[0] + userInNormal[0],
 
  237               pos.
fVert.
fNormal + pixelsInNormal[1] + userInNormal[1]}};
 
  246   RDrawingAttr<RPadPos> 
fPos{*
this, 
"PadOffset"}; 
 
  270   const std::shared_ptr<RPad> 
fPad; 
 
  286template <
class... 
ARGS>
 
  287inline std::shared_ptr<RPadDrawable> 
GetDrawable(std::unique_ptr<RPad> &&pad, 
ARGS... args)
 
  289   return std::make_shared<RPadDrawable>(std::move(pad), 
RPadDrawingOpts(args...));
 
  292template <
class... 
ARGS>
 
  293inline std::shared_ptr<RPadDrawable> 
GetDrawable(
const std::shared_ptr<RPad> &pad, 
ARGS... args)
 
Abstract interface for object painting on the pad/canvas.
Holds a user coordinate system with a palette.
Base class for graphic containers for RDrawable-s.
RPadBase & operator=(const RPadBase &)=delete
Disable assignment.
RPadBase(const RPadBase &)=delete
Disable copy construction.
const RFrame * GetFrame() const
virtual std::array< RPadLength::Normal, 2 > PixelsToNormal(const std::array< RPadLength::Pixel, 2 > &pos) const =0
Convert a Pixel position to Canvas-normalized positions.
std::array< RPadLength::Normal, 2 > UserToNormal(const std::array< RPadLength::User, 2 > &pos) const
Convert user coordinates to normal coordinates.
void CreateFrameIfNeeded()
Primitives_t fPrimitives
Content of the pad.
auto Draw(const T &what, ARGS... args)
Add a copy of something to be painted.
std::vector< std::shared_ptr< RDrawable > > Primitives_t
void SetAllAxisBound(const std::vector< BoundKindAndValue > &vecBoundAndKind)
Set the range of an axis as bound kind and bound (up or down).
void SetAxisBounds(int dimension, double begin, double end)
Set the range of an axis as begin, end.
virtual const RCanvas * GetCanvas() const =0
Access to the top-most canvas, if any (const version).
void SetAllAxisAutoBounds()
Set the range of an axis as bound kind and bound (up or down).
bool Remove(RDrawingOptsBase &opts)
Remove an object from the list of primitives.
void SetAxisBound(int dimension, RPadUserAxisBase::EAxisBoundsKind boundsKind, double bound)
Set the range of an axis as bound kind and bound (up or down).
std::unique_ptr< RFrame > fFrame
RFrame with user coordinate system, if used by this pad.
const Primitives_t & GetPrimitives() const
Get the elements contained in the canvas.
void SetAllAxisBounds(const std::vector< std::array< double, 2 > > &vecBeginAndEnd)
Set the range of an axis as bound kind and bound (up or down).
auto Draw(std::unique_ptr< T > &&what, ARGS... args)
Add something to be painted.
virtual RCanvas * GetCanvas()=0
Access to the top-most canvas, if any (non-const version).
RPadUserAxisBase * GetAxis(size_t dimension) const
Get a pad axis from the RFrame.
RPadUserAxisBase * GetOrCreateAxis(size_t dimension)
Get a pad axis from the RFrame.
RFrame * GetOrCreateFrame()
void AssignUniqueID(std::shared_ptr< RDrawable > &ptr)
auto Draw(const std::shared_ptr< T > &what, ARGS... args)
Add something to be painted.
void Wipe()
Wipe the pad by clearing the list of primitives.
void SetAxisAutoBounds(int dimension)
Set the range of an axis as bound kind and bound (up or down).
auto AddDrawable(std::shared_ptr< DRAWABLE > &&uPtr)
Adds a DRAWABLE to fPrimitives, returning a shared_ptr to DRAWABLE::GetOptions().
RPadBase()=default
Allow derived classes to default construct a RPadBase.
std::vector< std::vector< RPad * > > Divide(int nHoriz, int nVert, const RPadExtent &padding={})
Divide this pad into a grid of subpads with padding in between.
std::shared_ptr< RDrawable > FindDrawable(const std::string &id) const
Draw a RPad, by drawing its contained graphical elements at the pad offset in the parent pad.
void Paint(Internal::RPadPainter &) final
Paint primitives from the pad.
RPadDrawingOpts fOpts
The drawing options.
const std::shared_ptr< RPad > fPad
The pad to be painted.
RPadDrawingOpts & GetOptions()
Drawing options.
RPadDrawable(std::shared_ptr< RPad > pPad, const RPadDrawingOpts &opts={})
Move a sub-pad into this (i.e. parent's) list of drawables.
Drawing options for a RPad.
RPadDrawingOpts & At(const RPadPos &pos)
Set the position of this pad with respect to the parent pad.
const RDrawingAttr< RPadPos > & GetOffset() const
RDrawingAttr< RPadPos > & GetOffset()
RPadDrawingOpts()=default
RPadDrawingOpts(const RPadPos &pos)
Construct the drawing options.
RDrawingAttr< RPadPos > fPos
Offset with respect to parent RPad.
Pixel fPixel
The pixel coordinate summand.
User fUser
The user coordinate summand.
Normal fNormal
The normalized coordinate summand.
EAxisBoundsKind
Types of axis bounds to respect by the painter.
@ kAxisBoundsAuto
no defined axis range; the painter will decide
Graphic container for RDrawable-s.
const RPadExtent & GetSize() const
Get the size of the pad in parent (!) coordinates.
RPad(RPadBase &parent, const RPadExtent &size)
Create a child pad.
const RCanvas * GetCanvas() const override
Access to the top-most canvas (const version).
const RPadBase * GetParent() const
Access to the parent pad (const version).
RCanvas * GetCanvas() override
Access to the top-most canvas (non-const version).
friend std::unique_ptr< RPadDrawable > GetDrawable(std::unique_ptr< RPad > &&pad)
virtual ~RPad()
Destructor to have a vtable.
RPadBase * GetParent()
Access to the parent pad (non-const version).
std::array< RPadLength::Normal, 2 > PixelsToNormal(const std::array< RPadLength::Pixel, 2 > &pos) const override
Convert a Pixel position to Canvas-normalized positions.
RPadBase * fParent
Pad containing this pad as a sub-pad.
std::array< RPadLength::Normal, 2 > ToNormal(const Internal::RPadHorizVert &pos) const
Convert a RPadPos to [x, y] of normalized coordinates.
RPad()=default
Create a topmost, non-paintable pad.
RPadExtent fSize
The parent pad, if this pad has one.
std::shared_ptr< RPadDrawable > GetDrawable(std::unique_ptr< RPad > &&pad, ARGS... args)
Namespace for new ROOT classes and functions.
A 2D (horizontal and vertical) combination of RPadLengths.
RPadLength fHoriz
Horizontal position.
RPadLength fVert
Vertical position.
Simple struct representing an axis bound.
RPadUserAxisBase::EAxisBoundsKind fKind
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.