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  bool IsReady();
67 
68  void ResetCache();
69 
70  void SetTileSource(const boost::shared_ptr<TileSource>& tile_source);
71 
72  void SetTransform(const swri_transform_util::Transform& transform);
73 
74  void SetView(
75  double latitude,
76  double longitude,
77  double scale,
78  int32_t width,
79  int32_t height);
80 
81  void Draw();
82 
83  private:
84  void DrawTiles(std::vector<Tile> &tiles ,int priority);
85 
87 
89 
90  int32_t level_;
91 
92  int64_t center_x_;
93  int64_t center_y_;
94 
95  int64_t size_;
96 
97  int32_t width_;
98  int32_t height_;
99 
100  std::vector<Tile> tiles_;
101  std::vector<Tile> precache_;
102 
104 
105  void ToLatLon(int32_t level, double x, double y, double& latitude, double& longitude);
106 
107  void InitializeTile(int32_t level, int64_t x, int64_t y, Tile& tile, int priority);
108  };
109 }
110 
111 #endif // TILE_MAP_TILE_MAP_VIEW_H_
int32_t subdiv_count
Definition: tile_map_view.h:52
std::vector< Tile > precache_
TexturePtr texture
Definition: tile_map_view.h:55
swri_transform_util::Transform transform_
Definition: tile_map_view.h:88
std::vector< Tile > tiles_
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:86
std::vector< tf::Vector3 > points_t
Definition: tile_map_view.h:58


tile_map
Author(s): Marc Alban
autogenerated on Fri Mar 19 2021 02:44:47