collision_matrix_model.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2016, CITEC, 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 Willow Garage 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 #ifndef MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_COLLISION_MATRIX_MODEL_
38 #define MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_COLLISION_MATRIX_MODEL_
39 
40 #include <QAbstractTableModel>
41 
42 #ifndef Q_MOC_RUN
44 #endif
45 
46 class QItemSelection;
47 
48 class CollisionMatrixModel : public QAbstractTableModel
49 {
50  Q_OBJECT
51 public:
52  CollisionMatrixModel(moveit_setup_assistant::LinkPairMap& pairs, const std::vector<std::string>& names,
53  QObject* parent = NULL);
54  int rowCount(const QModelIndex& parent = QModelIndex()) const;
55  int columnCount(const QModelIndex& parent = QModelIndex()) const;
56  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
58  moveit_setup_assistant::DisabledReason reason(const QModelIndex& index) const;
59 
60  // for editing
61  Qt::ItemFlags flags(const QModelIndex& index) const;
62  bool setData(const QModelIndex&, const QVariant& value, int role);
63  void setEnabled(const QItemSelection& selection, bool value);
64  void setEnabled(const QModelIndexList& indexes, bool value);
65 
66 public Q_SLOTS:
67  void setFilterRegExp(const QString& filter);
68 
69 private:
70  moveit_setup_assistant::LinkPairMap::iterator item(const QModelIndex& index);
71  moveit_setup_assistant::LinkPairMap::const_iterator item(const QModelIndex& index) const
72  {
73  return const_cast<CollisionMatrixModel*>(this)->item(index);
74  }
75 
76 private:
78  const std::vector<std::string> std_names; // names of links
79  QList<QString> q_names; // names of links
80  QList<int> visual_to_index; // map from visual index to actual index
81 };
82 
83 #endif // MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_COLLISION_MATRIX_MODEL_
moveit_setup_assistant::LinkPairMap & pairs
#define NULL
moveit_setup_assistant::LinkPairMap::const_iterator item(const QModelIndex &index) const
CollisionMatrixModel(moveit_setup_assistant::LinkPairMap &pairs, const std::vector< std::string > &names, QObject *parent=NULL)
bool setData(const QModelIndex &, const QVariant &value, int role)
Qt::ItemFlags flags(const QModelIndex &index) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
unsigned int index
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
DisabledReason
Reasons for disabling link pairs. Append "in collision" for understanding. NOT_DISABLED means the lin...
const std::vector< std::string > std_names
int columnCount(const QModelIndex &parent=QModelIndex()) const
void setFilterRegExp(const QString &filter)
moveit_setup_assistant::LinkPairMap::iterator item(const QModelIndex &index)
void setEnabled(const QItemSelection &selection, bool value)
std::map< std::pair< std::string, std::string >, LinkPairData > LinkPairMap
LinkPairMap is an adjacency list structure containing links in string-based form. Used for disabled l...
moveit_setup_assistant::DisabledReason reason(const QModelIndex &index) const


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Wed Jul 10 2019 04:04:33