Skip to content
Snippets Groups Projects
Commit 3046386d authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Expose LeafNodeLine::setPointsSubset

parent 57b5b3f8
No related branches found
No related tags found
No related merge requests found
...@@ -193,6 +193,8 @@ typedef sequence<Position> PositionSeq; ...@@ -193,6 +193,8 @@ typedef sequence<Position> PositionSeq;
boolean setCurveMode (in string curveName, in string mode) raises (Error); boolean setCurveMode (in string curveName, in string mode) raises (Error);
boolean setCurvePointsSubset (in string curveName, in long first, in long count) raises (Error);
boolean setCurveLineWidth (in string curveName, in float width) raises (Error); boolean setCurveLineWidth (in string curveName, in float width) raises (Error);
/// create a four vertices face called faceName. /// create a four vertices face called faceName.
......
...@@ -200,6 +200,7 @@ namespace graphics { ...@@ -200,6 +200,7 @@ namespace graphics {
/// See http://svn.openscenegraph.org/osg/OpenSceneGraph-Data/trunk/Images/primitives.gif for /// See http://svn.openscenegraph.org/osg/OpenSceneGraph-Data/trunk/Images/primitives.gif for
/// possible values /// possible values
virtual bool setCurveMode (const std::string& curveName, const GLenum mode); virtual bool setCurveMode (const std::string& curveName, const GLenum mode);
virtual bool setCurvePointsSubset (const std::string& curveName, const int first, const std::size_t count);
virtual bool setCurveLineWidth (const std::string& curveName, const float& width); virtual bool setCurveLineWidth (const std::string& curveName, const float& width);
virtual bool addSquareFace(const std::string& faceName, const osgVector3& pos1, const osgVector3& pos2, const osgVector3& pos3, const osgVector3& pos4, const Color_t& color); virtual bool addSquareFace(const std::string& faceName, const osgVector3& pos1, const osgVector3& pos2, const osgVector3& pos3, const osgVector3& pos4, const Color_t& color);
......
...@@ -331,6 +331,8 @@ namespace graphics { ...@@ -331,6 +331,8 @@ namespace graphics {
BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveMode, STRING, GLMODE) BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveMode, STRING, GLMODE)
BIND_TO_WINDOWS_MANAGER_3(BOOL, setCurvePointsSubset, STRING, LONG, LONG)
BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveLineWidth, STRING, FLOAT) BIND_TO_WINDOWS_MANAGER_2(BOOL, setCurveLineWidth, STRING, FLOAT)
BIND_TO_WINDOWS_MANAGER_5(BOOL, addTriangleFace, STRING, POSITION, POSITION, POSITION, COLOR) BIND_TO_WINDOWS_MANAGER_5(BOOL, addTriangleFace, STRING, POSITION, POSITION, POSITION, COLOR)
......
...@@ -102,6 +102,7 @@ public: ...@@ -102,6 +102,7 @@ public:
virtual bool setCurvePoints(const char* curveName, const PositionSeq& pos) throw (Error); virtual bool setCurvePoints(const char* curveName, const PositionSeq& pos) throw (Error);
virtual bool setCurveMode(const char* curveName, const char* modeName) throw (Error); virtual bool setCurveMode(const char* curveName, const char* modeName) throw (Error);
virtual bool setCurvePointsSubset(const char* curveName, CORBA::Long first, CORBA::Long count) throw (Error);
virtual bool setCurveLineWidth(const char* curveName, const float width) throw (Error); virtual bool setCurveLineWidth(const char* curveName, const float width) throw (Error);
virtual bool addSquareFace(const char* faceName, const value_type* pos1, const value_type* pos2, const value_type* pos3, const value_type* pos4, const Color color) throw (Error); virtual bool addSquareFace(const char* faceName, const value_type* pos1, const value_type* pos2, const value_type* pos3, const value_type* pos4, const Color color) throw (Error);
......
...@@ -76,6 +76,15 @@ ...@@ -76,6 +76,15 @@
throw gepetto::Error (oss.str ().c_str ()); \ throw gepetto::Error (oss.str ().c_str ()); \
} }
#define FIND_NODE_OF_TYPE_OR_THROW(NodeType, varname, nodename) \
NodeType##Ptr_t varname (boost::dynamic_pointer_cast <NodeType> \
(getNode(nodename, true))); \
if (!varname) { \
std::ostringstream oss; \
oss << "Node \"" << nodename << "\" is not of type " #NodeType; \
throw gepetto::Error (oss.str ().c_str ()); \
}
namespace graphics { namespace graphics {
namespace { namespace {
typedef std::map<std::string, NodePtr_t>::iterator NodeMapIt; typedef std::map<std::string, NodePtr_t>::iterator NodeMapIt;
...@@ -694,6 +703,21 @@ namespace graphics { ...@@ -694,6 +703,21 @@ namespace graphics {
} }
} }
bool WindowsManager::setCurvePointsSubset (const std::string& curveName,
const int first, const std::size_t count)
{
FIND_NODE_OF_TYPE_OR_THROW (LeafNodeLine, curve, curveName);
osgFrameMutex().lock();
try {
curve->setPointsSubset (first, count);
} catch (const std::exception& exc) {
osgFrameMutex().unlock();
throw gepetto::Error (exc.what ());
}
osgFrameMutex().unlock();
return true;
}
bool WindowsManager::setCurveLineWidth (const std::string& curveName, const float& width) bool WindowsManager::setCurveLineWidth (const std::string& curveName, const float& width)
{ {
NodePtr_t node = getNode (curveName, true); NodePtr_t node = getNode (curveName, true);
......
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