Skip to content
Snippets Groups Projects
Commit 48ed2c64 authored by Pierre Fernbach's avatar Pierre Fernbach Committed by Florent Lamiraux
Browse files

can now dynamicaly resize a capsule

parent 58941fc5
No related branches found
No related tags found
No related merge requests found
......@@ -242,6 +242,12 @@ typedef unsigned long WindowID;
/// \param input nodeName : name of the node.
/// \param input visibilityMode : visibility mode can be "ON", "OFF" or "ALWAYS_ON_TOP".
boolean setVisibility(in string nodeName, in string visibilityMode) raises (Error);
/// Change the scale of a node.
/// \param input nodeName : name of the node.
/// \param input scale : new scale
boolean setScale(in string nodeName, in Position scale) raises (Error);
/// Change wireframe mode of a node. If this node is a group node, wireframe mode will be apply to all children.
/// \param input nodeName : name of the node.
......
......@@ -143,6 +143,7 @@ namespace graphics {
virtual bool deleteLandmark(const char* nodeNameCorba);
virtual bool setVisibility(const char* nodeNameCorba, const char* visibilityModeCorba);
virtual bool setScale(const char* nodeNameCorba, const value_type* scale);
virtual bool setWireFrameMode(const char* nodeNameCorba, const char* wireFrameModeCorba);
virtual bool setLightingMode(const char* nodeNameCorba, const char* lightingModeCorba);
......
......@@ -385,6 +385,16 @@ namespace graphics {
}
}
bool GraphicalInterface::setScale (const char* nodeNameCorba,
const value_type* scale) throw (Error)
{
try {
return windowsManager_->setScale ( nodeNameCorba, scale) ;
} catch (const std::exception& exc) {
throw Error (exc.what ());
}
}
bool GraphicalInterface::setWireFrameMode (const char* nodeNameCorba,
const char* wireFrameModeCorba) throw (Error)
{
......
......@@ -104,7 +104,9 @@ public:
virtual bool addLandmark(const char* nodeNameCorba, float size) throw (Error);
virtual bool deleteLandmark(const char* nodeNameCorba) throw (Error);
virtual bool setVisibility(const char* nodeNameCorba, const char* visibilityModeCorba) throw (Error);
virtual bool setScale(const char* nodeNameCorba, const value_type* scale)throw (Error);
virtual bool setWireFrameMode(const char* nodeNameCorba, const char* wireFrameModeCorba) throw (Error);
virtual bool setLightingMode(const char* nodeNameCorba, const char* lightingModeCorba) throw (Error);
......
......@@ -365,9 +365,8 @@ namespace graphics {
else{
NodePtr_t node = nodes_[capsuleName];
try{
LeafNodeCapsulePtr_t cap = boost::dynamic_pointer_cast<LeafNodeCapsule>(node);
cap->setHeight(newHeight);
cap->resize(newHeight);
}catch (const std::exception& exc) {
std::cout <<capsuleName << "isn't a capsule." << std::endl;
return false;
......@@ -827,9 +826,9 @@ namespace graphics {
<< std::endl;
return false;
}
mtx_.lock();
mtx_.lock();
nodes_[nodeName]->addLandmark (size);
mtx_.unlock();
mtx_.unlock();
return true;
}
......@@ -864,6 +863,19 @@ namespace graphics {
return true;
}
bool WindowsManager::setScale(const char* nodeNameCorba, const value_type* scale){
const std::string nodeName (nodeNameCorba);
osg::Vec3d vecScale(scale[0],scale[1],scale[2]);
if (nodes_.find (nodeName) == nodes_.end ()) {
std::cout << "Node \"" << nodeName << "\" doesn't exist."
<< std::endl;
return false;
}
nodes_[nodeName]->setScale(vecScale);
return true;
}
bool WindowsManager::setWireFrameMode (const char* nodeNameCorba,
const char* wireFrameModeCorba)
{
......
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