tile_map_plugin.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2015, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #ifndef TILE_MAP_TILE_MAP_PLUGIN_H_
31 #define TILE_MAP_TILE_MAP_PLUGIN_H_
32 
33 // C++ standard libraries
34 #include <string>
35 #include <map>
36 
37 // Boost libraries
38 #include <boost/filesystem.hpp>
39 #include <boost/shared_ptr.hpp>
40 #include <boost/algorithm/string/trim.hpp>
41 
42 #include <mapviz/mapviz_plugin.h>
43 
44 // QT libraries
45 #include <QGLWidget>
46 #include <QObject>
47 #include <QWidget>
48 
49 #include <mapviz/map_canvas.h>
50 #include <tile_map/tile_map_view.h>
51 
52 // QT autogenerated files
53 #include "ui_tile_map_config.h"
54 
55 namespace tile_map
56 {
57  class TileSource;
58 
60  {
61  Q_OBJECT
62 
63  public:
64  TileMapPlugin();
65  virtual ~TileMapPlugin();
66 
67  bool Initialize(QGLWidget* canvas);
68  void Shutdown() {}
69 
70  void Draw(double x, double y, double scale);
71 
72  void Transform();
73 
74  void LoadConfig(const YAML::Node& node, const std::string& path);
75  void SaveConfig(YAML::Emitter& emitter, const std::string& path);
76 
77  QWidget* GetConfigWidget(QWidget* parent);
78 
79  protected Q_SLOTS:
80  void PrintError(const std::string& message);
81  void PrintInfo(const std::string& message);
82  void PrintWarning(const std::string& message);
83 
84  void DeleteTileSource();
85  void SelectSource(const QString& source_name);
86  void SaveCustomSource();
87  void ResetTileCache();
88 
89  private:
90  void selectTileSource(const boost::shared_ptr<TileSource>& tile_source);
91  void startCustomEditing();
92  void stopCustomEditing();
93 
94  Ui::tile_map_config ui_;
95  QWidget* config_widget_;
96 
99 
101 
103  std::map<QString, boost::shared_ptr<TileSource> > tile_sources_;
104 
107  double last_scale_;
108  int32_t last_height_;
109  int32_t last_width_;
110 
111  static std::string BASE_URL_KEY;
112  static std::string BING_API_KEY;
113  static std::string CUSTOM_SOURCES_KEY;
114  static std::string MAX_ZOOM_KEY;
115  static std::string NAME_KEY;
116  static std::string SOURCE_KEY;
117  static std::string TYPE_KEY;
118  static QString BING_NAME;
119  static QString STAMEN_TERRAIN_NAME;
120  static QString STAMEN_TONER_NAME;
121  static QString STAMEN_WATERCOLOR_NAME;
122  };
123 }
124 
125 #endif // TILE_MAP_TILE_MAP_PLUGIN_H_
static QString STAMEN_TONER_NAME
static QString STAMEN_TERRAIN_NAME
Ui::tile_map_config ui_
swri_transform_util::Transform transform_
static std::string SOURCE_KEY
std::map< QString, boost::shared_ptr< TileSource > > tile_sources_
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
swri_transform_util::Transform inverse_transform_
static std::string CUSTOM_SOURCES_KEY
TFSIMD_FORCE_INLINE const tfScalar & y() const
static std::string TYPE_KEY
void Draw(double x, double y, double scale)
void PrintError(const std::string &message)
static QString STAMEN_WATERCOLOR_NAME
static std::string NAME_KEY
static std::string BASE_URL_KEY
void LoadConfig(const YAML::Node &node, const std::string &path)
TFSIMD_FORCE_INLINE const tfScalar & x() const
static std::string MAX_ZOOM_KEY
static std::string BING_API_KEY
void PrintWarning(const std::string &message)
void SelectSource(const QString &source_name)
void selectTileSource(const boost::shared_ptr< TileSource > &tile_source)
bool Initialize(QGLWidget *canvas)
void PrintInfo(const std::string &message)
QWidget * GetConfigWidget(QWidget *parent)


tile_map
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 19:25:35