ObjectClassEditDialog.cpp
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package MemoryX::MemoryX::PriorMemoryEditorPlugin
17* @author Alexey Kozlov (kozlov at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
24
25#include <SimoxUtility/algorithm/string/string_tools.h>
26
27#include <MemoryX/gui-plugins/PriorMemoryEditor/ui_ObjectClassEditDialog.h>
31
32using namespace memoryx;
33using namespace memoryx::EntityWrappers;
34
37 QWidget* parent) :
38 EntityEditDialog(parent),
40 robotStateComponent(robotStateComponent)
41{
42 // set up general UI
43 ui->setupUi(this);
45
46 // construct and add attribute tabs
47 recognitionAttributesEditTab = new RecognitionAttributesEditTab();
48 ui->tabWidget->addTab(recognitionAttributesEditTab, "Recognition");
49
50 manipulationAttributesEditTab = new ManipulationAttributesEditTab(robotStateComponent);
51 ui->tabWidget->addTab(manipulationAttributesEditTab, "Manipulation");
52
53 motionAttributesEditTab = new MotionAttributesEditTab();
54 ui->tabWidget->addTab(motionAttributesEditTab, "Motion");
55}
56
61
62void
64{
65 ui->editClassName->setReadOnly(!editable);
66}
67
68void
70{
71 ObjectClassPtr objectClass = ObjectClassPtr::dynamicCast(entity);
72
73 // fill dialog (with default attributes)
74 ui->editClassName->setText(QString::fromStdString(objectClass->getName()));
75 NameList parents = objectClass->getParentClasses();
76 std::string parentsStr = simox::alg::join(parents, ",");
77 ui->editParentClasses->setText(QString::fromStdString(parentsStr));
78 bool isInstanceable = objectClass->isInstanceable();
79 ui->checkBoxIsInstanceable->setChecked(isInstanceable);
80
81 // update tabs
82 manipulationAttributesEditTab->updateGui(entity);
83 recognitionAttributesEditTab->updateGui(entity);
84 motionAttributesEditTab->updateGui(entity);
85}
86
87void
88ObjectClassEditDialog::updateEntity(const EntityPtr& entity, std::string filesDBName)
89{
90 ObjectClassPtr objectClass = ObjectClassPtr::dynamicCast(entity);
91
92 // update default attributes
93 objectClass->setName(ui->editClassName->text().toStdString());
94 objectClass->clearParentClasses();
95 std::string parentsStr = ui->editParentClasses->text().toStdString();
96 NameList parents = simox::alg::split(parentsStr, ",");
97
98 for (NameList::const_iterator it = parents.begin(); it != parents.end(); ++it)
99 {
100 objectClass->addParentClass(*it);
101 }
102
103 objectClass->setInstanceable(ui->checkBoxIsInstanceable->isChecked());
104
105 // update from tabs
106 manipulationAttributesEditTab->updateEntity(entity, filesDBName);
107 recognitionAttributesEditTab->updateEntity(entity, filesDBName);
108 motionAttributesEditTab->updateEntity(entity, filesDBName);
109}
EntityEditDialog(QWidget *parent=0)
This tab allows to change the simox attributes of an objectclass entity.
This tab allows to change the motion model attributes of an objectclass entity.
ObjectClassEditDialog(armarx::RobotStateComponentInterfacePrx robotStateComponent, QWidget *parent=0)
void updateEntity(const EntityPtr &entity, std::string filesDBName) override
Pure virtual method.
void updateGui(const EntityPtr &entity) override
Pure virtual method.
This tab allows to change the recognition attributes of an objectclass entity.
ArmarX Headers.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
VirtualRobot headers.
IceInternal::Handle< ObjectClass > ObjectClassPtr
Definition ObjectClass.h:35
IceInternal::Handle< Entity > EntityPtr
Typedef of EntityPtr as IceInternal::Handle<Entity> for convenience.
Definition Entity.h:45