local_task_model.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2017, Bielefeld University
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Bielefeld University nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Robert Haschke */
36 
37 #pragma once
38 
39 #include "task_list_model.h"
41 
42 namespace moveit_rviz_plugin {
43 
44 class LocalTaskModel : public BaseTaskModel, public moveit::task_constructor::Task
45 {
46  Q_OBJECT
48  Node* root_;
50  std::map<Node*, rviz::PropertyTreeModel*> properties_;
51 
52  inline Node* node(const QModelIndex& index) const;
53  QModelIndex index(Node* n) const;
54 
55 public:
56  LocalTaskModel(ContainerBase::pointer&& container, const planning_scene::PlanningSceneConstPtr& scene,
57  rviz::DisplayContext* display_context, QObject* parent = nullptr);
58  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
59 
60  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
61  QModelIndex parent(const QModelIndex& index) const override;
62 
63  Qt::ItemFlags flags(const QModelIndex& index) const override;
64  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
65  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
66 
67  bool removeRows(int row, int count, const QModelIndex& parent) override;
68 
70  void setStageFactory(const StageFactoryPtr& factory) override;
71  bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
72  const QModelIndex& parent) override;
73 
74  QModelIndex indexFromStageId(size_t id) const override;
75 
76  QAbstractItemModel* getSolutionModel(const QModelIndex& index) override;
77  DisplaySolutionPtr getSolution(const QModelIndex& index) override;
78 
79  rviz::PropertyTreeModel* getPropertyModel(const QModelIndex& index) override;
80 };
81 } // namespace moveit_rviz_plugin
moveit_rviz_plugin::LocalTaskModel::getSolutionModel
QAbstractItemModel * getSolutionModel(const QModelIndex &index) override
get solution model for given stage index
Definition: local_task_model.cpp:228
moveit_rviz_plugin::LocalTaskModel::stage_factory_
StageFactoryPtr stage_factory_
Definition: local_task_model.h:113
moveit::task_constructor::Stage::parent
const ContainerBase * parent() const
moveit_rviz_plugin::LocalTaskModel::LocalTaskModel
LocalTaskModel(ContainerBase::pointer &&container, const planning_scene::PlanningSceneConstPtr &scene, rviz::DisplayContext *display_context, QObject *parent=nullptr)
Definition: local_task_model.cpp:80
moveit_rviz_plugin::LocalTaskModel::Node
moveit::task_constructor::Stage Node
Definition: local_task_model.h:111
rviz::PropertyTreeModel
moveit_rviz_plugin::LocalTaskModel::root_
Node * root_
Definition: local_task_model.h:112
moveit_rviz_plugin::LocalTaskModel::getPropertyModel
rviz::PropertyTreeModel * getPropertyModel(const QModelIndex &index) override
get property model for given stage index
Definition: local_task_model.cpp:238
moveit_rviz_plugin::LocalTaskModel::setStageFactory
void setStageFactory(const StageFactoryPtr &factory) override
providing a StageFactory makes the model accepting drops
Definition: local_task_model.cpp:195
moveit_rviz_plugin::LocalTaskModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition: local_task_model.cpp:142
moveit::task_constructor::Stage
moveit::task_constructor::Task
moveit_rviz_plugin::StageFactoryPtr
std::shared_ptr< StageFactory > StageFactoryPtr
Definition: task_list_model.h:66
moveit_rviz_plugin::LocalTaskModel::getSolution
DisplaySolutionPtr getSolution(const QModelIndex &index) override
get solution for given solution index
Definition: local_task_model.cpp:233
task.h
moveit_rviz_plugin::LocalTaskModel::properties_
std::map< Node *, rviz::PropertyTreeModel * > properties_
Definition: local_task_model.h:114
moveit_rviz_plugin::LocalTaskModel::dropMimeData
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Definition: local_task_model.cpp:199
rviz::DisplayContext
moveit_rviz_plugin::LocalTaskModel::indexFromStageId
QModelIndex indexFromStageId(size_t id) const override
retrieve model index associated with given stage id
Definition: local_task_model.cpp:223
moveit_rviz_plugin::LocalTaskModel::removeRows
bool removeRows(int row, int count, const QModelIndex &parent) override
Definition: local_task_model.cpp:177
moveit_rviz_plugin
moveit_rviz_plugin::LocalTaskModel::node
Node * node(const QModelIndex &index) const
Definition: local_task_model.cpp:51
task_list_model.h
moveit_rviz_plugin::LocalTaskModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: local_task_model.cpp:131
moveit_rviz_plugin::LocalTaskModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: local_task_model.cpp:87
moveit_rviz_plugin::LocalTaskModel::index
QModelIndex index(Node *n) const
Definition: local_task_model.cpp:61
moveit_rviz_plugin::LocalTaskModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition: local_task_model.cpp:163


visualization
Author(s): Robert Haschke
autogenerated on Thu Feb 27 2025 03:39:51