planning_groups_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
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: Dave Coleman */
36 
37 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_PLANNING_GROUPS_WIDGET_
38 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_PLANNING_GROUPS_WIDGET_
39 
40 // Qt
41 #include <QWidget>
42 #include <QTreeWidget>
43 #include <QSplitter>
44 #include <QStackedLayout>
45 
46 // Setup Asst
47 #ifndef Q_MOC_RUN
49 #endif
50 
51 #include "double_list_widget.h" // for joints, links and subgroups pages
52 #include "kinematic_chain_widget.h" // for kinematic chain page
53 #include "group_edit_widget.h" // for group rename page
54 #include "setup_screen_widget.h" // a base class for screens in the setup assistant
55 
56 // Forward Declaration (outside of namespace for Qt)
57 class PlanGroupType;
58 
59 namespace moveit_setup_assistant
60 {
61 // Custom Type
63 {
69 };
70 
71 // ******************************************************************************************
72 // ******************************************************************************************
73 // CLASS
74 // ******************************************************************************************
75 // ******************************************************************************************
77 {
78  Q_OBJECT
79 
80 public:
81  // ******************************************************************************************
82  // Public Functions
83  // ******************************************************************************************
84 
85  PlanningGroupsWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data);
86 
87  void changeScreen(int index);
88 
90  virtual void focusGiven();
91 
92 private Q_SLOTS:
93 
94  // ******************************************************************************************
95  // Slot Event Functions
96  // ******************************************************************************************
97 
99  void loadGroupsTree();
100 
102  void previewSelected();
103 
105  void editSelected();
106 
108  void addGroup();
109 
111  void saveJointsScreen();
112  void saveLinksScreen();
113  void saveChainScreen();
114  void saveSubgroupsScreen();
115  void saveGroupScreenEdit();
116  void saveGroupScreenJoints();
117  void saveGroupScreenLinks();
118  void saveGroupScreenChain();
120 
121  // Delete a group
122  void deleteGroup();
123 
125  void cancelEditing();
126 
128  void alterTree(const QString& link);
129 
131  void previewSelectedLink(std::vector<std::string> links);
132 
134  // void previewClickedJoint( std::string name );
135  void previewSelectedJoints(std::vector<std::string> joints);
136 
138  void previewSelectedSubgroup(std::vector<std::string> groups);
139 
140 private:
141  // ******************************************************************************************
142  // Qt Components
143  // ******************************************************************************************
144 
146  QTreeWidget* groups_tree_;
147 
149  QStackedLayout* stacked_layout_;
150 
152  QPushButton* btn_edit_;
153 
154  QPushButton* btn_delete_;
155 
156  // Stacked Layout SUBPAGES -------------------------------------------
157 
164 
165  // ******************************************************************************************
166  // Variables
167  // ******************************************************************************************
168 
170  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
171 
173  std::string current_edit_group_;
174 
177 
180 
181  // ******************************************************************************************
182  // Private Functions
183  // ******************************************************************************************
184 
186  QWidget* createContentsWidget();
187 
189  void loadGroupsTreeRecursive(srdf::Model::Group& group_it, QTreeWidgetItem* parent);
190 
191  // Convenience function for getting a group pointer
192  srdf::Model::Group* findGroupByName(const std::string& name);
193 
194  // Load edit screen
195  void loadJointsScreen(srdf::Model::Group* this_group);
196  void loadLinksScreen(srdf::Model::Group* this_group);
197  void loadChainScreen(srdf::Model::Group* this_group);
198  void loadSubgroupsScreen(srdf::Model::Group* this_group);
199  void loadGroupScreen(srdf::Model::Group* this_group);
200 
201  // Save group screen
202  bool saveGroupScreen();
203 
205  void showMainScreen();
206 };
207 }
208 
209 // ******************************************************************************************
210 // ******************************************************************************************
211 // Metatype Class For Holding Points to Group Parts
212 // ******************************************************************************************
213 // ******************************************************************************************
214 
216 {
217 public:
218  // explicit PlanGroupType();
220  {
221  }
223  virtual ~PlanGroupType()
224  {
225  ;
226  }
227 
229 
231 };
232 
234 
235 #endif
void showMainScreen()
Switch to current groups view.
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
virtual void focusGiven()
Received when this widget is chosen from the navigation menu.
Q_DECLARE_METATYPE(PlanGroupType)
QStackedLayout * stacked_layout_
For changing between table and different add/edit views.
void cancelEditing()
Call when edit screen is canceled.
PlanningGroupsWidget(QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data)
std::string current_edit_group_
Remember what group we are editing when an edit screen is being shown.
void loadLinksScreen(srdf::Model::Group *this_group)
srdf::Model::Group * findGroupByName(const std::string &name)
void loadGroupsTree()
Displays data in the link_pairs_ data structure into a QtTableWidget.
void previewSelectedSubgroup(std::vector< std::string > groups)
Called from Double List widget to highlight a subgroup.
void alterTree(const QString &link)
Called when user clicks link part of bottom left label.
void loadGroupScreen(srdf::Model::Group *this_group)
QTreeWidget * groups_tree_
Main table for holding groups.
QWidget * createContentsWidget()
Builds the main screen list widget.
void loadGroupsTreeRecursive(srdf::Model::Group &group_it, QTreeWidgetItem *parent)
Recursively build the SRDF tree.
srdf::Model::Group * group_
group
unsigned int index
void editSelected()
Edit whatever element is selected in the tree view.
GroupType current_edit_element_
Remember what group element we are editing when an edit screen is being shown.
void previewSelectedJoints(std::vector< std::string > joints)
Called from Double List widget to highlight a joint.
bool adding_new_group_
Remember whethere we&#39;re editing a group or adding a new one.
void loadSubgroupsScreen(srdf::Model::Group *this_group)
void loadJointsScreen(srdf::Model::Group *this_group)
void previewSelected()
Highlight the group of whatever element is selected in the tree view.
void loadChainScreen(srdf::Model::Group *this_group)
void saveJointsScreen()
Call when screen is done being edited.
void previewSelectedLink(std::vector< std::string > links)
Called from Double List widget to highlight a link.
groups
QPushButton * btn_edit_
Show and hide edit button.
moveit_setup_assistant::GroupType type_


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