codac 1.5.6
|
Two-dimensional graphical item to display scalar tubes or trajectories. More...
#include <codac_VIBesFigTube.h>
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=nullptr, const Trajectory *traj=nullptr) | |
Creates a VIBesFigTube. | |
~VIBesFigTube () | |
VIBesFigTube destructor. | |
void | show () |
Displays this figure. | |
void | show (bool detail_slices) |
Displays this figure with optional details. | |
void | set_cursor (double t) |
Set the position of the temporal cursor of this figure. | |
void | show_cursor (bool display=true) |
Displays the cursor on this figure. | |
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. | |
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. | |
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. | |
void | set_tube_name (const Tube *tube, const std::string &name) |
Sets a new name for a tube. | |
void | set_tube_derivative (const Tube *tube, const Tube *derivative) |
Links a tube to its derivative for display purposes. | |
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. | |
void | set_tube_color (const Tube *tube, TubeColorType color_type, const std::string &color) |
Sets color properties for a given tube. | |
void | reset_tube_background (const Tube *tube) |
Reset the background of a given tube. | |
void | remove_tube (const Tube *tube) |
Removes a tube from this figure. | |
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. | |
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. | |
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. | |
void | set_trajectory_name (const Trajectory *traj, const std::string &name) |
Sets a new name for a trajectory. | |
void | set_trajectory_color (const Trajectory *traj, const std::string &color) |
Sets color properties for a given trajectory. | |
void | set_trajectory_points_size (const Trajectory *traj, double points_size) |
Sets points size for a given trajectory, and activates a display mode with points instead of a line for this trajectory. | |
void | remove_trajectory (const Trajectory *traj) |
Removes a trajectory from this figure. | |
Public Member Functions inherited from codac::VIBesFig | |
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. | |
void | save_image (const std::string &suffix="", const std::string &extension="svg", const std::string &path=".") const |
Saves the figure in SVG/PNG/... format. | |
void | show () |
Displays this figure. | |
void | clear () |
Clears this figure by removing displayed items. | |
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. | |
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. | |
void | create_groups_color (const Tube *tube) |
Creates all the VIBes groups related to the given tube. | |
const IntervalVector | draw_tube (const Tube *tube, bool detail_slices=false) |
Draws a tube. | |
void | draw_slice (const Slice &slice, const vibes::Params ¶ms) |
Draws a slice. | |
void | draw_slice (const Slice &slice, const Slice &deriv_slice, const vibes::Params ¶ms_slice, const vibes::Params ¶ms_polygon) |
Draws a slice knowing its derivative. | |
void | draw_gate (const Interval &gate, double t, const vibes::Params ¶ms) |
Draws a gate. | |
const IntervalVector | draw_trajectory (const Trajectory *traj) |
Draws a trajectory. | |
Protected Attributes | |
std::map< const Tube *, FigTubeParams > | m_map_tubes |
map of Tube objects to be displayed, together with parameters | |
std::map< const Trajectory *, FigTrajParams > | m_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 | |
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}]\). | |
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.
codac::VIBesFigTube::VIBesFigTube | ( | const std::string & | fig_name, |
const Tube * | tube = nullptr, | ||
const Trajectory * | traj = nullptr ) |
Creates a VIBesFigTube.
fig_name | name of the figure as displayed in the window title |
tube | an optional const pointer to the tube to be displayed (nullptr by default) |
traj | an optional const pointer to a trajectory to be displayed (nullptr by default) |
void codac::VIBesFigTube::show | ( | bool | detail_slices | ) |
Displays this figure with optional details.
detail_slices | if true , each slice will be displayed as a box, otherwise, only polygon envelopes of the tubes will be shown (fast display) |
void codac::VIBesFigTube::set_cursor | ( | double | t | ) |
Set the position of the temporal cursor of this figure.
t | position on the tdomain |
void codac::VIBesFigTube::show_cursor | ( | bool | display = true | ) |
Displays the cursor on this figure.
display | parameter (true by default) |
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.
tube | a const pointer to a Tube object to be displayed |
name | a name to identify this object |
color_frgrnd | an optional color for the current values of the tube |
color_bckgrnd | an optional color for the previous values of the tube, before any new contraction |
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.
tubevector | a const pointer to a TubeVector object to be displayed |
name | a name to identify this set of tubes |
color_frgrnd | an optional color for the current values of the tubes |
color_bckgrnd | an optional color for the previous values of the tubes, before any new contraction |
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.
tubevector | a const pointer to a TubeVector object to be displayed |
start_index | the first dimension to be displayed |
end_index | the last dimension to be displayed |
name | a name to identify this set of tubes |
color_frgrnd | an optional color for the current values of the tubes |
color_bckgrnd | an optional color for the previous values of the tubes, before any new contraction |
void codac::VIBesFigTube::set_tube_name | ( | const Tube * | tube, |
const std::string & | name ) |
Sets a new name for a tube.
tube | the const pointer to the Tube object to be renamed |
name | a new name to identify this object |
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)\).
tube | the const pointer to the Tube object that will be displayed |
derivative | the const pointer its derivative set |
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.
tube | the const pointer to the Tube object for which the colors will be set |
color_frgrnd | a color for the current values of the tube |
color_bckgrnd | a color for the previous values of the tube, before any new contraction (gray by default) |
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.
tube | the const pointer to the Tube object for which the colors will be set |
color_type | the TubeColorType key for which the value will be set |
color | the new color to be specified for the given type |
void codac::VIBesFigTube::reset_tube_background | ( | const Tube * | tube | ) |
void codac::VIBesFigTube::remove_tube | ( | const Tube * | tube | ) |
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.
traj | a const pointer to a Trajectory object to be displayed |
name | a name to identify this object |
color | an optional color to draw this trajectory |
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.
trajvector | a const pointer to a TrajectoryVector object to be displayed |
name | a name to identify this set of trajectories |
color | an optional color to draw these trajectories |
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.
trajvector | a const pointer to a TrajectoryVector object to be displayed |
start_index | the first dimension to be displayed |
end_index | the last dimension to be displayed |
name | a name to identify this set of trajectories |
color | an optional color to draw these trajectories |
void codac::VIBesFigTube::set_trajectory_name | ( | const Trajectory * | traj, |
const std::string & | name ) |
Sets a new name for a trajectory.
traj | the const pointer to the Trajectory object to be renamed |
name | a new name to identify this object |
void codac::VIBesFigTube::set_trajectory_color | ( | const Trajectory * | traj, |
const std::string & | color ) |
Sets color properties for a given trajectory.
traj | the const pointer to the Trajectory object for which the color will be set |
color | a color to draw this trajectory |
void codac::VIBesFigTube::set_trajectory_points_size | ( | const Trajectory * | traj, |
double | points_size ) |
Sets points size for a given trajectory, and activates a display mode with points instead of a line for this trajectory.
traj | the const pointer to the Trajectory object for which the points size will be set |
points_size | size of the points (if 0, the display is done with a line) |
void codac::VIBesFigTube::remove_trajectory | ( | const Trajectory * | traj | ) |
Removes a trajectory from this figure.
traj | the const pointer to the Trajectory object to be removed |
|
protected |
Creates the VIBes group of color_type
related to the given tube.
tube | the const pointer to the Tube object for which a group will be created |
color_type | the TubeColorType key related to the new group |
|
protected |
Creates all the VIBes groups related to the given tube.
tube | the const pointer to the Tube object for which the groups will be created |
|
protected |
Draws a tube.
tube | a const pointer to a Tube object to be shown |
detail_slices | if true , each slice will be displayed as a box, otherwise, only polygon envelopes of the tubes will be shown (fast display) |
|
protected |
Draws a slice.
slice | the slice to be displayed |
params | VIBes parameters related to the slice (for groups) |
|
protected |
Draws a slice knowing its derivative.
slice | the slice to be displayed |
deriv_slice | its derivative set |
params_slice | VIBes parameters related to the slice (for groups) |
params_polygon | VIBes parameters related to the polygon computed from the derivative |
|
protected |
Draws a gate.
gate | the codomain |
t | the tdomain input |
params | VIBes parameters related to the gate (for groups) |
|
protected |
Draws a trajectory.
traj | the const pointer to the Trajectory object to be shown |