tile_map_view.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_VIEW_H_
00031 #define TILE_MAP_TILE_MAP_VIEW_H_
00032 
00033 #include <string>
00034 
00035 #include <boost/shared_ptr.hpp>
00036 
00037 #include <tile_map/tile_source.h>
00038 #include <tile_map/texture_cache.h>
00039 
00040 #include <swri_transform_util/transform.h>
00041 
00042 namespace tile_map
00043 {
00044   class TileSource;
00045 
00046   struct Tile
00047   {
00048   public:
00049     QString url;
00050     size_t url_hash;
00051     int32_t level;
00052     int32_t subdiv_count;
00053     double subwidth;
00054 
00055     TexturePtr texture;
00056 
00057     std::vector<tf::Vector3> points;
00058     std::vector<tf::Vector3> points_t;
00059   };
00060 
00061   class TileMapView
00062   {
00063   public:
00064     TileMapView();
00065 
00066     void ResetCache();
00067 
00068     void SetTileSource(const boost::shared_ptr<TileSource>& tile_source);
00069 
00070     void SetTransform(const swri_transform_util::Transform& transform);
00071 
00072     void SetView(
00073       double latitude,
00074       double longitude,
00075       double scale,
00076       int32_t width,
00077       int32_t height);
00078 
00079     void Draw();
00080 
00081   private:
00082     void DrawTiles(std::vector<Tile> &tiles ,int priority);
00083 
00084     boost::shared_ptr<TileSource> tile_source_;
00085 
00086     swri_transform_util::Transform transform_;
00087 
00088     int32_t level_;
00089 
00090     int64_t center_x_;
00091     int64_t center_y_;
00092 
00093     int64_t size_;
00094 
00095     int32_t width_;
00096     int32_t height_;
00097 
00098     std::vector<Tile> tiles_;
00099     std::vector<Tile> precache_;
00100 
00101     TextureCachePtr tile_cache_;
00102 
00103     void ToLatLon(int32_t level, double x, double y, double& latitude, double& longitude);
00104 
00105     void InitializeTile(int32_t level, int64_t x, int64_t y, Tile& tile, int priority);
00106   };
00107 }
00108 
00109 #endif  // TILE_MAP_TILE_MAP_VIEW_H_


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