23namespace Experimental {
27class RPadBaseDisplayItem;
77 std::vector<std::vector<std::shared_ptr<RPad>>>
Divide(
int nHoriz,
int nVert,
const RPadExtent &padding = {});
80 template<
class T,
class...
ARGS>
83 auto drawable = std::make_shared<T>(args...);
91 auto Draw(std::shared_ptr<RDrawable> &&drawable)
101 template <
class T,
class...
ARGS>
102 auto Draw(
const std::shared_ptr<T> &what,
ARGS... args)
122 std::shared_ptr<RDrawable>
FindPrimitive(
const std::string &
id)
const;
131 res.emplace_back(entry.get_shared());
148 bool Remove(
const std::shared_ptr<RDrawable> &drawable)
183 void SetAllAxisBounds(
const std::vector<std::array<double, 2>> &vecBeginAndEnd);
190 void SetAllAxisBound(
const std::vector<BoundKindAndValue> &vecBoundAndKind);
194 virtual std::array<RPadLength::Normal, 2>
PixelsToNormal(
const std::array<RPadLength::Pixel, 2> &pos)
const = 0;
203 std::array<RPadLength::Normal, 2>
UserToNormal(
const std::array<RPadLength::User, 2> &pos)
const
205 return fFrame->UserToNormal(pos);
Base class for drawable entities: objects that can be painted on a RPad.
Holds a user coordinate system with a palette.
class RPadBaseDisplayItem
Base class for graphic containers for RDrawable-s.
RPadBase & operator=(const RPadBase &)=delete
Disable assignment.
RPadBase(const RPadBase &)=delete
Disable copy construction.
auto Draw(std::shared_ptr< RDrawable > &&drawable)
Add existing drawable instance to canvas.
bool Remove(const std::shared_ptr< RDrawable > &drawable)
Remove drawable from list of primitives.
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.
void UseStyle(const std::shared_ptr< RStyle > &style) override
Use provided style for pad and all primitives inside.
RPadBase()
Allow derived classes to default construct a RPadBase.
std::array< RPadLength::Normal, 2 > UserToNormal(const std::array< RPadLength::User, 2 > &pos) const
Convert user coordinates to normal coordinates.
void CollectShared(Internal::RIOSharedVector_t &) override
Collect all shared items to resolve shared_ptr after IO.
auto Draw(ARGS... args)
Create drawable of specified class T.
void CreateFrameIfNeeded()
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::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.
std::shared_ptr< RDrawable > GetPrimitive(unsigned num) const
returns primitive of given number
virtual const RCanvas * GetCanvas() const =0
Access to the top-most canvas, if any (const version).
bool Remove(const std::string &id)
Remove an object from the list of primitives.
void SetAllAxisAutoBounds()
Set the range of an axis as bound kind and bound (up or down).
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.
auto GetPrimitives() const
Get all primitives contained in the pad.
unsigned NumPrimitives() const
returns number of primitives in the pad
std::vector< Primitive_t > fPrimitives
Content of the pad.
void SetAllAxisBounds(const std::vector< std::array< double, 2 > > &vecBeginAndEnd)
Set the range of an axis as bound kind and bound (up or down).
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.
bool RemoveAt(unsigned indx)
Remove drawable at specified position.
void AssignAutoColors()
Method collect existing colors and assign new values if required.
RPadUserAxisBase * GetOrCreateAxis(size_t dimension)
Get a pad axis from the RFrame.
void DisplayPrimitives(RPadBaseDisplayItem &paditem) const
Create display items for all primitives in the pad Each display item gets its special id,...
RFrame * GetOrCreateFrame()
auto Draw(const std::shared_ptr< T > &what, ARGS... args)
Add something to be painted.
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...
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).
std::shared_ptr< RDrawable > FindPrimitive(const std::string &id) const
Find primitive with specified id.
An extent / size (horizontal and vertical) in a RPad.
Base class for user coordinates (e.g.
EAxisBoundsKind
Types of axis bounds to respect by the painter.
@ kAxisBoundsAuto
no defined axis range; the painter will decide
std::vector< RIOSharedBase * > RIOSharedVector_t
auto GetDrawable(const std::shared_ptr< DRAWABLE > &drawable)
Central method to insert drawable in list of pad primitives By default drawable placed as is.
Simple struct representing an axis bound.
RPadUserAxisBase::EAxisBoundsKind fKind