select_topic_dialog.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 #ifndef MAPVIZ_SELECT_TOPIC_DIALOG_H_
00030 #define MAPVIZ_SELECT_TOPIC_DIALOG_H_
00031 
00032 #include <set>
00033 #include <string>
00034 #include <vector>
00035 
00036 #include <QDialog>
00037 
00038 #include <ros/master.h>
00039 
00040 QT_BEGIN_NAMESPACE
00041 class QLineEdit;
00042 class QListWidget;
00043 class QPushButton;
00044 QT_END_NAMESPACE
00045 
00046 namespace mapviz
00047 {
00053 class SelectTopicDialog : public QDialog
00054 {
00055   Q_OBJECT;
00056 
00057  public:
00067   static ros::master::TopicInfo selectTopic(
00068     const std::string &datatype,
00069     QWidget *parent=0);
00070 
00079   static ros::master::TopicInfo selectTopic(
00080     const std::string &datatype1,
00081     const std::string &datatype2,
00082     QWidget *parent=0);
00083 
00091   static ros::master::TopicInfo selectTopic(
00092     const std::vector<std::string> &datatypes,
00093     QWidget *parent=0);
00094   
00103   static std::vector<ros::master::TopicInfo> selectTopics(
00104     const std::string &datatype,
00105     QWidget *parent=0);
00106 
00115   static std::vector<ros::master::TopicInfo> selectTopics(
00116     const std::string &datatype1,
00117     const std::string &datatype2,
00118     QWidget *parent=0);
00119 
00126   static std::vector<ros::master::TopicInfo> selectTopics(
00127     const std::vector<std::string> &datatypes,
00128     QWidget *parent=0);
00129 
00133   SelectTopicDialog(QWidget *parent=0);
00134   
00139   void allowMultipleTopics(bool allow);
00140 
00146   void setDatatypeFilter(const std::vector<std::string> &datatypes);
00147 
00154   ros::master::TopicInfo selectedTopic() const;
00159   std::vector<ros::master::TopicInfo> selectedTopics() const;
00160 
00161  private:
00162   void timerEvent(QTimerEvent *);
00163   void closeEvent(QCloseEvent *);
00164 
00165   std::vector<ros::master::TopicInfo> filterTopics(
00166     const std::vector<ros::master::TopicInfo> &) const;
00167 
00168  private Q_SLOTS:
00169   void fetchTopics();
00170   void updateDisplayedTopics();
00171 
00172  private:
00173   std::set<std::string> allowed_datatypes_;
00174   std::vector<ros::master::TopicInfo> known_topics_;
00175   std::vector<ros::master::TopicInfo> displayed_topics_;
00176   int fetch_topics_timer_id_;
00177 
00178   QPushButton *ok_button_;
00179   QPushButton *cancel_button_;
00180   QListWidget *list_widget_;
00181   QLineEdit *name_filter_;
00182 };  // class SelectTopicDialog
00183 }  // namespace mapviz
00184 #endif  // MAPVIZ_SELECT_TOPIC_DIALOG_H_


mapviz
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 18:50:58