Class Drawer#
Defined in File Drawer.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Derived Type#
public CairoDrawer(Class CairoDrawer)
Class Documentation#
-
class Drawer#
Abstract Drawer for MooViE scenes.
An abstract Drawer class that can be used to draw MooViE elements. Drawer is supposed to cover the strategy that is used to actually draw an image with a MooViE scene. It provides the implementation with a CoordinateConverter, TextAlignment wrapper and basic calculation functions for points.
- Author
stratmann
- Date
27.04.2018
Subclassed by CairoDrawer
Public Functions
-
inline Drawer(int width, int height, std::size_t num_inputs)#
Creates a Drawer which draws on a surface with the given width and height.
- Parameters:
width – the surface width
height – the surface height
num_inputs – the number of inputs
-
inline virtual ~Drawer()#
-
virtual void change_surface(const std::string &fpath, int width, int height, std::size_t num_inputs) = 0#
Alters the surface of this Drawer in number of inputs, width, height and storage path. All unsafed changes will be stored and all kept resources freed correctly.
- Parameters:
fpath – a string containing an valid existing or accessible not existing path
width – an integer between 0 and MAX_INT
height – an integer between 0 and MAX_INT
num_inputs – the number of inputs
-
virtual void draw_output_grid(const OutputGrid &grid) = 0#
Draws a OutputGrid using its radius and angles. For thin or thick lines the properties given by the Configuration instance are used.
- Parameters:
grid – the OutputGrid to draw
-
virtual void draw_input_axis(const InputAxis &axis) = 0#
Draws a InputAxis using its radius and angles. For thin or thick lines the properties given by the Configuration instance are used.
- Parameters:
axis – the InputAxis to draw
-
virtual void draw_io_vector(const IOVector &elem) = 0#
Draws a IOVector using its coordinates.
- Parameters:
elem – the IOVector to draw
-
inline void set_num_inputs(std::size_t num_inputs)#
Public Static Attributes
-
static constexpr double LINK_CONTROL_STRENGTH = 100#
Protected Functions
-
virtual void set_surface(const std::string &fpath, int width, int height) = 0#
Alters the surface of this Drawer in with, height and storage path.
- Parameters:
fpath – a string containing an valid or accessible path
width – an integer between 0 and MAX_INT
height – an integer between 0 and MAX_INT
-
virtual void draw_histogram(const InputAxis::Histogram &histogram, double radius, const Angle &start, const Angle &end) = 0#
Draws a Histogram from the given radius, between begin and end Angle. For the histogram height, thin or thick lines the properties given by the Configuration instance are used.
- Parameters:
histogram – the Histogram to draw
radius – the start radius of the Histogram
start – the starting angle of the Histogram
end – the end angle of the Histogram
-
virtual void draw_link(const Polar &origin1, const Polar &origin2, const Polar &target1, const Polar &target2, const DrawerProperties<> &prop) = 0#
Draws a bold line between the lines origin1-origin2 and target1-target2. This is realized by drawing Bezier curves from origin1 to target1 and from origin2 to target2 and filling the so created surface.
- Parameters:
origin1 – first origin coordinate
origin2 – second origin coordinate
target1 – first target coordinate
target2 – second target coordinate
prop – DrawerProperties for the link
-
virtual void draw_connector(const Polar &from, const Polar &to, const DrawerProperties<> &prop) = 0#
Draws a connection between to given polar coordinates. The connection is a bezier curve which is controlled by automatically generated control points.
- Parameters:
from – the start Polar
to – the end Polar
prop – the DrawerProperties
-
virtual void draw_segment_axis(double inner_radius, double thickness, const Angle &begin, const Angle &end, const DrawerProperties<std::array<Color, 10>> &prop, Direction dir) = 0#
Draws a circle segment which is itself divided in colored segments.
- Parameters:
inner_radius – inner radius of the split axis
thickness – width of the split axis
begin – angle of the segments begin
end – angle of the segments end
prop – color
dir – direction of the split axis’ colors
-
virtual void draw_output_label(const Label &output_label, double radius_label, double radius_output, const Angle &begin, const Angle &end) = 0#
Draws the given Label output_label with the radius radius_label and a descriptive path that connects the output label with the associated output. The path consists of an arc segment and a line.
- Parameters:
output_label – the output label to draw
radius_label – the radius of the output label
radius_output – the radius of the associated output
begin – the angle at which the output ends
end – the angle at which the arc ends
-
virtual void draw_arrow(const Polar &start, const DrawerProperties<> &prop) = 0#
Draws a arrow head from a given start pointing.
- Parameters:
start – the start of the arrow head
prop – DrawerProperties for the arrow head
-
virtual void draw_ring_segment(double radius, double thickness, const Angle &start, const Angle &end, const DrawerProperties<> &prop, Direction dir) = 0#
Draws a filled ring segment around the center of its coordinate system between the two given Angles and with the given radius.
- Parameters:
radius – the radius
thickness – the thinkness of the edge segment
begin – the begin Angle
end – the end Angle
prop – the CairoDrawer properties
dir – the direction
-
virtual void draw_connector_segment(double start_radius, double start_angle, double end_radius, double end_angle, const DrawerProperties<> &prop) = 0#
Draws a Bezier curve from Polar(start_radius, start_angle) to Polar(end_radius, end_angle) which approximately behaves like Archimedean spiral. If the smaller difference angle between start_angle and end_angle is bigger than PI, the spiral will be approximated by two Bezier curves.
- Parameters:
start_radius – the radius of the starting point
start_angle – the angle of the starting point
end_radius – the radius of the end point
end_angle – the angle of the end point
prop – the DrawerProperties for the segment
-
virtual void draw_line(const Polar &from, const Polar &to, const DrawerProperties<> &prop) = 0#
Draws a line from a given starting vertice to a given end vertice.
- Parameters:
from – the starting coordinates
to – the end coordinates
prop – the DrawerProperties to use
-
virtual void draw_arc(double inner_radius, const Angle &start, const Angle &end, Direction dir) = 0#
Draws a simple edge segment around the center of its coordinate system between the two given Angles and with the given radius.
-
virtual void draw_coord_point(const Polar &coord, const Angle &width, double height, const DrawerProperties<> &prop) = 0#
Draws a coordinate point with given height and with.
- Parameters:
coord – the polar coordinate to draw
width – the width
height – the height
prop – the DrawerProperties
-
virtual void draw_text_parallel(const Label &label, const Polar &start, const TextAlignment &alignment = TextAlignment::CENTERED) = 0#
Draws the given label with the same angle like the given coordinate.
- Parameters:
label – the label to draw
start – the coordinate to adjust to
-
virtual void draw_text_orthogonal(const Label &label, const Polar &start, const TextAlignment &alignment = TextAlignment::CENTERED) = 0#
Draws the given label orthogonal to the angle of the given coordinate’s angle.
- Parameters:
label – the label to draw
start – the coordinate to adjust to
-
inline Polar get_connector_start(const Polar &from, const Polar &to)#
Calculates a Polar coordinate for the beginning of a connector between ‘from’ and ‘to’. If the resulting coordinate is passed to a connector drawing function, the connector does not immediately start at from.
Protected Attributes
-
CoordinateConverter m_coord_converter#
Polar-Cartesian converting
-
std::size_t m_num_inputs#
Number of input variables of the multi-objective data to draw
-
struct TextAlignment#
Text alignment representation.
TextAlignment represents the alignment of MooViE Labels. It can be used for both horizontal and vertical alignment.
Public Functions
-
TextAlignment(double ratio)#
Public Members
-
double ratio#
Public Static Attributes
-
static const TextAlignment LEFT#
-
static const TextAlignment HALF_LEFT#
-
static const TextAlignment CENTERED#
-
static const TextAlignment HALF_RIGHT#
-
static const TextAlignment RIGHT#
-
TextAlignment(double ratio)#