tile_map_view.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_VIEW_H_
31 #define TILE_MAP_TILE_MAP_VIEW_H_
32 
33 #include <string>
34 
35 #include <boost/shared_ptr.hpp>
36 
37 #include <tile_map/tile_source.h>
38 #include <tile_map/texture_cache.h>
39 
41 
42 namespace tile_map
43 {
44  class TileSource;
45 
46  struct Tile
47  {
48  public:
49  QString url;
50  size_t url_hash;
51  int32_t level;
52  int32_t subdiv_count;
53  double subwidth;
54 
56 
57  std::vector<tf::Vector3> points;
58  std::vector<tf::Vector3> points_t;
59  };
60 
62  {
63  public:
64  TileMapView();
65 
66  void ResetCache();
67 
68  void SetTileSource(const boost::shared_ptr<TileSource>& tile_source);
69 
70  void SetTransform(const swri_transform_util::Transform& transform);
71 
72  void SetView(
73  double latitude,
74  double longitude,
75  double scale,
76  int32_t width,
77  int32_t height);
78 
79  void Draw();
80 
81  private:
82  void DrawTiles(std::vector<Tile> &tiles ,int priority);
83 
85 
87 
88  int32_t level_;
89 
90  int64_t center_x_;
91  int64_t center_y_;
92 
93  int64_t size_;
94 
95  int32_t width_;
96  int32_t height_;
97 
98  std::vector<Tile> tiles_;
99  std::vector<Tile> precache_;
100 
102 
103  void ToLatLon(int32_t level, double x, double y, double& latitude, double& longitude);
104 
105  void InitializeTile(int32_t level, int64_t x, int64_t y, Tile& tile, int priority);
106  };
107 }
108 
109 #endif // TILE_MAP_TILE_MAP_VIEW_H_
int32_t subdiv_count
Definition: tile_map_view.h:52
std::vector< Tile > precache_
Definition: tile_map_view.h:99
TexturePtr texture
Definition: tile_map_view.h:55
swri_transform_util::Transform transform_
Definition: tile_map_view.h:86
std::vector< Tile > tiles_
Definition: tile_map_view.h:98
TextureCachePtr tile_cache_
std::vector< tf::Vector3 > points
Definition: tile_map_view.h:57
boost::shared_ptr< TileSource > tile_source_
Definition: tile_map_view.h:84
std::vector< tf::Vector3 > points_t
Definition: tile_map_view.h:58


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