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 #pragma once
38 
39 #include <QAbstractTableModel>
40 #include <srdfdom/srdf_writer.h>
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(const srdf::SRDFWriterPtr& srdf, const std::vector<std::string>& names,
53  QObject* parent = nullptr);
54  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
55  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
56  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
58 
59  // for editing
60  Qt::ItemFlags flags(const QModelIndex& index) const override;
61  bool setData(const QModelIndex& /*index*/, const QVariant& value, int role) override;
62  void setEnabled(const QItemSelection& selection, bool value);
63  void setEnabled(const QModelIndexList& indexes, bool value);
64 
65 public Q_SLOTS:
66  void setFilterRegExp(const QString& filter);
67 
68 private:
69  bool disabledByDefault(const std::string& link1, const std::string& link2) const;
70 
71 private:
73  const std::vector<std::string> std_names; // names of links
74  QList<QString> q_names; // names of links
75  QList<int> visual_to_index; // map from visual index to actual index
76 };
CollisionMatrixModel
Definition: collision_matrix_model.h:48
CollisionMatrixModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Definition: collision_matrix_model.cpp:260
CollisionMatrixModel::setFilterRegExp
void setFilterRegExp(const QString &filter)
Definition: collision_matrix_model.cpp:247
CollisionMatrixModel::setEnabled
void setEnabled(const QItemSelection &selection, bool value)
Definition: collision_matrix_model.cpp:219
CollisionMatrixModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: collision_matrix_model.cpp:70
CollisionMatrixModel::setData
bool setData(const QModelIndex &, const QVariant &value, int role) override
Definition: collision_matrix_model.cpp:155
CollisionMatrixModel::disabledByDefault
bool disabledByDefault(const std::string &link1, const std::string &link2) const
Definition: collision_matrix_model.cpp:103
compute_default_collisions.h
value
float value
CollisionMatrixModel::std_names
const std::vector< std::string > std_names
Definition: collision_matrix_model.h:73
CollisionMatrixModel::q_names
QList< QString > q_names
Definition: collision_matrix_model.h:74
CollisionMatrixModel::visual_to_index
QList< int > visual_to_index
Definition: collision_matrix_model.h:75
CollisionMatrixModel::srdf
srdf::SRDFWriterPtr srdf
Definition: collision_matrix_model.h:72
srdf
index
unsigned int index
srdf_writer.h
CollisionMatrixModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: collision_matrix_model.cpp:267
CollisionMatrixModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition: collision_matrix_model.cpp:111
CollisionMatrixModel::CollisionMatrixModel
CollisionMatrixModel(const srdf::SRDFWriterPtr &srdf, const std::vector< std::string > &names, QObject *parent=nullptr)
Definition: collision_matrix_model.cpp:58
CollisionMatrixModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition: collision_matrix_model.cpp:75
srdf::SRDFWriterPtr
std::shared_ptr< SRDFWriter > SRDFWriterPtr


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04