tile_map_plugin.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2015, 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 
00030 #ifndef TILE_MAP_TILE_MAP_PLUGIN_H_
00031 #define TILE_MAP_TILE_MAP_PLUGIN_H_
00032 
00033 // C++ standard libraries
00034 #include <string>
00035 #include <map>
00036 
00037 // Boost libraries
00038 #include <boost/filesystem.hpp>
00039 #include <boost/shared_ptr.hpp>
00040 
00041 #include <mapviz/mapviz_plugin.h>
00042 
00043 // QT libraries
00044 #include <QGLWidget>
00045 #include <QObject>
00046 #include <QWidget>
00047 
00048 #include <mapviz/map_canvas.h>
00049 #include <tile_map/tile_map_view.h>
00050 
00051 // QT autogenerated files
00052 #include "ui_tile_map_config.h"
00053 
00054 namespace tile_map
00055 {
00056   class TileSource;
00057 
00058   class TileMapPlugin : public mapviz::MapvizPlugin
00059   {
00060     Q_OBJECT
00061 
00062   public:
00063     TileMapPlugin();
00064     virtual ~TileMapPlugin();
00065 
00066     bool Initialize(QGLWidget* canvas);
00067     void Shutdown() {}
00068 
00069     void Draw(double x, double y, double scale);
00070 
00071     void Transform();
00072 
00073     void LoadConfig(const YAML::Node& node, const std::string& path);
00074     void SaveConfig(YAML::Emitter& emitter, const std::string& path);
00075 
00076     QWidget* GetConfigWidget(QWidget* parent);
00077 
00078   protected Q_SLOTS:
00079     void PrintError(const std::string& message);
00080     void PrintInfo(const std::string& message);
00081     void PrintWarning(const std::string& message);
00082 
00083     void DeleteTileSource();
00084     void SelectSource(const QString& source_name);
00085     void SaveCustomSource();
00086     void ResetTileCache();
00087 
00088   private:
00089     void selectTileSource(const boost::shared_ptr<TileSource>& tile_source);
00090     void startCustomEditing();
00091     void stopCustomEditing();
00092 
00093     Ui::tile_map_config ui_;
00094     QWidget* config_widget_;
00095 
00096     swri_transform_util::Transform transform_;
00097     swri_transform_util::Transform inverse_transform_;
00098 
00099     bool transformed_;
00100     
00101     TileMapView tile_map_;
00102     std::map<QString, boost::shared_ptr<TileSource> > tile_sources_;
00103 
00104     double last_center_x_;
00105     double last_center_y_;
00106     double last_scale_;
00107     int32_t last_height_;
00108     int32_t last_width_;
00109 
00110     static std::string BASE_URL_KEY;
00111     static std::string BING_API_KEY;
00112     static std::string CUSTOM_SOURCES_KEY;
00113     static std::string MAX_ZOOM_KEY;
00114     static std::string NAME_KEY;
00115     static std::string SOURCE_KEY;
00116     static std::string TYPE_KEY;
00117     static QString BING_NAME;
00118     static QString STAMEN_TERRAIN_NAME;
00119     static QString STAMEN_TONER_NAME;
00120     static QString STAMEN_WATERCOLOR_NAME;
00121   };
00122 }
00123 
00124 #endif  // TILE_MAP_TILE_MAP_PLUGIN_H_


tile_map
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 18:51:19