Flatland
model_dialog.h
1 /*
2  * ______ __ __ __
3  * /\ _ \ __ /\ \/\ \ /\ \__
4  * \ \ \L\ \ __ __ /\_\ \_\ \ \ \____ ___\ \ ,_\ ____
5  * \ \ __ \/\ \/\ \\/\ \ /'_` \ \ '__`\ / __`\ \ \/ /',__\
6  * \ \ \/\ \ \ \_/ |\ \ \/\ \L\ \ \ \L\ \/\ \L\ \ \ \_/\__, `\
7  * \ \_\ \_\ \___/ \ \_\ \___,_\ \_,__/\ \____/\ \__\/\____/
8  * \/_/\/_/\/__/ \/_/\/__,_ /\/___/ \/___/ \/__/\/___/
9  * @copyright Copyright 2017 Avidbots Corp.
10  * @name model_dialog.h
11  * @brief Main window and toolbars for flatland_viz
12  * @author Joseph Duchesne
13  * @author Mike Brousseau
14  *
15  * Software License Agreement (BSD License)
16  *
17  * Copyright (c) 2017, Avidbots Corp.
18  * All rights reserved.
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions
22  * are met:
23  *
24  * * Redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer.
26  * * Redistributions in binary form must reproduce the above
27  * copyright notice, this list of conditions and the following
28  * disclaimer in the documentation and/or other materials provided
29  * with the distribution.
30  * * Neither the name of the Avidbots Corp. nor the names of its
31  * contributors may be used to endorse or promote products derived
32  * from this software without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
37  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
38  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
39  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
40  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
41  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
44  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45  * POSSIBILITY OF SUCH DAMAGE.
46  */
47 
48 #ifndef MODEL_DIALOG_H
49 #define MODEL_DIALOG_H
50 
51 #include <QDialog>
52 #include <QLineEdit>
53 #include <QPushButton>
54 #include <QWidget>
55 
56 #include <flatland_msgs/SpawnModel.h>
57 #include <flatland_server/timekeeper.h>
58 #include <flatland_server/world.h>
59 #include <gtest/gtest.h>
60 #include <ros/ros.h>
61 #include <boost/filesystem.hpp>
62 #include <iostream>
63 #include <regex>
64 //#include <thread>
65 #include <flatland_viz/model_dialog.h>
66 #include <signal.h>
67 
68 class QCheckBox;
69 class QLabel;
70 class QErrorMessage;
71 
72 class DialogOptionsWidget;
73 
74 namespace fs = boost::filesystem;
75 using namespace flatland_server;
76 
77 class ModelDialog : public QDialog {
78  Q_OBJECT
79 
80  public:
81  static QColor saved_color_;
82 
83  ModelDialog(QWidget* parent = 0);
84 
85  private Q_SLOTS:
90  void SetColor();
95  void CancelButtonClicked();
100  void OkButtonClicked();
105  QString SelectFile();
112  void SetButtonColor(const QColor* c, QPushButton* b);
118  void SpawnModelClient();
119 
120  private:
121  QPushButton* color_button;
122  QString path_to_model_file;
123  QLineEdit *x_edit, *y_edit, *a_edit, *n_edit;
124 
125  protected:
126  boost::filesystem::path this_file_dir;
127  ros::NodeHandle nh;
128  ros::ServiceClient client;
129  flatland_msgs::SpawnModel srv;
130  World* w;
131 };
132 
133 #endif
Definition: body.h:55
Definition: model_dialog.h:77
Definition: world.h:69