codac 1.5.6
|
Two-dimensional graphical item based on the VIBes viewer. More...
#include <codac_VIBesFig.h>
Public Member Functions | |
Definition and properties | |
VIBesFig (const std::string &fig_name) | |
Creates a VIBesFig. | |
~VIBesFig () | |
VIBesFig destructor. | |
void | close () |
Closes this figure. | |
void | set_properties (int x, int y, int width, int height) |
Sets the properties (coordinates and dimensions) of this figure. | |
void | set_background (const std::string &bg_color) |
Sets the background color of this figure. | |
const IntervalVector & | axis_limits (double x_min, double x_max, double y_min, double y_max, bool same_ratio=false, float margin=0.) |
Sets the axis limits of this figure. | |
const IntervalVector & | axis_limits (const IntervalVector &viewbox, bool same_ratio=false, float margin=0.) |
Sets the axis limits of this figure. | |
Saving this figure | |
void | save_image (const std::string &suffix="", const std::string &extension="svg", const std::string &path=".") const |
Saves the figure in SVG/PNG/... format. | |
Figure's content | |
void | show () |
Displays this figure. | |
void | clear () |
Clears this figure by removing displayed items. | |
Displaying objects | |
void | draw_box (const IntervalVector &box, const vibes::Params ¶ms) |
Draws a box. | |
void | draw_box (const IntervalVector &box, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a box. | |
void | draw_boxes (const std::vector< IntervalVector > &v_boxes, const vibes::Params ¶ms) |
Draws a set of boxes. | |
void | draw_boxes (const std::vector< IntervalVector > &v_boxes, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a set of boxes. | |
void | draw_line (const std::vector< double > &v_x, const std::vector< double > &v_y, const vibes::Params ¶ms) |
Draws a line of points. | |
void | draw_line (const std::vector< double > &v_x, const std::vector< double > &v_y, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a line of points. | |
void | draw_line (const std::vector< std::vector< double > > &v_pts, const vibes::Params ¶ms) |
Draws a line of points. | |
void | draw_line (const std::vector< std::vector< double > > &v_pts, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a line of points. | |
void | draw_circle (double x, double y, double r, const vibes::Params ¶ms) |
Draws a circle. | |
void | draw_circle (double x, double y, double r, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a circle. | |
void | draw_ring (double x, double y, const Interval &r, const vibes::Params ¶ms) |
Draws a ring. | |
void | draw_ring (double x, double y, const Interval &r, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a ring. | |
void | draw_pie (double x, double y, const Interval &r, const Interval &theta, const vibes::Params ¶ms) |
Draws a pie: radial portion of a ring. | |
void | draw_pie (double x, double y, const Interval &r, const Interval &theta, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a pie: radial portion of a ring. | |
void | draw_edge (const ThickEdge &e, const vibes::Params ¶ms) |
Draws an edge. | |
void | draw_edge (const ThickEdge &e, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws an edge. | |
void | draw_polygon (const Polygon &p, const vibes::Params ¶ms) |
Draws a polygon. | |
void | draw_polygon (const Polygon &p, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a polygon. | |
void | draw_polygons (const std::vector< ConvexPolygon > &v_p, const vibes::Params ¶ms) |
Draws a set of polygons. | |
void | draw_polygons (const std::vector< ConvexPolygon > &v_p, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a set of polygons. | |
void | draw_polygons (const std::vector< ConvexPolygon > &v_p, const ColorMap &color_map, const vibes::Params ¶ms=vibes::Params()) |
Draws a set of polygons. | |
void | draw_point (const ThickPoint &p, const vibes::Params ¶ms) |
Draws a point. | |
void | draw_point (const ThickPoint &p, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a point. | |
void | draw_point (const ThickPoint &p, float size, const vibes::Params ¶ms) |
Draws a point. | |
void | draw_point (const ThickPoint &p, float size, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a point. | |
void | draw_points (const std::vector< ThickPoint > &v_pts, float size, const vibes::Params ¶ms) |
Draws a set of points. | |
void | draw_points (const std::vector< ThickPoint > &v_pts, float size, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a set of points. | |
void | draw_vehicle (double x, double y, double heading, double size, const vibes::Params ¶ms) |
Draws a vehicle. | |
void | draw_vehicle (double x, double y, double heading, double size, const std::string &color="", const vibes::Params ¶ms=vibes::Params()) |
Draws a vehicle. | |
Public Member Functions inherited from codac::Figure | |
Figure (const std::string &fig_name) | |
Creates a Figure. | |
~Figure () | |
Figure destructor. | |
int | x () const |
Returns the horizontal coordinate of this figure. | |
int | y () const |
Returns the vertical coordinate of this figure. | |
int | width () const |
Returns the width of this figure. | |
int | height () const |
Returns the height of this figure. | |
const std::string | name () const |
Returns the name of this figure. | |
const IntervalVector & | view_box () const |
Returns the real values displayed by this figure. | |
void | reset_view_box () |
Reset the view box of this figure. | |
void | set_properties (int x, int y, int width, int height) |
Sets the properties (coordinates and dimensions) of this figure. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from codac::Figure | |
static double | trunc_inf (double x) |
Returns a representable value of any double variable x | |
static const Interval | trunc_inf (const Interval &x) |
Returns a representable value of any interval \([x]\). | |
static const IntervalVector | trunc_inf (const IntervalVector &x) |
Returns a representable value of any interval vector \([\mathbf{x}]\). | |
Protected Attributes inherited from codac::Figure | |
const std::string | m_name |
figure name | |
int | m_height = 300 |
figure properties | |
IntervalVector | m_view_box = IntervalVector(2, Interval::EMPTY_SET) |
view box | |
Two-dimensional graphical item based on the VIBes viewer.
codac::VIBesFig::VIBesFig | ( | const std::string & | fig_name | ) |
Creates a VIBesFig.
fig_name | a reference to the figure that will be displayed in the window's title |
void codac::VIBesFig::set_properties | ( | int | x, |
int | y, | ||
int | width, | ||
int | height ) |
Sets the properties (coordinates and dimensions) of this figure.
x | horizontal center coordinate (in pixels) |
y | vertical center coordinate (in pixels) |
width | width value (in pixels) |
height | height value (in pixels) |
void codac::VIBesFig::set_background | ( | const std::string & | bg_color | ) |
Sets the background color of this figure.
bg_color | color of the background |
const IntervalVector & codac::VIBesFig::axis_limits | ( | double | x_min, |
double | x_max, | ||
double | y_min, | ||
double | y_max, | ||
bool | same_ratio = false, | ||
float | margin = 0. ) |
Sets the axis limits of this figure.
The function updates the viewbox and applies the changes.
x_min | lower horizontal value to be displayed |
x_max | upper horizontal value to be displayed |
y_min | lower vertical value to be displayed |
y_max | upper vertical value to be displayed |
same_ratio | if true , will compute the min/max values so that the previous ratio will be preserved (false by default) |
margin | adds a custom margin to the view box (none by default, ratio of max diam) |
const IntervalVector & codac::VIBesFig::axis_limits | ( | const IntervalVector & | viewbox, |
bool | same_ratio = false, | ||
float | margin = 0. ) |
Sets the axis limits of this figure.
The function updates the viewbox and applies the changes.
viewbox | the 2d box defining lower/upper horizontal/vertical values |
same_ratio | if true , will compute the min/max values so that the previous ratio will be preserved (false by default) |
margin | adds a custom margin to the view box (none by default, ratio of max diam) |
void codac::VIBesFig::save_image | ( | const std::string & | suffix = "", |
const std::string & | extension = "svg", | ||
const std::string & | path = "." ) const |
Saves the figure in SVG/PNG/... format.
A file named {path}/{figure_name}{suffix}.{extension} will be created in the current directory.
suffix | optional part name that can be added to the figure name (none by default) |
extension | optional part to specify the type of the image ("svg" by default) |
path | optional path to a different directory ("." by default) |
void codac::VIBesFig::draw_box | ( | const IntervalVector & | box, |
const vibes::Params & | params ) |
Draws a box.
box | the 2d IntervalVector to be displayed |
params | VIBes parameters related to the box |
void codac::VIBesFig::draw_box | ( | const IntervalVector & | box, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a box.
box | the 2d IntervalVector to be displayed |
color | the optional color of the box (black by default) |
params | VIBes parameters related to the box (none by default) |
void codac::VIBesFig::draw_boxes | ( | const std::vector< IntervalVector > & | v_boxes, |
const vibes::Params & | params ) |
Draws a set of boxes.
v_boxes | vector of 2d IntervalVector to be displayed |
params | VIBes parameters related to the boxes |
void codac::VIBesFig::draw_boxes | ( | const std::vector< IntervalVector > & | v_boxes, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a set of boxes.
v_boxes | vector of 2d IntervalVector to be displayed |
color | the optional color of the boxes (black by default) |
params | VIBes parameters related to the boxes (none by default) |
void codac::VIBesFig::draw_line | ( | const std::vector< double > & | v_x, |
const std::vector< double > & | v_y, | ||
const vibes::Params & | params ) |
Draws a line of points.
v_x | vector of horizontal center coordinates |
v_y | vector of vertical center coordinates |
params | VIBes parameters related to the line |
void codac::VIBesFig::draw_line | ( | const std::vector< double > & | v_x, |
const std::vector< double > & | v_y, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a line of points.
v_x | vector of horizontal center coordinates |
v_y | vector of vertical center coordinates |
color | the optional color of the line (black by default) |
params | VIBes parameters related to the line (none by default) |
void codac::VIBesFig::draw_line | ( | const std::vector< std::vector< double > > & | v_pts, |
const vibes::Params & | params ) |
Draws a line of points.
v_pts | vector of points that are expressed as 2d std::vector of coordinates |
params | VIBes parameters related to the line |
void codac::VIBesFig::draw_line | ( | const std::vector< std::vector< double > > & | v_pts, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a line of points.
v_pts | vector of points that are expressed as 2d std::vector of coordinates |
color | the optional color of the line (black by default) |
params | VIBes parameters related to the line (none by default) |
void codac::VIBesFig::draw_circle | ( | double | x, |
double | y, | ||
double | r, | ||
const vibes::Params & | params ) |
Draws a circle.
x | horizontal center coordinate |
y | vertical center coordinate |
r | radius |
params | VIBes parameters related to the circle |
void codac::VIBesFig::draw_circle | ( | double | x, |
double | y, | ||
double | r, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a circle.
x | horizontal center coordinate |
y | vertical center coordinate |
r | radius |
color | the optional color of the circle (black by default) |
params | VIBes parameters related to the circle (none by default) |
void codac::VIBesFig::draw_ring | ( | double | x, |
double | y, | ||
const Interval & | r, | ||
const vibes::Params & | params ) |
Draws a ring.
x | horizontal center coordinate |
y | vertical center coordinate |
r | interval radius |
params | VIBes parameters related to the ring |
void codac::VIBesFig::draw_ring | ( | double | x, |
double | y, | ||
const Interval & | r, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a ring.
x | horizontal center coordinate |
y | vertical center coordinate |
r | interval radius |
color | the optional color of the ring (black by default) |
params | VIBes parameters related to the ring (none by default) |
void codac::VIBesFig::draw_pie | ( | double | x, |
double | y, | ||
const Interval & | r, | ||
const Interval & | theta, | ||
const vibes::Params & | params ) |
Draws a pie: radial portion of a ring.
x | horizontal center coordinate |
y | vertical center coordinate |
r | interval radius |
theta | interval angle (in radian) |
params | VIBes parameters related to the ring |
void codac::VIBesFig::draw_pie | ( | double | x, |
double | y, | ||
const Interval & | r, | ||
const Interval & | theta, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a pie: radial portion of a ring.
x | horizontal center coordinate |
y | vertical center coordinate |
r | interval radius |
theta | interval angle (in radian) |
color | the optional color of the ring (black by default) |
params | VIBes parameters related to the ring (none by default) |
void codac::VIBesFig::draw_edge | ( | const ThickEdge & | e, |
const vibes::Params & | params ) |
Draws an edge.
e | edge |
params | VIBes parameters related to the edge (none by default) |
void codac::VIBesFig::draw_edge | ( | const ThickEdge & | e, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws an edge.
e | edge |
color | the optional color of the edge (black by default) |
params | VIBes parameters related to the edge (none by default) |
void codac::VIBesFig::draw_polygon | ( | const Polygon & | p, |
const vibes::Params & | params ) |
Draws a polygon.
p | polygon |
params | VIBes parameters related to the polygon (none by default) |
void codac::VIBesFig::draw_polygon | ( | const Polygon & | p, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a polygon.
p | polygon |
color | the optional color of the polygon (black by default) |
params | VIBes parameters related to the polygon (none by default) |
void codac::VIBesFig::draw_polygons | ( | const std::vector< ConvexPolygon > & | v_p, |
const vibes::Params & | params ) |
Draws a set of polygons.
v_p | vector of polygons |
params | VIBes parameters related to the polygons (none by default) |
void codac::VIBesFig::draw_polygons | ( | const std::vector< ConvexPolygon > & | v_p, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a set of polygons.
v_p | vector of polygons |
color | the optional color of the polygons (black by default) |
params | VIBes parameters related to the polygons (none by default) |
void codac::VIBesFig::draw_polygons | ( | const std::vector< ConvexPolygon > & | v_p, |
const ColorMap & | color_map, | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a set of polygons.
v_p | vector of polygons |
color_map | color map to draw polygons with a map of colors |
params | VIBes parameters related to the polygons (none by default) |
void codac::VIBesFig::draw_point | ( | const ThickPoint & | p, |
const vibes::Params & | params ) |
Draws a point.
p | the 2d ThickPoint to be displayed |
params | VIBes parameters related to the point |
void codac::VIBesFig::draw_point | ( | const ThickPoint & | p, |
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a point.
p | the 2d ThickPoint to be displayed |
color | the optional color of the point (black by default) |
params | VIBes parameters related to the point (none by default) |
void codac::VIBesFig::draw_point | ( | const ThickPoint & | p, |
float | size, | ||
const vibes::Params & | params ) |
Draws a point.
p | the 2d ThickPoint to be displayed |
size | display size of the points |
params | VIBes parameters related to the point |
void codac::VIBesFig::draw_point | ( | const ThickPoint & | p, |
float | size, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a point.
p | the 2d ThickPoint to be displayed |
size | display size of the points |
color | the optional color of the point (black by default) |
params | VIBes parameters related to the point (none by default) |
void codac::VIBesFig::draw_points | ( | const std::vector< ThickPoint > & | v_pts, |
float | size, | ||
const vibes::Params & | params ) |
Draws a set of points.
v_pts | vector of ThickPoint objects |
size | display size of the points |
params | VIBes parameters related to the set (none by default) |
void codac::VIBesFig::draw_points | ( | const std::vector< ThickPoint > & | v_pts, |
float | size, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a set of points.
v_pts | vector of ThickPoint objects |
size | display size of the points |
color | the optional color of the set (black by default) |
params | VIBes parameters related to the set (none by default) |
void codac::VIBesFig::draw_vehicle | ( | double | x, |
double | y, | ||
double | heading, | ||
double | size, | ||
const vibes::Params & | params ) |
Draws a vehicle.
x | horizontal center coordinate |
y | vertical center coordinate |
heading | vehicle heading |
size | length of the vehicle |
params | VIBes parameters related to the object (none by default) |
void codac::VIBesFig::draw_vehicle | ( | double | x, |
double | y, | ||
double | heading, | ||
double | size, | ||
const std::string & | color = "", | ||
const vibes::Params & | params = vibes::Params() ) |
Draws a vehicle.
x | horizontal center coordinate |
y | vertical center coordinate |
heading | vehicle heading |
size | length of the vehicle |
color | the optional color of the set (black by default) |
params | VIBes parameters related to the object (none by default) |