codac
Classes | Protected Member Functions | Protected Attributes | List of all members
codac::VIBesFigTube Class Reference

Two-dimensional graphical item to display scalar tubes or trajectories. More...

#include <codac_VIBesFigTube.h>

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

Classes

struct  FigTrajParams
 Specifies some parameters related to a Trajectory display. More...
 
struct  FigTubeParams
 Specifies some parameters related to a Tube display. More...
 

Public Member Functions

Basics
 VIBesFigTube (const std::string &fig_name, const Tube *tube=NULL, const Trajectory *traj=NULL)
 Creates a VIBesFigTube. More...
 
 ~VIBesFigTube ()
 VIBesFigTube destructor.
 
void show ()
 Displays this figure.
 
void show (bool detail_slices)
 Displays this figure with optional details. More...
 
void set_cursor (double t)
 Set the position of the temporal cursor of this figure. More...
 
void show_cursor (bool display=true)
 Displays the cursor on this figure. More...
 
Handling tubes
void add_tube (const Tube *tube, const std::string &name, const std::string &color_frgrnd=DEFAULT_FRGRND_COLOR, const std::string &color_bckgrnd=DEFAULT_BCKGRND_COLOR)
 Adds a tube object to this figure. More...
 
void add_tubes (const TubeVector *tubevector, const std::string &name, const std::string &color_frgrnd=DEFAULT_FRGRND_COLOR, const std::string &color_bckgrnd=DEFAULT_BCKGRND_COLOR)
 Adds a subset of a vector of tubes to this figure. More...
 
void add_tubes (const TubeVector *tubevector, int start_index, int end_index, const std::string &name, const std::string &color_frgrnd=DEFAULT_FRGRND_COLOR, const std::string &color_bckgrnd=DEFAULT_BCKGRND_COLOR)
 Adds a subset of a vector of tubes to this figure. More...
 
void set_tube_name (const Tube *tube, const std::string &name)
 Sets a new name for a tube. More...
 
void set_tube_derivative (const Tube *tube, const Tube *derivative)
 Links a tube to its derivative for display purposes. More...
 
void set_tube_color (const Tube *tube, const std::string &color_frgrnd, const std::string &color_bckgrnd=DEFAULT_BCKGRND_COLOR)
 Sets color properties for a given tube. More...
 
void set_tube_color (const Tube *tube, TubeColorType color_type, const std::string &color)
 Sets color properties for a given tube. More...
 
void reset_tube_background (const Tube *tube)
 Reset the background of a given tube. More...
 
void remove_tube (const Tube *tube)
 Removes a tube from this figure. More...
 
Handling trajectories
void add_trajectory (const Trajectory *traj, const std::string &name, const std::string &color=DEFAULT_TRAJ_COLOR)
 Adds a trajectory object to this figure. More...
 
void add_trajectories (const TrajectoryVector *trajvector, const std::string &name, const std::string &color=DEFAULT_TRAJ_COLOR)
 Adds a vector of trajectories to this figure. More...
 
void add_trajectories (const TrajectoryVector *trajvector, int start_index, int end_index, const std::string &name, const std::string &color=DEFAULT_TRAJ_COLOR)
 Adds a subset of a vector of trajectories to this figure. More...
 
void set_trajectory_name (const Trajectory *traj, const std::string &name)
 Sets a new name for a trajectory. More...
 
void set_trajectory_color (const Trajectory *traj, const std::string &color)
 Sets color properties for a given trajectory. More...
 
void set_trajectory_points_size (const Trajectory *traj, float points_size)
 Sets points size for a given trajectory, and activates a display mode with points instead of a line for this trajectory. More...
 
void remove_trajectory (const Trajectory *traj)
 Removes a trajectory from this figure. More...
 
- Public Member Functions inherited from codac::VIBesFig
 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...
 
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...
 
void show ()
 Displays this figure.
 
void clear ()
 Clears this figure by removing displayed items.
 
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 Edge &e, const vibes::Params &params)
 Draws an edge. More...
 
void draw_edge (const Edge &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_point (const Point &p, const vibes::Params &params)
 Draws a point. More...
 
void draw_point (const Point &p, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a point. More...
 
void draw_point (const Point &p, float size, const vibes::Params &params)
 Draws a point. More...
 
void draw_point (const Point &p, float size, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a point. More...
 
void draw_points (const std::vector< Point > &v_pts, float size, const vibes::Params &params)
 Draws a set of points. More...
 
void draw_points (const std::vector< Point > &v_pts, float size, const std::string &color="", const vibes::Params &params=vibes::Params())
 Draws a set of points. 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...
 

Protected Member Functions

void create_group_color (const Tube *tube, TubeColorType color_type)
 Creates the VIBes group of color_type related to the given tube. More...
 
void create_groups_color (const Tube *tube)
 Creates all the VIBes groups related to the given tube. More...
 
const IntervalVector draw_tube (const Tube *tube, bool detail_slices=false)
 Draws a tube. More...
 
void draw_slice (const Slice &slice, const vibes::Params &params)
 Draws a slice. More...
 
void draw_slice (const Slice &slice, const Slice &deriv_slice, const vibes::Params &params_slice, const vibes::Params &params_polygon)
 Draws a slice knowing its derivative. More...
 
void draw_gate (const Interval &gate, double t, const vibes::Params &params)
 Draws a gate. More...
 
const IntervalVector draw_trajectory (const Trajectory *traj)
 Draws a trajectory. More...
 

Protected Attributes

std::map< const Tube *, FigTubeParamsm_map_tubes
 map of Tube objects to be displayed, together with parameters
 
std::map< const Trajectory *, FigTrajParamsm_map_trajs
 map of Trajectory objects to be displayed, together with parameters
 
bool m_display_cursor = false
 boolean to display a temporal cursor
 
double m_cursor
 the temporal cursor's position
 
- 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
 

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...
 

Detailed Description

Two-dimensional graphical item to display scalar tubes or trajectories.

One figure is linked to some tube or trajectory pointers, so that any update on these objects can be easily displayed on the figure.

Constructor & Destructor Documentation

◆ VIBesFigTube()

codac::VIBesFigTube::VIBesFigTube ( const std::string &  fig_name,
const Tube tube = NULL,
const Trajectory traj = NULL 
)

Creates a VIBesFigTube.

Parameters
fig_namename of the figure as displayed in the window title
tubean optional const pointer to the tube to be displayed (NULL by default)
trajan optional const pointer to a trajectory to be displayed (NULL by default)

Member Function Documentation

◆ show()

void codac::VIBesFigTube::show ( bool  detail_slices)

Displays this figure with optional details.

Parameters
detail_slicesif true, each slice will be displayed as a box, otherwise, only polygon envelopes of the tubes will be shown (fast display)

◆ set_cursor()

void codac::VIBesFigTube::set_cursor ( double  t)

Set the position of the temporal cursor of this figure.

Parameters
tposition on the tdomain

◆ show_cursor()

void codac::VIBesFigTube::show_cursor ( bool  display = true)

Displays the cursor on this figure.

Parameters
displayparameter (true by default)

◆ add_tube()

void codac::VIBesFigTube::add_tube ( const Tube tube,
const std::string &  name,
const std::string &  color_frgrnd = DEFAULT_FRGRND_COLOR,
const std::string &  color_bckgrnd = DEFAULT_BCKGRND_COLOR 
)

Adds a tube object to this figure.

Parameters
tubea const pointer to a Tube object to be displayed
namea name to identify this object
color_frgrndan optional color for the current values of the tube
color_bckgrndan optional color for the previous values of the tube, before any new contraction

◆ add_tubes() [1/2]

void codac::VIBesFigTube::add_tubes ( const TubeVector tubevector,
const std::string &  name,
const std::string &  color_frgrnd = DEFAULT_FRGRND_COLOR,
const std::string &  color_bckgrnd = DEFAULT_BCKGRND_COLOR 
)

Adds a subset of a vector of tubes to this figure.

Each selected component will be projected on the same figure.

Parameters
tubevectora const pointer to a TubeVector object to be displayed
namea name to identify this set of tubes
color_frgrndan optional color for the current values of the tubes
color_bckgrndan optional color for the previous values of the tubes, before any new contraction

◆ add_tubes() [2/2]

void codac::VIBesFigTube::add_tubes ( const TubeVector tubevector,
int  start_index,
int  end_index,
const std::string &  name,
const std::string &  color_frgrnd = DEFAULT_FRGRND_COLOR,
const std::string &  color_bckgrnd = DEFAULT_BCKGRND_COLOR 
)

Adds a subset of a vector of tubes to this figure.

Each selected component will be projected on the same figure.

Parameters
tubevectora const pointer to a TubeVector object to be displayed
start_indexthe first dimension to be displayed
end_indexthe last dimension to be displayed
namea name to identify this set of tubes
color_frgrndan optional color for the current values of the tubes
color_bckgrndan optional color for the previous values of the tubes, before any new contraction

◆ set_tube_name()

void codac::VIBesFigTube::set_tube_name ( const Tube tube,
const std::string &  name 
)

Sets a new name for a tube.

Parameters
tubethe const pointer to the Tube object to be renamed
namea new name to identify this object

◆ set_tube_derivative()

void codac::VIBesFigTube::set_tube_derivative ( const Tube tube,
const Tube derivative 
)

Links a tube to its derivative for display purposes.

When available, a derivative tube \([\dot{x}](\cdot)\) allows to draw slices of \([x](\cdot)\) as polygons, thus displaying a thinner envelope of the tube \([x](\cdot)\).

Parameters
tubethe const pointer to the Tube object that will be displayed
derivativethe const pointer its derivative set

◆ set_tube_color() [1/2]

void codac::VIBesFigTube::set_tube_color ( const Tube tube,
const std::string &  color_frgrnd,
const std::string &  color_bckgrnd = DEFAULT_BCKGRND_COLOR 
)

Sets color properties for a given tube.

Parameters
tubethe const pointer to the Tube object for which the colors will be set
color_frgrnda color for the current values of the tube
color_bckgrnda color for the previous values of the tube, before any new contraction (gray by default)

◆ set_tube_color() [2/2]

void codac::VIBesFigTube::set_tube_color ( const Tube tube,
TubeColorType  color_type,
const std::string &  color 
)

Sets color properties for a given tube.

This method allows to change the display of slices, borders, gates, etc.

Parameters
tubethe const pointer to the Tube object for which the colors will be set
color_typethe TubeColorType key for which the value will be set
colorthe new color to be specified for the given type

◆ reset_tube_background()

void codac::VIBesFigTube::reset_tube_background ( const Tube tube)

Reset the background of a given tube.

Todo:
automatically clear the figure (for now, the pointer is only deleted)
Parameters
tubethe const pointer to the Tube object for which the background will be deleted

◆ remove_tube()

void codac::VIBesFigTube::remove_tube ( const Tube tube)

Removes a tube from this figure.

Todo:
automatically clear the figure (for now, the tube is only removed from the list of objects to be shown afterwards)
Note
the object will not be deleted
Parameters
tubethe const pointer to the Tube object to be removed

◆ add_trajectory()

void codac::VIBesFigTube::add_trajectory ( const Trajectory traj,
const std::string &  name,
const std::string &  color = DEFAULT_TRAJ_COLOR 
)

Adds a trajectory object to this figure.

Parameters
traja const pointer to a Trajectory object to be displayed
namea name to identify this object
coloran optional color to draw this trajectory

◆ add_trajectories() [1/2]

void codac::VIBesFigTube::add_trajectories ( const TrajectoryVector trajvector,
const std::string &  name,
const std::string &  color = DEFAULT_TRAJ_COLOR 
)

Adds a vector of trajectories to this figure.

Each component will be projected on the same figure.

Parameters
trajvectora const pointer to a TrajectoryVector object to be displayed
namea name to identify this set of trajectories
coloran optional color to draw these trajectories

◆ add_trajectories() [2/2]

void codac::VIBesFigTube::add_trajectories ( const TrajectoryVector trajvector,
int  start_index,
int  end_index,
const std::string &  name,
const std::string &  color = DEFAULT_TRAJ_COLOR 
)

Adds a subset of a vector of trajectories to this figure.

Each selected component will be projected on the same figure.

Parameters
trajvectora const pointer to a TrajectoryVector object to be displayed
start_indexthe first dimension to be displayed
end_indexthe last dimension to be displayed
namea name to identify this set of trajectories
coloran optional color to draw these trajectories

◆ set_trajectory_name()

void codac::VIBesFigTube::set_trajectory_name ( const Trajectory traj,
const std::string &  name 
)

Sets a new name for a trajectory.

Parameters
trajthe const pointer to the Trajectory object to be renamed
namea new name to identify this object

◆ set_trajectory_color()

void codac::VIBesFigTube::set_trajectory_color ( const Trajectory traj,
const std::string &  color 
)

Sets color properties for a given trajectory.

Parameters
trajthe const pointer to the Trajectory object for which the color will be set
colora color to draw this trajectory

◆ set_trajectory_points_size()

void codac::VIBesFigTube::set_trajectory_points_size ( const Trajectory traj,
float  points_size 
)

Sets points size for a given trajectory, and activates a display mode with points instead of a line for this trajectory.

Parameters
trajthe const pointer to the Trajectory object for which the points size will be set
points_sizesize of the points (if 0, the display is done with a line)

◆ remove_trajectory()

void codac::VIBesFigTube::remove_trajectory ( const Trajectory traj)

Removes a trajectory from this figure.

Todo:
automatically clear the figure (for now, the trajectory is only removed from the list of objects to be shown afterwards)
Note
the object will not be deleted
Parameters
trajthe const pointer to the Trajectory object to be removed

◆ create_group_color()

void codac::VIBesFigTube::create_group_color ( const Tube tube,
TubeColorType  color_type 
)
protected

Creates the VIBes group of color_type related to the given tube.

Parameters
tubethe const pointer to the Tube object for which a group will be created
color_typethe TubeColorType key related to the new group

◆ create_groups_color()

void codac::VIBesFigTube::create_groups_color ( const Tube tube)
protected

Creates all the VIBes groups related to the given tube.

Parameters
tubethe const pointer to the Tube object for which the groups will be created

◆ draw_tube()

const IntervalVector codac::VIBesFigTube::draw_tube ( const Tube tube,
bool  detail_slices = false 
)
protected

Draws a tube.

Parameters
tubea const pointer to a Tube object to be shown
detail_slicesif true, each slice will be displayed as a box, otherwise, only polygon envelopes of the tubes will be shown (fast display)
Returns
the box hull of the displayed object

◆ draw_slice() [1/2]

void codac::VIBesFigTube::draw_slice ( const Slice slice,
const vibes::Params &  params 
)
protected

Draws a slice.

Parameters
slicethe slice to be displayed
paramsVIBes parameters related to the slice (for groups)

◆ draw_slice() [2/2]

void codac::VIBesFigTube::draw_slice ( const Slice slice,
const Slice deriv_slice,
const vibes::Params &  params_slice,
const vibes::Params &  params_polygon 
)
protected

Draws a slice knowing its derivative.

Parameters
slicethe slice to be displayed
deriv_sliceits derivative set
params_sliceVIBes parameters related to the slice (for groups)
params_polygonVIBes parameters related to the polygon computed from the derivative

◆ draw_gate()

void codac::VIBesFigTube::draw_gate ( const Interval &  gate,
double  t,
const vibes::Params &  params 
)
protected

Draws a gate.

Parameters
gatethe codomain
tthe tdomain input
paramsVIBes parameters related to the gate (for groups)

◆ draw_trajectory()

const IntervalVector codac::VIBesFigTube::draw_trajectory ( const Trajectory traj)
protected

Draws a trajectory.

Parameters
trajthe const pointer to the Trajectory object to be shown
Returns
the box hull of the displayed object

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