Skip to content
Snippets Groups Projects
Commit 15b2b6ac authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Expose setCurveColors

parent c54fea45
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ typedef string WindowID; ...@@ -25,6 +25,7 @@ typedef string WindowID;
typedef sequence <string> Names_t; /// Sequence of names typedef sequence <string> Names_t; /// Sequence of names
typedef sequence<float> floatSeq; typedef sequence<float> floatSeq;
typedef sequence<Position> PositionSeq; typedef sequence<Position> PositionSeq;
typedef sequence<Color> ColorSeq;
typedef sequence<Transform> TransformSeq; typedef sequence<Transform> TransformSeq;
interface NodeCallback { interface NodeCallback {
...@@ -181,6 +182,11 @@ typedef sequence<Transform> TransformSeq; ...@@ -181,6 +182,11 @@ typedef sequence<Transform> TransformSeq;
/// \param pos : waypoints of the curve. /// \param pos : waypoints of the curve.
boolean setCurvePoints(in string name, in PositionSeq pos) raises (Error); boolean setCurvePoints(in string name, in PositionSeq pos) raises (Error);
/// set colors of a curve called curveName (there should be one color per points).
/// \param name : name of the line.
/// \param color : color of each point.
boolean setCurveColors(in string name, in ColorSeq pos) raises (Error);
/// \param mode The list of possible GL modes is provided in /// \param mode The list of possible GL modes is provided in
/// gepetto::viewer::WindowsManager::setCurveMode. /// gepetto::viewer::WindowsManager::setCurveMode.
/// From the GL modes, remove "GL_" and put it lower case. /// From the GL modes, remove "GL_" and put it lower case.
......
...@@ -47,7 +47,7 @@ namespace gepetto { ...@@ -47,7 +47,7 @@ namespace gepetto {
return names; return names;
} }
enum ArgType { STRING, STRING_LIST, OUT_STRING_LIST, COLOR, enum ArgType { STRING, STRING_LIST, OUT_STRING_LIST, COLOR, COLOR_SEQ,
TRANSFORM, TRANSFORM_SEQ, POSITION, POSITION_SEQ, TRANSFORM, TRANSFORM_SEQ, POSITION, POSITION_SEQ,
FLOAT, SHORT, LONG, BOOL, VOID, FLOAT, SHORT, LONG, BOOL, VOID,
GLMODE, VECTOR2, WINDOW_ID = STRING GLMODE, VECTOR2, WINDOW_ID = STRING
...@@ -61,6 +61,16 @@ namespace gepetto { ...@@ -61,6 +61,16 @@ namespace gepetto {
static Out_t op (In_t color) { return Out_t (color[0], color[1], color[2], color[3]); } static Out_t op (In_t color) { return Out_t (color[0], color[1], color[2], color[3]); }
static Ret_t ret (Out_t in) { Ret_t r = gepetto::corbaserver::Color_alloc(); to(in, r, 4); return r; } static Ret_t ret (Out_t in) { Ret_t r = gepetto::corbaserver::Color_alloc(); to(in, r, 4); return r; }
}; };
template <> struct traits<COLOR_SEQ> {
typedef const ColorSeq& In_t;
typedef ::osg::Vec4ArrayRefPtr Out_t;
static inline Out_t op (In_t in) {
Out_t out = new ::osg::Vec4Array(in.length());
for (CORBA::ULong i = 0; i < in.length (); ++i)
(*out)[i] = ::osg::Vec4 (in[i][0],in[i][1],in[i][2],in[i][3]);
return out;
}
};
template <> struct traits<TRANSFORM> { template <> struct traits<TRANSFORM> {
typedef const Transform In_t; typedef const Transform In_t;
typedef Configuration Out_t; typedef Configuration Out_t;
...@@ -101,9 +111,9 @@ namespace gepetto { ...@@ -101,9 +111,9 @@ namespace gepetto {
typedef const PositionSeq& In_t; typedef const PositionSeq& In_t;
typedef ::osg::Vec3ArrayRefPtr Out_t; typedef ::osg::Vec3ArrayRefPtr Out_t;
static inline Out_t op (In_t in) { static inline Out_t op (In_t in) {
Out_t out = new ::osg::Vec3Array; Out_t out = new ::osg::Vec3Array(in.length());
for (CORBA::ULong i = 0; i < in.length (); ++i) for (CORBA::ULong i = 0; i < in.length (); ++i)
out->push_back (::osg::Vec3 (in[i][0],in[i][1],in[i][2])); (*out)[i] = ::osg::Vec3 (in[i][0],in[i][1],in[i][2]);
return out; return out;
} }
}; };
......
...@@ -188,6 +188,7 @@ namespace gepetto { ...@@ -188,6 +188,7 @@ namespace gepetto {
BIND_TO_WINDOWS_MANAGER_3(BOOL, addCurve, STRING, POSITION_SEQ, COLOR) BIND_TO_WINDOWS_MANAGER_3(BOOL, addCurve, STRING, POSITION_SEQ, COLOR)
BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurvePoints, STRING, POSITION_SEQ) BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurvePoints, STRING, POSITION_SEQ)
BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveColors, STRING, COLOR_SEQ)
BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveMode, STRING, GLMODE) BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveMode, STRING, GLMODE)
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
virtual bool addCurve(const char* curveName, const PositionSeq& pos, const Color color); virtual bool addCurve(const char* curveName, const PositionSeq& pos, const Color color);
virtual bool setCurvePoints(const char* curveName, const PositionSeq& pos); virtual bool setCurvePoints(const char* curveName, const PositionSeq& pos);
virtual bool setCurveColors(const char* curveName, const ColorSeq& colors);
virtual bool setCurveMode(const char* curveName, const char* modeName); virtual bool setCurveMode(const char* curveName, const char* modeName);
virtual bool setCurvePointsSubset(const char* curveName, CORBA::Long first, CORBA::Long count); virtual bool setCurvePointsSubset(const char* curveName, CORBA::Long first, CORBA::Long count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment