Commit fb49601c authored by Joseph Mirabel's avatar Joseph Mirabel

Remove ManipulationNCPicker

parent d9ffff2e
......@@ -32,7 +32,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
hppmanipulationwidgetsplugin.hh
linkwidget.hh
manipulationconstraintwidget.hh
manipulationncpicker.hh
HEADERS_NO_MOC
roadmap.hh
......@@ -45,7 +44,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
roadmap.cc
linkwidget.cc
manipulationconstraintwidget.cc
manipulationncpicker.cc
LINK_DEPENDENCIES
hppwidgetsplugin
......
......@@ -6,7 +6,6 @@
#include "hppmanipulationwidgetsplugin/hppmanipulationwidgetsplugin.hh"
#include "hppwidgetsplugin/ui_constraintwidget.h"
#include "hppmanipulationwidgetsplugin/manipulationncpicker.hh"
#include "manipulationconstraintwidget.hh"
namespace hpp {
......@@ -24,16 +23,6 @@ namespace hpp {
{
}
void ManipulationConstraintWidget::refresh()
{
HppManipulationWidgetsPlugin* plugin = dynamic_cast<HppManipulationWidgetsPlugin*>(plugin_);
ConstraintWidget::refresh();
hpp::Names_t_var names = plugin->client()->problem()->getAvailable("lockedjoint");
for (unsigned i = 0; i < names->length(); i++) {
ui->nameList->addItem(names[i].in());
}
}
void ManipulationConstraintWidget::reset()
{
HppManipulationWidgetsPlugin* plugin = dynamic_cast<HppManipulationWidgetsPlugin*>(plugin_);
......@@ -48,13 +37,5 @@ namespace hpp {
plugin->manipClient()->graph()->resetConstraints(graphElems->nodes[i].id);
}
}
void ManipulationConstraintWidget::confirmNumerical()
{
HppManipulationWidgetsPlugin* plugin = dynamic_cast<HppManipulationWidgetsPlugin*>(plugin_);
ManipulationNCPicker* ncp = new ManipulationNCPicker(plugin);
ncp->show();
}
}
}
......@@ -18,14 +18,9 @@ namespace hpp {
ManipulationConstraintWidget(HppWidgetsPlugin* plugin, QWidget* parent = 0);
virtual ~ManipulationConstraintWidget();
public slots:
virtual void refresh();
private slots:
virtual void applyConstraints();
virtual void reset();
virtual void confirmNumerical();
protected:
};
}
......
//
// Copyright (c) CNRS
// Authors: Joseph Mirabel and Heidy Dallard
//
#include <hppmanipulationwidgetsplugin/hppmanipulationwidgetsplugin.hh>
#include "hppwidgetsplugin/ui_numericalconstraintpicker.h"
#include "manipulationncpicker.hh"
namespace hpp {
namespace gui {
ManipulationNCPicker::ManipulationNCPicker(HppManipulationWidgetsPlugin* plugin,
QWidget* parent)
: NumericalConstraintPicker(plugin, parent)
{
listComp_ = new QListWidget(this);
hpp::GraphComp_var graphComp;
hpp::GraphElements_var graphElems;
plugin->manipClient()->graph()->getGraph(graphComp.out(), graphElems.out());
components_[graphComp->name.in()] = graphComp;
listComp_->addItem(graphComp->name.in());
for (unsigned i = 0; i < graphElems->nodes.length(); ++i) {
if (graphElems->nodes[i].id > graphComp->id) {
components_[graphElems->nodes[i].name.in()] = graphElems->nodes[i];
listComp_->addItem(graphElems->nodes[i].name.in());
}
}
for (unsigned i = 0; i < graphElems->edges.length(); ++i) {
if (graphElems->edges[i].id > graphComp->id) {
components_[graphElems->edges[i].name.in()] = graphElems->edges[i];
listComp_->addItem(graphElems->edges[i].name.in());
}
}
listComp_->setSelectionMode(QAbstractItemView::ExtendedSelection);
QBoxLayout* l = dynamic_cast<QBoxLayout *>(layout());
l->insertWidget(2, new QLabel("Select on which graph components you want to apply constraints.\n"
"The constraints will be automatically applied to all the components under the one you choose."));
l->insertWidget(3, listComp_);
}
ManipulationNCPicker::~ManipulationNCPicker()
{
}
void ManipulationNCPicker::onConfirmClicked()
{
QList<QListWidgetItem*> lj = ui->lockedJointList->selectedItems();
QList<QListWidgetItem*> nc = ui->numericalList->selectedItems();
hpp::Names_t_var constraints = new hpp::Names_t;
hpp::Names_t_var locked = new hpp::Names_t;
hpp::Names_t_var dofs = new hpp::Names_t;
QList<QListWidgetItem*> selectedComp = listComp_->selectedItems();
HppManipulationWidgetsPlugin* plugin = dynamic_cast<HppManipulationWidgetsPlugin*>(plugin_);
constraints->length(nc.count());
locked->length(lj.count());
int i = 0;
foreach (QListWidgetItem* item, lj) {
locked[i] = item->text().toStdString().c_str();
++i;
}
i = 0;
foreach (QListWidgetItem* item, nc) {
constraints[i] = item->text().toStdString().c_str();
++i;
}
foreach (QListWidgetItem* item, selectedComp) {
if (constraints->length())
plugin->manipClient()->graph()->setNumericalConstraints(components_[item->text().toStdString()].id,
constraints.in(), dofs.in());
if (locked->length())
plugin->manipClient()->graph()->setLockedDofConstraints(components_[item->text().toStdString()].id,
locked.in());
}
onCancelClicked();
}
}
}
//
// Copyright (c) CNRS
// Authors: Joseph Mirabel and Heidy Dallard
//
#ifndef MANIPULATIONNCPICKER_HH
#define MANIPULATIONNCPICKER_HH
#include <hpp/corbaserver/manipulation/graph-idl.hh>
#include "hppwidgetsplugin/numericalconstraintpicker.hh"
namespace hpp {
namespace gui {
class HppManipulationWidgetsPlugin;
class ManipulationNCPicker : public NumericalConstraintPicker
{
Q_OBJECT
private slots:
virtual void onConfirmClicked();
public:
ManipulationNCPicker(HppManipulationWidgetsPlugin* plugin,
QWidget* parent = 0);
virtual ~ManipulationNCPicker();
protected:
std::map<std::string, GraphComp> components_;
QListWidget* listComp_;
};
}
}
#endif // MANIPULATIONNCPICKER_HH
......@@ -100,6 +100,10 @@ namespace hpp {
for (unsigned i = 0; i < nc->length(); i++) {
ui->nameList->addItem(nc[i].in());
}
hpp::Names_t_var lj = plugin_->client()->problem()->getAvailable("LockedJoint");
for (unsigned i = 0; i < lj->length(); i++) {
ui->nameList->addItem(lj[i].in());
}
}
void ConstraintWidget::createConstraint()
......
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