codac
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 
66  ~VIBesFigTube();
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
std::string color
color of the trajectory
Definition: codac_VIBesFigTube.h:354
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
std::string name
human readable identifier of the trajectory
Definition: codac_VIBesFigTube.h:353
Slice of a one dimensional tube and made of an envelope and two gates.
Definition: codac_Slice.h:33
double m_cursor
the temporal cursor&#39;s position
Definition: codac_VIBesFigTube.h:361
One dimensional trajectory , defined as a temporal map of values.
Definition: codac_Trajectory.h:34
Multi-view item to display vector tubes or trajectories.
Definition: codac_VIBesFigTubeVector.h:32
n-dimensional trajectory , defined as a temporal map of vector values
Definition: codac_TrajectoryVector.h:37
n-dimensional tube , defined as an interval of n-dimensional trajectories
Definition: codac_TubeVector.h:38
One dimensional tube , defined as an interval of scalar trajectories.
Definition: codac_Tube.h:47
Two-dimensional graphical item to display scalar tubes or trajectories.
Definition: codac_VIBesFigTube.h:47
Specifies some parameters related to a Trajectory display.
Definition: codac_VIBesFigTube.h:351
Two-dimensional graphical item based on the VIBes viewer.
Definition: codac_VIBesFig.h:37
std::string name
human readable identifier of the tube
Definition: codac_VIBesFigTube.h:341
std::map< TubeColorType, std::string > m_colors
map of colors <TubeColorType,html_color_code>
Definition: codac_VIBesFigTube.h:342
TubeColorType
Defines a set of colors for tube display.
Definition: codac_VIBesFigTube.h:38
std::map< const Trajectory *, FigTrajParams > m_map_trajs
map of Trajectory objects to be displayed, together with parameters
Definition: codac_VIBesFigTube.h:359
Specifies some parameters related to a Tube display.
Definition: codac_VIBesFigTube.h:339
std::map< const Tube *, FigTubeParams > m_map_tubes
map of Tube objects to be displayed, together with parameters
Definition: codac_VIBesFigTube.h:358