codac  1.5.7
codac_VIBesFigTube.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC_VIBESFIGTUBE_H__
13 #define __CODAC_VIBESFIGTUBE_H__
14 
15 #include "codac_VIBesFig.h"
16 #include "codac_Tube.h"
17 #include "codac_Slice.h"
18 #include "codac_Trajectory.h"
19 
20 namespace codac
21 {
22  #define DEFAULT_TUBE_NAME "[?](·)"
23  #define DEFAULT_TRAJ_NAME "?(·)"
24  #define TRAJ_NB_DISPLAYED_POINTS 10000
25 
26  // HTML color codes:
27  #define DEFAULT_TRAJ_COLOR "#004257"
28  #define DEFAULT_FRGRND_COLOR "#a2a2a2[#a2a2a2]"
29  #define DEFAULT_BCKGRND_COLOR "#d2d2d2[#d2d2d2]"
30  #define DEFAULT_SLICES_COLOR "#828282[#F0F0F0]"
31  #define DEFAULT_GATES_COLOR "#0084AF[#0084AF]"
32  #define DEFAULT_POLYGONS_COLOR "#00536E[#2696BA]"
33 
38  enum class TubeColorType { FOREGROUND, BACKGROUND, SLICES, GATES, POLYGONS };
39 
47  class VIBesFigTube : public VIBesFig
48  {
49  public:
50 
53 
61  VIBesFigTube(const std::string& fig_name, const Tube *tube = nullptr, const Trajectory *traj = nullptr);
62 
67 
71  void show();
72 
79  void show(bool detail_slices);
80 
86  void set_cursor(double t);
87 
93  void show_cursor(bool display = true);
94 
98 
107  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);
108 
119  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);
120 
133  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);
134 
141  void set_tube_name(const Tube *tube, const std::string& name);
142 
152  void set_tube_derivative(const Tube *tube, const Tube *derivative);
153 
161  void set_tube_color(const Tube *tube, const std::string& color_frgrnd, const std::string& color_bckgrnd = DEFAULT_BCKGRND_COLOR);
162 
172  void set_tube_color(const Tube *tube, TubeColorType color_type, const std::string& color);
173 
181  void reset_tube_background(const Tube *tube);
182 
193  void remove_tube(const Tube *tube);
194 
198 
206  void add_trajectory(const Trajectory *traj, const std::string& name, const std::string& color = DEFAULT_TRAJ_COLOR);
207 
217  void add_trajectories(const TrajectoryVector *trajvector, const std::string& name, const std::string& color = DEFAULT_TRAJ_COLOR);
218 
230  void add_trajectories(const TrajectoryVector *trajvector, int start_index, int end_index, const std::string& name, const std::string& color = DEFAULT_TRAJ_COLOR);
231 
238  void set_trajectory_name(const Trajectory *traj, const std::string& name);
239 
246  void set_trajectory_color(const Trajectory *traj, const std::string& color);
247 
255  void set_trajectory_points_size(const Trajectory *traj, double points_size);
256 
267  void remove_trajectory(const Trajectory *traj);
268 
270 
271  protected:
272 
279  void create_group_color(const Tube *tube, TubeColorType color_type);
280 
286  void create_groups_color(const Tube *tube);
287 
296  const IntervalVector draw_tube(const Tube *tube, bool detail_slices = false);
297 
304  void draw_slice(const Slice& slice, const vibes::Params& params);
305 
314  void draw_slice(const Slice& slice, const Slice& deriv_slice, const vibes::Params& params_slice, const vibes::Params& params_polygon);
315 
323  void draw_gate(const Interval& gate, double t, const vibes::Params& params);
324 
331  const IntervalVector draw_trajectory(const Trajectory *traj);
332 
333  protected:
334 
340  {
341  std::string name;
342  std::map<TubeColorType,std::string> m_colors;
343  const Tube *tube_copy = nullptr;
344  const Tube *tube_derivative = nullptr;
345  };
346 
352  {
353  std::string name;
354  std::string color;
355  float points_size = 0.;
356  };
357 
358  std::map<const Tube*,FigTubeParams> m_map_tubes;
359  std::map<const Trajectory*,FigTrajParams> m_map_trajs;
360  bool m_display_cursor = false;
361  double m_cursor;
362 
363  friend class VIBesFigTubeVector;
364  };
365 }
366 
367 #endif
const std::string name() const
Returns the name of this figure.
Slice of a one dimensional tube and made of an envelope and two gates.
Definition: codac_Slice.h:34
One dimensional trajectory , defined as a temporal map of values.
Definition: codac_Trajectory.h:35
n-dimensional trajectory , defined as a temporal map of vector values
Definition: codac_TrajectoryVector.h:38
One dimensional tube , defined as an interval of scalar trajectories.
Definition: codac_Tube.h:48
n-dimensional tube , defined as an interval of n-dimensional trajectories
Definition: codac_TubeVector.h:39
Two-dimensional graphical item based on the VIBes viewer.
Definition: codac_VIBesFig.h:38
Two-dimensional graphical item to display scalar tubes or trajectories.
Definition: codac_VIBesFigTube.h:48
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 reset_tube_background(const Tube *tube)
Reset the background of 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 create_group_color(const Tube *tube, TubeColorType color_type)
Creates the VIBes group of color_type related to the given tube.
void set_cursor(double t)
Set the position of the temporal cursor of this figure.
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 f...
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.
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.
bool m_display_cursor
boolean to display a temporal cursor
Definition: codac_VIBesFigTube.h:360
void create_groups_color(const Tube *tube)
Creates all the VIBes groups related to the given tube.
void remove_tube(const Tube *tube)
Removes a tube from this figure.
void draw_slice(const Slice &slice, const vibes::Params &params)
Draws a slice.
void show_cursor(bool display=true)
Displays the cursor on this figure.
void show(bool detail_slices)
Displays this figure with optional details.
std::map< const Tube *, FigTubeParams > m_map_tubes
map of Tube objects to be displayed, together with parameters
Definition: codac_VIBesFigTube.h:358
void set_trajectory_name(const Trajectory *traj, const std::string &name)
Sets a new name for a trajectory.
~VIBesFigTube()
VIBesFigTube destructor.
void draw_gate(const Interval &gate, double t, const vibes::Params &params)
Draws a gate.
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.
const IntervalVector draw_trajectory(const Trajectory *traj)
Draws a trajectory.
const IntervalVector draw_tube(const Tube *tube, bool detail_slices=false)
Draws a tube.
std::map< const Trajectory *, FigTrajParams > m_map_trajs
map of Trajectory objects to be displayed, together with parameters
Definition: codac_VIBesFigTube.h:359
void show()
Displays 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 set_tube_derivative(const Tube *tube, const Tube *derivative)
Links a tube to its derivative for display purposes.
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.
double m_cursor
the temporal cursor's position
Definition: codac_VIBesFigTube.h:361
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 set_tube_name(const Tube *tube, const std::string &name)
Sets a new name for a tube.
VIBesFigTube(const std::string &fig_name, const Tube *tube=nullptr, const Trajectory *traj=nullptr)
Creates a VIBesFigTube.
void set_trajectory_color(const Trajectory *traj, const std::string &color)
Sets color properties for a given trajectory.
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 remove_trajectory(const Trajectory *traj)
Removes a trajectory from this figure.
Multi-view item to display vector tubes or trajectories.
Definition: codac_VIBesFigTubeVector.h:33
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
TubeColorType
Defines a set of colors for tube display.
Definition: codac_VIBesFigTube.h:38
Specifies some parameters related to a Trajectory display.
Definition: codac_VIBesFigTube.h:352
float points_size
size of points in specific display mode
Definition: codac_VIBesFigTube.h:355
std::string color
color of the trajectory
Definition: codac_VIBesFigTube.h:354
std::string name
human readable identifier of the trajectory
Definition: codac_VIBesFigTube.h:353
Specifies some parameters related to a Tube display.
Definition: codac_VIBesFigTube.h:340
std::string name
human readable identifier of the tube
Definition: codac_VIBesFigTube.h:341
const Tube * tube_copy
to display previous values in background, before any new contraction
Definition: codac_VIBesFigTube.h:343
std::map< TubeColorType, std::string > m_colors
map of colors <TubeColorType,html_color_code>
Definition: codac_VIBesFigTube.h:342
const Tube * tube_derivative
to display thinner envelopes (polygons) enclosed by the slices
Definition: codac_VIBesFigTube.h:344