bing_source.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 Southwest Research Institute® BE LIABLE 
00021 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00022 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00023 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00024 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00025 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00027 // DAMAGE.
00028 //
00029 // *****************************************************************************
00030 
00031 #ifndef TILE_MAP_BING_SOURCE_H
00032 #define TILE_MAP_BING_SOURCE_H
00033 
00034 #include "tile_source.h"
00035 
00036 #include <boost/functional/hash.hpp>
00037 #include <boost/random.hpp>
00038 
00039 #include <vector>
00040 
00041 #include <QNetworkAccessManager>
00042 #include <QNetworkReply>
00043 #include <QString>
00044 
00045 namespace tile_map
00046 {
00047   class BingSource : public TileSource
00048   {
00049     Q_OBJECT
00050   public:
00060     explicit BingSource(const QString& name);
00061 
00075     virtual size_t GenerateTileHash(int32_t level, int64_t x, int64_t y);
00076 
00089     virtual QString GenerateTileUrl(int32_t level, int64_t x, int64_t y);
00090 
00091     virtual QString GetType() const;
00092 
00093     QString GetApiKey() const;
00094 
00105     void SetApiKey(const QString& api_key);
00106 
00107     static const QString BING_TYPE;
00108 
00109   protected Q_SLOTS:
00110     void ReplyFinished(QNetworkReply* reply);
00111 
00112   protected:
00124     QString GenerateQuadKey(int32_t level, int64_t x, int64_t y) const;
00125 
00126     QString api_key_;
00127     boost::hash<std::string> hash_;
00128     QNetworkAccessManager network_manager_;
00129     boost::random::mt19937 rng_;
00130     std::vector<QString> subdomains_;
00131     QString tile_url_;
00132 
00133     static const std::string BING_IMAGE_URL_KEY;
00134     static const std::string BING_IMAGE_URL_SUBDOMAIN_KEY;
00135     static const std::string BING_RESOURCE_SET_KEY;
00136     static const std::string BING_RESOURCE_KEY;
00137     static const std::string BING_STATUS_CODE_KEY;
00138   };
00139 }
00140 
00141 #endif //TILE_MAP_BING_SOURCE_H


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