Belle II Software development
|
A base class for plots of primitive objects. More...
#include <PrimitivePlotter.h>
Public Types | |
using | AttributeMap = Belle2::TrackFindingCDC::AttributeMap |
A map type for attributes names to values for additional drawing information. | |
Public Member Functions | |
PrimitivePlotter () | |
Default constructor for ROOT compatibility. | |
virtual | ~PrimitivePlotter () |
Make destructor virtual to handle polymorphic deconstruction. | |
virtual std::unique_ptr< PrimitivePlotter > | clone () const |
Returns a newly created plotter instance containing all information of this. | |
virtual void | drawLine (float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap()) |
Adds a line to the plot. | |
virtual void | drawArrow (float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap()) |
Adds an arrow to the plot. | |
virtual void | drawCircle (float centerX, float centerY, float radius, const AttributeMap &attributeMap=AttributeMap()) |
Adds a circle to the plot. | |
virtual void | drawCircleArc (float startX, float startY, float endX, float endY, float radius, bool longArc, bool sweepFlag, const AttributeMap &attributeMap=AttributeMap()) |
Adds a circle arc to the plot. | |
virtual void | drawCurve (const std::vector< std::array< float, 2 > > &points, const std::vector< std::array< float, 2 > > &tangents, const AttributeMap &attributeMap=AttributeMap()) |
Adds a smooth curve to the plot. | |
virtual void | startGroup (const AttributeMap &attributeMap=AttributeMap()) |
Indicates the start of a group of drawn elements. | |
virtual void | endGroup () |
Indicates the end of a group of drawn elements. | |
virtual const std::string | save (const std::string &fileName) |
Saves the current plot state to a file. | |
virtual void | clear () |
Clears all drawn elements from the plotter. | |
void | clearBoundingBox () |
Clears the current bounding box. Only following draw calls contribute to the bounding box. | |
const BoundingBox & | getBoundingBox () const |
Getter for the bounding box of all drawn objects. | |
void | setBoundingBox (const BoundingBox &boundingBox) |
Setter for the bounding box of all drawn objects. | |
float | getCanvasWidth () |
Getter for the canvas width in pixels. | |
float | getCanvasHeight () |
Getter for the canvas height in pixels. | |
void | setCanvasWidth (float width) |
Setter for the canvas width in pixels. | |
void | setCanvasHeight (float height) |
Setter for the canvas height in pixels The canvas height denotes the size of the image being produced. | |
Static Public Attributes | |
static const float | s_defaultCanvasWidth = 1120.0 |
The default width of the canvas to be plotted into. | |
static const float | s_defaultCanvasHeight = 1120.0 |
The default height of the canvas to be plotted into. | |
Private Attributes | |
BoundingBox | m_boundingBox |
Bounding box of the currently drawn objects. | |
float | m_canvasWidth |
Memory for the width of the SVG drawing in pixels. | |
float | m_canvasHeight |
Memory for the height of the SVG drawing in pixels. | |
A base class for plots of primitive objects.
Definition at line 25 of file PrimitivePlotter.h.
using AttributeMap = Belle2::TrackFindingCDC::AttributeMap |
A map type for attributes names to values for additional drawing information.
Definition at line 29 of file PrimitivePlotter.h.
PrimitivePlotter | ( | ) |
Default constructor for ROOT compatibility.
Definition at line 16 of file PrimitivePlotter.cc.
|
virtual |
Clears all drawn elements from the plotter.
Base implementation only updates the bounding box.
Reimplemented in SVGPrimitivePlotter.
Definition at line 111 of file PrimitivePlotter.cc.
void clearBoundingBox | ( | ) |
Clears the current bounding box. Only following draw calls contribute to the bounding box.
Definition at line 115 of file PrimitivePlotter.cc.
|
virtual |
Returns a newly created plotter instance containing all information of this.
The new object is created on the heap. The ownership is to the caller who has the responsibility to destroy it.
Reimplemented in SVGPrimitivePlotter.
Definition at line 25 of file PrimitivePlotter.cc.
|
virtual |
Adds an arrow to the plot.
Base implementation only updates the bounding box.
startX | x coordinate where the arrow starts. |
startY | y coordinate where the arrow starts. |
endX | x coordinate where the arrow ends. |
endY | y coordinate where the arrow ends. |
attributeMap | A map of string keys and values that describe the drawing properties of the line. |
Reimplemented in SVGPrimitivePlotter.
Definition at line 42 of file PrimitivePlotter.cc.
|
virtual |
Adds a circle to the plot.
Base implementation only updates the bounding box.
centerX | x coordinate of the circle center. |
centerY | y coordinate of the circle center. |
radius | radius of the circle |
attributeMap | A map of string keys and values that describe the drawing properties of the line. |
Reimplemented in SVGPrimitivePlotter.
Definition at line 52 of file PrimitivePlotter.cc.
|
virtual |
Adds a circle arc to the plot.
Base implementation only updates the bounding box.
startX | x coordinate where the line starts. |
startY | y coordinate where the line starts. |
endX | x coordinate where the line end. |
endY | y coordinate where the line end. |
radius | Radius of the circle |
longArc | Boolean indicator if the long arc or the short arc is traversed from one point to the other. |
sweepFlag | Boolean indicator related to the curvature perceived one the circle arc. False means negative curvature. True mean positive curvature. |
attributeMap | A map of string keys and values that describe the drawing properties of the line. |
Reimplemented in SVGPrimitivePlotter.
Definition at line 66 of file PrimitivePlotter.cc.
|
virtual |
Adds a smooth curve to the plot.
Base implementation only updates the bounding box.
points | X,Y points on the curve |
tangents | Tangent vector at each point. Length of tangents does not matter. |
attributeMap | A map of string keys and values that describe the drawing properties of the line. |
Reimplemented in SVGPrimitivePlotter.
Definition at line 80 of file PrimitivePlotter.cc.
|
virtual |
Adds a line to the plot.
Base implementation only updates the bounding box.
startX | x coordinate where the line starts. |
startY | y coordinate where the line starts. |
endX | x coordinate where the line ends. |
endY | y coordinate where the line ends. |
attributeMap | A map of string keys and values that describe the drawing properties of the line. |
Reimplemented in SVGPrimitivePlotter.
Definition at line 32 of file PrimitivePlotter.cc.
|
virtual |
Indicates the end of a group of drawn elements.
Meaning depends on the actual implementation.
Does nothing in the base implementation
Reimplemented in SVGPrimitivePlotter.
Definition at line 100 of file PrimitivePlotter.cc.
|
inline |
Getter for the bounding box of all drawn objects.
Definition at line 189 of file PrimitivePlotter.h.
|
inline |
Getter for the canvas height in pixels.
Definition at line 208 of file PrimitivePlotter.h.
|
inline |
Getter for the canvas width in pixels.
Definition at line 202 of file PrimitivePlotter.h.
|
virtual |
Saves the current plot state to a file.
Deriving instances may should implement the appropriate thing here and may return a modified string indicating the file name to which the plot as been written. It is allowed to append or change the file extension if the concrete implementation decides to do so.
fileName | File name where the plot shall be saved |
Reimplemented in SVGPrimitivePlotter.
Definition at line 105 of file PrimitivePlotter.cc.
|
inline |
Setter for the bounding box of all drawn objects.
Definition at line 195 of file PrimitivePlotter.h.
|
inline |
Setter for the canvas height in pixels The canvas height denotes the size of the image being produced.
The coordinates space that is visible in the picture is a separate concept which is stored in the bounding box (getBoundingBox()).
Definition at line 230 of file PrimitivePlotter.h.
|
inline |
Setter for the canvas width in pixels.
The canvas height denotes the size of the image being produced. The coordinates space that is visible in the picture is a separate concept which is stored in the bounding box (getBoundingBox()).
Definition at line 219 of file PrimitivePlotter.h.
|
virtual |
Indicates the start of a group of drawn elements.
Meaning depends on the actual implementation.
Does nothing in the base implementation
Reimplemented in SVGPrimitivePlotter.
Definition at line 95 of file PrimitivePlotter.cc.
|
private |
Bounding box of the currently drawn objects.
Definition at line 237 of file PrimitivePlotter.h.
|
private |
Memory for the height of the SVG drawing in pixels.
Definition at line 243 of file PrimitivePlotter.h.
|
private |
Memory for the width of the SVG drawing in pixels.
Definition at line 240 of file PrimitivePlotter.h.
|
static |
The default height of the canvas to be plotted into.
Definition at line 36 of file PrimitivePlotter.h.
|
static |
The default width of the canvas to be plotted into.
Definition at line 33 of file PrimitivePlotter.h.