codac
List of all members
codac::VIBesFig Class Reference

Two-dimensional graphical item based on the VIBes viewer. More...

#include <codac_VIBesFig.h>

Inheritance diagram for codac::VIBesFig:
Inheritance graph
[legend]
Collaboration diagram for codac::VIBesFig:
Collaboration graph
[legend]

Public Member Functions

Definition and properties
 VIBesFig (const std::string &fig_name)
 Creates a VIBesFig. More...
 
 ~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. More...
 
void set_background (const std::string &bg_color)
 Sets the background color of this figure. More...
 
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. More...
 
const IntervalVector & axis_limits (const IntervalVector &viewbox, bool same_ratio=false, float margin=0.)
 Sets the axis limits of this figure. More...
 
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. More...
 
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 &params)
 Draws a box. More...
 
void draw_box (const IntervalVector &box, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a box. More...
 
void draw_boxes (const std::vector< IntervalVector > &v_boxes, const vibes::Params &params)
 Draws a set of boxes. More...
 
void draw_boxes (const std::vector< IntervalVector > &v_boxes, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a set of boxes. More...
 
void draw_line (const std::vector< double > &v_x, const std::vector< double > &v_y, const vibes::Params &params)
 Draws a line of points. More...
 
void 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. More...
 
void draw_line (const std::vector< std::vector< double > > &v_pts, const vibes::Params &params)
 Draws a line of points. More...
 
void 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. More...
 
void draw_circle (double x, double y, double r, const vibes::Params &params)
 Draws a circle. More...
 
void draw_circle (double x, double y, double r, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a circle. More...
 
void draw_ring (double x, double y, const Interval &r, const vibes::Params &params)
 Draws a ring. More...
 
void draw_ring (double x, double y, const Interval &r, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a ring. More...
 
void draw_pie (double x, double y, const Interval &r, const Interval &theta, const vibes::Params &params)
 Draws a pie: radial portion of a ring. More...
 
void 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. More...
 
void draw_edge (const ThickEdge &e, const vibes::Params &params)
 Draws an edge. More...
 
void draw_edge (const ThickEdge &e, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws an edge. More...
 
void draw_polygon (const Polygon &p, const vibes::Params &params)
 Draws a polygon. More...
 
void draw_polygon (const Polygon &p, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a polygon. More...
 
void draw_polygons (const std::vector< ConvexPolygon > &v_p, const vibes::Params &params)
 Draws a set of polygons. More...
 
void draw_polygons (const std::vector< ConvexPolygon > &v_p, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a set of polygons. More...
 
void draw_polygons (const std::vector< ConvexPolygon > &v_p, const ColorMap &color_map, const vibes::Params &params=vibes::Params())
 Draws a set of polygons. More...
 
void draw_polygon_tube (const codac2::Tube< ConvexPolygon > &x, const ColorMap &color_map, const vibes::Params &params=vibes::Params())
 
void draw_point (const ThickPoint &p, const vibes::Params &params)
 Draws a point. More...
 
void draw_point (const ThickPoint &p, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a point. More...
 
void draw_point (const ThickPoint &p, float size, const vibes::Params &params)
 Draws a point. More...
 
void draw_point (const ThickPoint &p, float size, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a point. More...
 
void draw_points (const std::vector< ThickPoint > &v_pts, float size, const vibes::Params &params)
 Draws a set of points. More...
 
void 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. More...
 
void draw_vehicle (double x, double y, double heading, double size, const vibes::Params &params)
 Draws a vehicle. More...
 
void draw_vehicle (double x, double y, double heading, double size, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a vehicle. More...
 
- Public Member Functions inherited from codac::Figure
 Figure (const std::string &fig_name)
 Creates a Figure. More...
 
 ~Figure ()
 Figure destructor.
 
int x () const
 Returns the horizontal coordinate of this figure. More...
 
int y () const
 Returns the vertical coordinate of this figure. More...
 
int width () const
 Returns the width of this figure. More...
 
int height () const
 Returns the height of this figure. More...
 
const std::string name () const
 Returns the name of this figure. More...
 
const IntervalVector & view_box () const
 Returns the real values displayed by this figure. More...
 
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. More...
 

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 More...
 
static const Interval trunc_inf (const Interval &x)
 Returns a representable value of any interval \([x]\). More...
 
static const IntervalVector trunc_inf (const IntervalVector &x)
 Returns a representable value of any interval vector \([\mathbf{x}]\). More...
 
- 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
 

Detailed Description

Two-dimensional graphical item based on the VIBes viewer.

Constructor & Destructor Documentation

◆ VIBesFig()

codac::VIBesFig::VIBesFig ( const std::string &  fig_name)

Creates a VIBesFig.

Parameters
fig_namea reference to the figure that will be displayed in the window's title

Member Function Documentation

◆ set_properties()

void codac::VIBesFig::set_properties ( int  x,
int  y,
int  width,
int  height 
)

Sets the properties (coordinates and dimensions) of this figure.

Parameters
xhorizontal center coordinate (in pixels)
yvertical center coordinate (in pixels)
widthwidth value (in pixels)
heightheight value (in pixels)

◆ set_background()

void codac::VIBesFig::set_background ( const std::string &  bg_color)

Sets the background color of this figure.

Parameters
bg_colorcolor of the background

◆ axis_limits() [1/2]

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.

Parameters
x_minlower horizontal value to be displayed
x_maxupper horizontal value to be displayed
y_minlower vertical value to be displayed
y_maxupper vertical value to be displayed
same_ratioif true, will compute the min/max values so that the previous ratio will be preserved (false by default)
marginadds a custom margin to the view box (none by default, ratio of max diam)
Returns
the updated view box of this figure

◆ axis_limits() [2/2]

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.

Parameters
viewboxthe 2d box defining lower/upper horizontal/vertical values
same_ratioif true, will compute the min/max values so that the previous ratio will be preserved (false by default)
marginadds a custom margin to the view box (none by default, ratio of max diam)
Returns
the updated view box of this figure

◆ save_image()

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.

Parameters
suffixoptional part name that can be added to the figure name (none by default)
extensionoptional part to specify the type of the image ("svg" by default)
pathoptional path to a different directory ("." by default)

◆ draw_box() [1/2]

void codac::VIBesFig::draw_box ( const IntervalVector &  box,
const vibes::Params &  params 
)

Draws a box.

Parameters
boxthe 2d IntervalVector to be displayed
paramsVIBes parameters related to the box

◆ draw_box() [2/2]

void codac::VIBesFig::draw_box ( const IntervalVector &  box,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws a box.

Parameters
boxthe 2d IntervalVector to be displayed
colorthe optional color of the box (black by default)
paramsVIBes parameters related to the box (none by default)

◆ draw_boxes() [1/2]

void codac::VIBesFig::draw_boxes ( const std::vector< IntervalVector > &  v_boxes,
const vibes::Params &  params 
)

Draws a set of boxes.

Parameters
v_boxesvector of 2d IntervalVector to be displayed
paramsVIBes parameters related to the boxes

◆ draw_boxes() [2/2]

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.

Parameters
v_boxesvector of 2d IntervalVector to be displayed
colorthe optional color of the boxes (black by default)
paramsVIBes parameters related to the boxes (none by default)

◆ draw_line() [1/4]

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.

Parameters
v_xvector of horizontal center coordinates
v_yvector of vertical center coordinates
paramsVIBes parameters related to the line

◆ draw_line() [2/4]

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.

Parameters
v_xvector of horizontal center coordinates
v_yvector of vertical center coordinates
colorthe optional color of the line (black by default)
paramsVIBes parameters related to the line (none by default)

◆ draw_line() [3/4]

void codac::VIBesFig::draw_line ( const std::vector< std::vector< double > > &  v_pts,
const vibes::Params &  params 
)

Draws a line of points.

Parameters
v_ptsvector of points that are expressed as 2d std::vector of coordinates
paramsVIBes parameters related to the line

◆ draw_line() [4/4]

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.

Parameters
v_ptsvector of points that are expressed as 2d std::vector of coordinates
colorthe optional color of the line (black by default)
paramsVIBes parameters related to the line (none by default)

◆ draw_circle() [1/2]

void codac::VIBesFig::draw_circle ( double  x,
double  y,
double  r,
const vibes::Params &  params 
)

Draws a circle.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rradius
paramsVIBes parameters related to the circle

◆ draw_circle() [2/2]

void codac::VIBesFig::draw_circle ( double  x,
double  y,
double  r,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws a circle.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rradius
colorthe optional color of the circle (black by default)
paramsVIBes parameters related to the circle (none by default)

◆ draw_ring() [1/2]

void codac::VIBesFig::draw_ring ( double  x,
double  y,
const Interval &  r,
const vibes::Params &  params 
)

Draws a ring.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rinterval radius
paramsVIBes parameters related to the ring

◆ draw_ring() [2/2]

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.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rinterval radius
colorthe optional color of the ring (black by default)
paramsVIBes parameters related to the ring (none by default)

◆ draw_pie() [1/2]

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.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rinterval radius
thetainterval angle (in radian)
paramsVIBes parameters related to the ring

◆ draw_pie() [2/2]

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.

Parameters
xhorizontal center coordinate
yvertical center coordinate
rinterval radius
thetainterval angle (in radian)
colorthe optional color of the ring (black by default)
paramsVIBes parameters related to the ring (none by default)

◆ draw_edge() [1/2]

void codac::VIBesFig::draw_edge ( const ThickEdge &  e,
const vibes::Params &  params 
)

Draws an edge.

Parameters
eedge
paramsVIBes parameters related to the edge (none by default)

◆ draw_edge() [2/2]

void codac::VIBesFig::draw_edge ( const ThickEdge &  e,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws an edge.

Parameters
eedge
colorthe optional color of the edge (black by default)
paramsVIBes parameters related to the edge (none by default)

◆ draw_polygon() [1/2]

void codac::VIBesFig::draw_polygon ( const Polygon &  p,
const vibes::Params &  params 
)

Draws a polygon.

Parameters
ppolygon
paramsVIBes parameters related to the polygon (none by default)

◆ draw_polygon() [2/2]

void codac::VIBesFig::draw_polygon ( const Polygon &  p,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws a polygon.

Parameters
ppolygon
colorthe optional color of the polygon (black by default)
paramsVIBes parameters related to the polygon (none by default)

◆ draw_polygons() [1/3]

void codac::VIBesFig::draw_polygons ( const std::vector< ConvexPolygon > &  v_p,
const vibes::Params &  params 
)

Draws a set of polygons.

Parameters
v_pvector of polygons
paramsVIBes parameters related to the polygons (none by default)

◆ draw_polygons() [2/3]

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.

Parameters
v_pvector of polygons
colorthe optional color of the polygons (black by default)
paramsVIBes parameters related to the polygons (none by default)

◆ draw_polygons() [3/3]

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.

Parameters
v_pvector of polygons
color_mapcolor map to draw polygons with a map of colors
paramsVIBes parameters related to the polygons (none by default)

◆ draw_point() [1/4]

void codac::VIBesFig::draw_point ( const ThickPoint &  p,
const vibes::Params &  params 
)

Draws a point.

Parameters
pthe 2d ThickPoint to be displayed
paramsVIBes parameters related to the point

◆ draw_point() [2/4]

void codac::VIBesFig::draw_point ( const ThickPoint &  p,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws a point.

Parameters
pthe 2d ThickPoint to be displayed
colorthe optional color of the point (black by default)
paramsVIBes parameters related to the point (none by default)

◆ draw_point() [3/4]

void codac::VIBesFig::draw_point ( const ThickPoint &  p,
float  size,
const vibes::Params &  params 
)

Draws a point.

Parameters
pthe 2d ThickPoint to be displayed
sizedisplay size of the points
paramsVIBes parameters related to the point

◆ draw_point() [4/4]

void codac::VIBesFig::draw_point ( const ThickPoint &  p,
float  size,
const std::string &  color = "",
const vibes::Params &  params = vibes::Params() 
)

Draws a point.

Parameters
pthe 2d ThickPoint to be displayed
sizedisplay size of the points
colorthe optional color of the point (black by default)
paramsVIBes parameters related to the point (none by default)

◆ draw_points() [1/2]

void codac::VIBesFig::draw_points ( const std::vector< ThickPoint > &  v_pts,
float  size,
const vibes::Params &  params 
)

Draws a set of points.

Parameters
v_ptsvector of ThickPoint objects
sizedisplay size of the points
paramsVIBes parameters related to the set (none by default)

◆ draw_points() [2/2]

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.

Parameters
v_ptsvector of ThickPoint objects
sizedisplay size of the points
colorthe optional color of the set (black by default)
paramsVIBes parameters related to the set (none by default)

◆ draw_vehicle() [1/2]

void codac::VIBesFig::draw_vehicle ( double  x,
double  y,
double  heading,
double  size,
const vibes::Params &  params 
)

Draws a vehicle.

Parameters
xhorizontal center coordinate
yvertical center coordinate
headingvehicle heading
sizelength of the vehicle
paramsVIBes parameters related to the object (none by default)

◆ draw_vehicle() [2/2]

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.

Parameters
xhorizontal center coordinate
yvertical center coordinate
headingvehicle heading
sizelength of the vehicle
colorthe optional color of the set (black by default)
paramsVIBes parameters related to the object (none by default)

The documentation for this class was generated from the following file: