2
@author Shin'ichiro Nakaoka
5
#ifndef CNOID_GUIBASE_GRAPH_WIDGET_H_INCLUDED
6
#define CNOID_GUIBASE_GRAPH_WIDGET_H_INCLUDED
8
#include <cnoid/Archive>
11
#include <boost/shared_ptr.hpp>
12
#include <boost/function.hpp>
13
#include <boost/signals.hpp>
17
#include "exportdecl.h"
25
class GraphDataHandler;
26
class GraphDataHandlerImpl;
27
class GraphWidgetImpl;
29
typedef boost::shared_ptr<GraphDataHandler> GraphDataHandlerPtr;
31
class CNOID_EXPORT GraphDataHandler
38
void setColor(float r, float g, float b);
39
void setLabel(const std::string& label);
40
void setFrameProperties(int numFrames, double frameRate, double offset = 0.0);
42
void setValueLimits(double lower, double upper);
43
void setVelocityLimits(double lower, double upper);
45
void addVerticalLine(double x, const std::string& label);
46
void addHorizontalLine(double y, const std::string& label);
51
typedef boost::function<void(int frame, int size, double* out_values)> DataRequestCallback;
52
void setDataRequestCallback(DataRequestCallback callback);
54
typedef boost::function<void(int frame, int size, double* values)> DataModifiedCallback;
55
void setDataModifiedCallback(DataModifiedCallback callback);
59
friend class GraphWidgetImpl;
61
GraphDataHandlerImpl* impl;
65
class CNOID_EXPORT GraphWidget : public QWidget, public boost::signals::trackable
69
GraphWidget(View* parentView);
72
void addDataHandler(GraphDataHandlerPtr handler);
73
void clearDataHandlers();
75
void setRenderingTypes(bool showOriginalValues, bool showVelocities, bool showAccelerations);
76
void getRenderingTypes(bool& showOriginalValues, bool& showVelocities, bool& showAccelerations);
78
bool setCursorPosition(double pos);
80
void setTimeBarSyncMode(bool on);
81
bool isTimeBarSyncMode();
83
enum ScrollMode { OFF, CONTINUOUS, PAGE };
84
void setAutoScrollMode(ScrollMode on);
85
ScrollMode autoScrollMode();
87
void setVerticalValueRange(double lower, double upper);
88
void getVerticalValueRange(double& lower, double& upper);
90
void setLineWidth(double width);
91
double getLineWidth();
93
void showRulers(bool show);
96
void showLimits(bool show);
99
void showGrid(bool show);
102
void setGridSize(double width, double height);
103
void getGridSize(double& width, double& height);
105
void setControlPointStep(int step, int offset = 0);
106
void getControlPointStep(int& step, int& offset);
108
void highlightControlPoints(bool on);
109
bool highlightsControlPoints();
111
enum Mode { VIEW_MODE, EDIT_MODE };
112
void changeMode(Mode mode);
115
enum EditMode { FREE_LINE_MODE, LINE_MODE };
116
void changeEditMode(EditMode mode);
119
QLabel& statusLabel();
121
virtual bool storeState(Archive& archive);
122
virtual bool restoreState(const Archive& archive);
125
virtual bool eventFilter(QObject* obj, QEvent* event);
129
friend class GraphDataHandler;
131
GraphWidgetImpl* impl;