Go to the documentation of this file.
17 #ifndef GAZEBO_GUI_PLOT_PLOTCANVAS_HH_
18 #define GAZEBO_GUI_PLOT_PLOTCANVAS_HH_
24 #include <ignition/math/Vector2.hh>
36 class IncrementalPlot;
37 class PlotCanvasPrivate;
54 public:
void SetVariableLabel(
const unsigned int _id,
55 const std::string &_label);
61 public:
unsigned int AddVariable(
const std::string &_variable,
62 const unsigned int _plotId = EmptyPlot);
69 public:
void RemoveVariable(
const unsigned int _id,
70 const unsigned int _plotId = EmptyPlot);
74 public:
unsigned int AddPlot();
78 public:
void RemovePlot(
const unsigned int _plotId);
82 public:
unsigned int PlotCount()
const;
87 public:
unsigned int VariableCount(
const unsigned int _plotId)
const;
91 public:
void Restart();
94 public:
void Update();
99 public:
unsigned int PlotByVariable(
const unsigned int _variableId)
const;
103 public: std::vector<IncrementalPlot *> Plots()
const;
111 public:
void Clear();
116 public:
void SetDeleteCanvasEnabled(
const bool _enable);
122 public:
virtual bool eventFilter(QObject *_o, QEvent *_event);
126 public: std::string Title()
const;
131 public:
void Export(
const std::string &_dirName,
137 private:
void ExportPDF(
const std::string &_dirName)
const;
142 private:
void ExportCSV(
const std::string &_dirName)
const;
150 private:
void AddVariable(
const unsigned int _id,
151 const std::string &_variable,
152 const unsigned int _plotId = EmptyPlot);
157 private:
void UpdateAxisLabel();
160 Q_SIGNALS:
void CanvasDeleted();
164 private slots:
void OnAddVariable(
const std::string &_variable);
171 private slots:
void OnAddVariable(
const unsigned int _id,
172 const std::string &_variable,
const unsigned int _targetId);
178 private slots:
void OnRemoveVariable(
const unsigned int _id,
179 const unsigned int _targetId);
185 private slots:
void OnMoveVariable(
const unsigned int _id,
186 const unsigned int _targetId);
191 private slots:
void OnSetVariableLabel(
const unsigned int _id,
192 const std::string &_label);
195 private slots:
void OnClearCanvas();
198 private slots:
void OnDeleteCanvas();
201 private slots:
void OnShowGrid();
204 private slots:
void OnShowHoverLine();
211 private: std::unique_ptr<PlotCanvasPrivate> dataPtr;
virtual ~PlotCanvas()
Destructor.
std::string Title() const
Get the title of the plot.
default namespace for gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
unsigned int AddVariable(const std::string &_variable, const unsigned int _plotId=EmptyPlot)
Add a new variable to a plot.
unsigned int PlotByVariable(const unsigned int _variableId) const
Get the plot id which the variable is plotted in.
void Clear()
Clear the canvas and remove all variables and plots.
unsigned int PlotCount() const
Get the number of plots in this canvas.
std::vector< IncrementalPlot * > Plots() const
Get all the plots in this canvas.
static const unsigned int EmptyPlot
Empty plot used to indicate non-existent plot.
Definition: PlotCanvas.hh:207
FileType
Supported file types.
Definition: ExportDialog.hh:34
void Restart()
Restart plotting.
Plot canvas.
Definition: PlotCanvas.hh:40
PlotCanvas(QWidget *_parent)
Constructor.
void SetVariableLabel(const unsigned int _id, const std::string &_label)
Set the label of a variable.
void Update()
Update plots and curves with new data.
virtual bool eventFilter(QObject *_o, QEvent *_event)
Used to filter scroll wheel events.
void RemoveVariable(const unsigned int _id, const unsigned int _plotId=EmptyPlot)
Remove a variable from a plot.
unsigned int VariableCount(const unsigned int _plotId) const
Get the number of variables in a plot.
Plot Curve data.
Definition: PlotCurve.hh:41
gui
Definition: KeyEventHandler.hh:29
std::weak_ptr< PlotCurve > PlotCurveWeakPtr
Definition: PlottingTypes.hh:41
void SetDeleteCanvasEnabled(const bool _enable)
Set whether or not to enable the delete canvas option in settings.
unsigned int AddPlot()
Add a new plot to the canvas.
void CanvasDeleted()
Qt signal to request self-deletion.
PlotCurveWeakPtr PlotCurve(const unsigned int _variableId)
Get the curve associated with the variable.
void RemovePlot(const unsigned int _plotId)
Remove a plot from the canvas.
void Export(const std::string &_dirName, const FileType _type) const
Export to PDF files in the given directory.