Commit 9c9f1b65 authored by Joseph Mirabel's avatar Joseph Mirabel

Update to changes in gepetto-viewer.

parent 02d5f816
......@@ -26,8 +26,8 @@ ADD_OPTIONAL_DEPENDENCY(hpp-fcl)
SET(BUILD_REMOTEIMU_PLUGIN ${REMOTEIMU_FOUND}
CACHE BOOL "Build remoteimuplugin")
SET(BUILD_HPP_CORBASERVER_PLUGIN OFF
CACHE BOOL "Build hppcorbaserverplugin")
#SET(BUILD_HPP_CORBASERVER_PLUGIN OFF
# CACHE BOOL "Build hppcorbaserverplugin")
SET(BUILD_HPP_WIDGETS_PLUGIN ${HPP_CORBASERVER_FOUND}
CACHE BOOL "Build hppwidgetsplugin")
SET(BUILD_HPP_MANIPULATION_WIDGETS_PLUGIN ${HPP_MANIPULATION_CORBA_FOUND}
......@@ -40,9 +40,10 @@ IF (HPP_CORBASERVER_FOUND)
ADD_SUBDIRECTORY(remoteimuplugin)
ENDIF (REMOTEIMU_FOUND AND BUILD_REMOTEIMU_PLUGIN)
IF (BUILD_HPP_CORBASERVER_PLUGIN)
ADD_SUBDIRECTORY(hppcorbaserverplugin)
ENDIF (BUILD_HPP_CORBASERVER_PLUGIN)
# Disable because header <gepetto/gui/omniorb/omniorbthread.hh> no more accessible.
#IF (BUILD_HPP_CORBASERVER_PLUGIN)
# ADD_SUBDIRECTORY(hppcorbaserverplugin)
#ENDIF (BUILD_HPP_CORBASERVER_PLUGIN)
IF (BUILD_HPP_WIDGETS_PLUGIN)
ADD_SUBDIRECTORY(hppwidgetsplugin)
......
......@@ -23,10 +23,10 @@
namespace hpp {
namespace gui {
BVHDisplay::BVHDisplay (const std::string& filename, const std::string& name)
: graphics::Node (name)
: Node (name)
, filename_ (filename)
{
setWireFrameMode (graphics::WIREFRAME);
setWireFrameMode (gepetto::viewer::WIREFRAME);
}
void BVHDisplay::setColor (const osgVector4&)
......@@ -57,7 +57,7 @@ namespace hpp {
level_ = 0;
this->asQueue()->addChild(levels_[0].geode);
using graphics::UIntProperty;
using gepetto::viewer::UIntProperty;
addProperty (UIntProperty::create ("Level",
UIntProperty::getterFromMemberFunction (this, &BVHDisplay::getLevel),
UIntProperty::setterFromMemberFunction (this, &BVHDisplay::setLevel))
......
......@@ -25,9 +25,11 @@
namespace hpp {
namespace gui {
typedef gepetto::viewer::Node Node;
DEF_CLASS_SMART_PTR(BVHDisplay)
class BVHDisplay : public graphics::Node
class BVHDisplay : public Node
{
public:
BVHDisplay (const std::string& filename, const std::string& name);
......
......@@ -34,6 +34,9 @@ namespace hpp {
void HppFclPlugin::init()
{
MainWindow* main = MainWindow::instance ();
main->registerSlot("addBV", this);
// TODO add a way to add an action to body tree items.
QToolBar* toolBar = MainWindow::instance()->addToolBar("hpp-fcl tools");
toolBar->setObjectName ("hppfclplugin.toolbar");
......@@ -42,13 +45,9 @@ namespace hpp {
connect (openD, SIGNAL(triggered()), SLOT (openDialog()));
}
void HppFclPlugin::openDialog() const
void HppFclPlugin::addBV (QString name, QString filename, int splitMethod) const
{
QString filename = QFileDialog::getOpenFileName (NULL, "Select a mesh file");
QString name = QInputDialog::getText(NULL, "Node name", "Node name", QLineEdit::Normal, "bvhmodel");
std::string _name (name.toStdString());
int splitMethod = QInputDialog::getInt(NULL, "Split method type",
"Split method type", 0, 0, 3, 1);
BVHDisplayPtr_t node (new BVHDisplay (filename.toStdString(), _name));
switch (splitMethod) {
......@@ -65,7 +64,15 @@ namespace hpp {
}
MainWindow* main = MainWindow::instance ();
main->osg()->insertNode (_name, node);
main->osg()->addToGroup (_name, "hpp-gui");
}
void HppFclPlugin::openDialog() const
{
QString filename = QFileDialog::getOpenFileName (NULL, "Select a mesh file");
QString name = QInputDialog::getText(NULL, "Node name", "Node name", QLineEdit::Normal, "bvhmodel");
int splitMethod = QInputDialog::getInt(NULL, "Split method type",
"Split method type", 0, 0, 3, 1);
addBV (filename, name, splitMethod);
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
......
......@@ -34,6 +34,9 @@ namespace hpp {
public:
QString name () const { return QString("HppFclPlugin"); }
public slots:
void addBV (QString name, QString filename, int splitMethod) const;
protected:
void init();
......
......@@ -27,6 +27,8 @@
using CORBA::ULong;
namespace gv = gepetto::viewer;
namespace hpp {
namespace gui {
HppManipulationWidgetsPlugin::HppManipulationWidgetsPlugin() :
......@@ -173,7 +175,7 @@ namespace hpp {
osgVector4 color (0, 1, 0, 1);
osgVector3 norm(0, 0, 0);
CORBA::Long iPts = (j == 0) ? 0 : indexes[j - 1];
graphics::WindowsManager::Vec3ArrayPtr_t ps(new osg::Vec3Array);
gv::WindowsManager::Vec3ArrayPtr_t ps(new osg::Vec3Array);
ps->resize (indexes[j] - iPts);
if (ps->size() > 3) {
osgVector3 a((float)(points[iPts][0] - points[iPts + 1][0]),
......@@ -241,8 +243,8 @@ namespace hpp {
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
hpp::Names_t_var rcs = hpp_->problem()->getAvailable("handle");
hpp::Transform__var t (new Transform_);
graphics::Configuration config;
const graphics::WindowsManager::Color_t color (0, 1, 0, 1);
gv::Configuration config;
const gv::WindowsManager::Color_t color (0, 1, 0, 1);
for (CORBA::ULong i = 0; i < rcs->length(); ++i) {
const std::string jn =
hpp_->robot()->getHandlePositionInJoint (rcs[i],t.out());
......@@ -262,8 +264,8 @@ namespace hpp {
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
hpp::Names_t_var rcs = hpp_->problem()->getAvailable("gripper");
hpp::Transform__var t (new Transform_);
graphics::Configuration config;
const graphics::WindowsManager::Color_t color (0, 1, 0, 1);
gv::Configuration config;
const gv::WindowsManager::Color_t color (0, 1, 0, 1);
for (CORBA::ULong i = 0; i < rcs->length(); ++i) {
const std::string jn =
hpp_->robot()->getGripperPositionInJoint (rcs[i],t.out());
......
......@@ -20,12 +20,12 @@ namespace hpp {
namespace gui {
/// HppManipulationWidgetsPlugin add functionalities to interact with hpp-manipulation-corba
class HppManipulationWidgetsPlugin : public HppWidgetsPlugin
// , public PluginInterface, public ModelInterface, public CorbaErrorInterface
// , public PluginInterface, public ModelInterface, public ConnectionInterface
{
Q_OBJECT
Q_INTERFACES (gepetto::gui::PluginInterface
gepetto::gui::ModelInterface
gepetto::gui::CorbaInterface)
gepetto::gui::ConnectionInterface)
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
Q_PLUGIN_METADATA (IID "hpp-gui.hppmanipulationwidgetsplugin")
......@@ -60,7 +60,7 @@ namespace hpp {
/// \param jointName joint name
std::string getBodyFromJoint (const std::string& jointName) const;
// CorbaInterface
// ConnectionInterface
public:
/// Open a connection to a corba manipulation server.
virtual void openConnection ();
......
......@@ -12,14 +12,14 @@ namespace hpp {
namespace gui {
inline void fromHPP(const hpp::floatSeq_var& in, osgVector3& v)
{
typedef graphics::WindowsManager::value_type type;
typedef gepetto::viewer::WindowsManager::value_type type;
const hpp::floatSeq& t (in.in());
v.set((type)t[0], (type)t[1], (type)t[2]);
}
inline void fromHPP(const hpp::Transform__slice* t, osgVector3& v)
{
typedef graphics::WindowsManager::value_type type;
typedef gepetto::viewer::WindowsManager::value_type type;
v.set((type)t[0], (type)t[1], (type)t[2]);
}
......@@ -30,7 +30,7 @@ namespace hpp {
inline void fromHPP(const hpp::Transform__slice* t, osgQuat& q)
{
typedef graphics::WindowsManager::value_type type;
typedef gepetto::viewer::WindowsManager::value_type type;
q.set((type)t[3], (type)t[4], (type)t[5], (type)t[6]);
}
......@@ -39,18 +39,18 @@ namespace hpp {
fromHPP (in.in(), q);
}
inline void fromHPP(const hpp::Transform__slice* in, graphics::Configuration& c)
inline void fromHPP(const hpp::Transform__slice* in, gepetto::viewer::Configuration& c)
{
fromHPP(in, c.position);
fromHPP(in, c.quat);
}
inline void fromHPP(const hpp::Transform__var& in, graphics::Configuration& c)
inline void fromHPP(const hpp::Transform__var& in, gepetto::viewer::Configuration& c)
{
fromHPP(in.in(), c);
}
inline void fromHPP(const hpp::TransformSeq& in, std::vector<graphics::Configuration>& c)
inline void fromHPP(const hpp::TransformSeq& in, std::vector<gepetto::viewer::Configuration>& c)
{
c.resize (in.length());
for (std::size_t i = 0; i < in.length(); ++i)
......
......@@ -36,8 +36,8 @@ using CORBA::ULong;
namespace hpp {
namespace gui {
using gepetto::gui::MainWindow;
typedef graphics::WindowsManager::Color_t OsgColor_t;
typedef graphics::Configuration OsgConfiguration_t;
typedef gepetto::viewer::WindowsManager::Color_t OsgColor_t;
typedef gepetto::viewer::Configuration OsgConfiguration_t;
typedef gepetto::gui::ActionSearchBar ActionSearchBar;
HppWidgetsPlugin::JointElement::JointElement (
......@@ -249,18 +249,6 @@ namespace hpp {
return c;
}
bool HppWidgetsPlugin::corbaException(int jobId, const CORBA::Exception &excep) const
{
try {
const hpp::Error& error = dynamic_cast <const hpp::Error&> (excep);
emit logJobFailed(jobId, QString (error.msg));
return true;
} catch (const std::bad_cast&) {
// dynamic_cast failed.
}
return false;
}
QString HppWidgetsPlugin::getHppIIOPurl () const
{
QString host = gepetto::gui::MainWindow::instance ()->settings_->getSetting
......@@ -603,7 +591,7 @@ namespace hpp {
{
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
std::string target = escapeJointName(jn);
graphics::GroupNodePtr_t group = main->osg()->getGroup (target.c_str(), false);
gepetto::viewer::GroupNodePtr_t group = main->osg()->getGroup (target.c_str(), false);
if (group) return target;
if (!main->osg()->getGroup(target)) {
main->osg()->createGroup(target);
......@@ -625,7 +613,7 @@ namespace hpp {
{
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
std::string target = "com_" + escapeJointName(com);
graphics::GroupNodePtr_t group = main->osg()->getGroup (target.c_str(), false);
gepetto::viewer::GroupNodePtr_t group = main->osg()->getGroup (target.c_str(), false);
if (group) return target;
if (!main->osg()->getGroup(target)) {
main->osg()->createGroup(target);
......
......@@ -27,12 +27,12 @@ namespace hpp {
/// Plugin that add a lot of features to work with hpp.
class HppWidgetsPlugin : public QObject, public gepetto::gui::PluginInterface,
public gepetto::gui::ModelInterface, public gepetto::gui::CorbaInterface
public gepetto::gui::ModelInterface, public gepetto::gui::ConnectionInterface
{
Q_OBJECT
Q_INTERFACES (gepetto::gui::PluginInterface
gepetto::gui::ModelInterface
gepetto::gui::CorbaInterface)
gepetto::gui::ConnectionInterface)
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
Q_PLUGIN_METADATA (IID "hpp-gui.hppwidgetsplugin")
......@@ -113,10 +113,8 @@ signals:
void configurationValidationStatus (bool valid);
void configurationValidationStatus (QStringList collision);
// CorbaInterface interface
// ConnectionInterface interface
public:
virtual bool corbaException (int jobId, const CORBA::Exception &excep) const;
/// Open a connection to a corba server.
virtual void openConnection ();
......@@ -239,7 +237,7 @@ signals:
// Cache variables
hpp::Names_t linkNames_;
std::vector<std::string> bodyNames_;
std::vector<graphics::Configuration> bodyConfs_;
std::vector<gepetto::viewer::Configuration> bodyConfs_;
std::vector<std::string> jointGroupNames_;
};
} // namespace gui
......
......@@ -26,7 +26,7 @@ namespace hpp {
{
public:
typedef CORBA::ULong ULong;
typedef graphics::NodePtr_t NodePtr_t;
typedef gepetto::viewer::NodePtr_t NodePtr_t;
typedef std::vector<NodePtr_t> NodesPtr_t;
static const int IndexRole ;
......
......@@ -94,7 +94,7 @@ namespace hpp {
// Arguments are max, length, storage, take ownership.
char* tmps[1];
hpp::Names_t names (1, 1, tmps, false);
graphics::Configuration pos;
gepetto::viewer::Configuration pos;
::osg::Vec3ArrayRefPtr posSeq = new ::osg::Vec3Array;
for (unsigned int i = 0; i < waypoints->length(); ++i) {
// Make name
......@@ -138,7 +138,7 @@ namespace hpp {
CORBA::ULong pid = (CORBA::ULong) pathIndex()->value();
std::stringstream ss; ss << "curvedpath_" << pid << "_" << jointName;
std::string pn = ss.str();
graphics::WindowsManager::Color_t colorE (1.f, 0.f, 0.f, 1.f);
gepetto::viewer::WindowsManager::Color_t colorE (1.f, 0.f, 0.f, 1.f);
gepetto::gui::WindowsManagerPtr_t wsm = main->osg();
HppWidgetsPlugin::HppClient* hpp = plugin_->client();
CORBA::Double length = hpp->problem()->pathLength(pid);
......
......@@ -17,9 +17,9 @@ namespace hpp {
public:
typedef unsigned int NodeID;
typedef unsigned int EdgeID;
typedef graphics::Configuration Frame;
typedef gepetto::viewer::Configuration Frame;
typedef osgVector3 Position;
typedef graphics::WindowsManager::Color_t Color;
typedef gepetto::viewer::WindowsManager::Color_t Color;
float radius, axisSize;
......
......@@ -47,7 +47,7 @@ namespace hpp {
this, SLOT (updateJointAttitude (double, double, double, double)));
gepetto::gui::MainWindow* m = gepetto::gui::MainWindow::instance();
graphics::WindowsManager::Color_t black(1,1,1,1);
gepetto::viewer::WindowsManager::Color_t black(1,1,1,1);
m->osg()->addBox("hpp-gui/attitudeControl", 0.001f, 0.001f, 0.001f, black);
m->osg()->addLandmark("hpp-gui/attitudeControl", 0.1f);
m->osg()->setVisibility("hpp-gui/attitudeControl", "OFF");
......
......@@ -79,7 +79,7 @@ namespace hpp {
hpp::Quaternion_ q;
hpp::boolSeq_var mask;
graphics::Configuration frameViz;
gepetto::viewer::Configuration frameViz;
QFuture <void> lock_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment