Belle II Software
release-08-01-10
|
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. More... | |
virtual void | drawLine (float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap()) |
Adds a line to the plot. More... | |
virtual void | drawArrow (float startX, float startY, float endX, float endY, const AttributeMap &attributeMap=AttributeMap()) |
Adds an arrow to the plot. More... | |
virtual void | drawCircle (float centerX, float centerY, float radius, const AttributeMap &attributeMap=AttributeMap()) |
Adds a circle to the plot. More... | |
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. More... | |
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. More... | |
virtual void | startGroup (const AttributeMap &attributeMap=AttributeMap()) |
Indicates the start of a group of drawn elements. More... | |
virtual void | endGroup () |
Indicates the end of a group of drawn elements. More... | |
virtual const std::string | save (const std::string &fileName) |
Saves the current plot state to a file. More... | |
virtual void | clear () |
Clears all drawed elements from the plotter. More... | |
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 drawed objects. | |
void | setBoundingBox (const BoundingBox &boundingBox) |
Setter for the bounding box of all drawed 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. More... | |
void | setCanvasHeight (float height) |
Setter for the canvas height in pixels The canvas height denotes the size of the image being produced. More... | |
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.
|
virtual |
Clears all drawed elements from the plotter.
Base implementation only updates the bounding box.
Reimplemented in SVGPrimitivePlotter.
Definition at line 111 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 sting 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 sting 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 sting 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 sting 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 sting 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.
|
virtual |
Saves the current plot state to a file.
Deriving instances may should implement the approriate 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 concret 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 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 seperate 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 seperate 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.