Browse Source

Rename tile_layer -> mercator_tile_layer

and TileLayer -> MercatorTileLayer
Johannes Hofmann 7 years ago
parent
commit
7a3a12aa68
3 changed files with 19 additions and 15 deletions
  1. 2
    2
      src/main.rs
  2. 13
    9
      src/map_view_gl.rs
  3. 4
    4
      src/mercator_tile_layer.rs

+ 2
- 2
src/main.rs View File

@@ -23,11 +23,12 @@ pub mod config;
23 23
 #[macro_use]
24 24
 pub mod context;
25 25
 pub mod coord;
26
-pub mod ortho_tile_layer;
27 26
 pub mod map_view;
28 27
 pub mod map_view_gl;
29 28
 pub mod marker_layer;
29
+pub mod mercator_tile_layer;
30 30
 pub mod mercator_view;
31
+pub mod ortho_tile_layer;
31 32
 pub mod orthografic_view;
32 33
 pub mod program;
33 34
 pub mod search;
@@ -36,7 +37,6 @@ pub mod texture;
36 37
 pub mod tile;
37 38
 pub mod tile_atlas;
38 39
 pub mod tile_cache;
39
-pub mod tile_layer;
40 40
 pub mod tile_loader;
41 41
 pub mod tile_source;
42 42
 pub mod url_template;

+ 13
- 9
src/map_view_gl.rs View File

@@ -8,7 +8,7 @@ use session::Session;
8 8
 use texture::{Texture, TextureFormat};
9 9
 use tile_atlas::TileAtlas;
10 10
 use tile_cache::TileCache;
11
-use tile_layer::TileLayer;
11
+use mercator_tile_layer::MercatorTileLayer;
12 12
 use tile_source::TileSource;
13 13
 
14 14
 
@@ -23,7 +23,7 @@ pub struct MapViewGl {
23 23
     dpi_factor: f64,
24 24
     tile_cache: TileCache,
25 25
     tile_atlas: TileAtlas,
26
-    tile_layer: TileLayer,
26
+    mercator_tile_layer: MercatorTileLayer,
27 27
     marker_layer: MarkerLayer,
28 28
     ortho_tile_layer: OrthoTileLayer,
29 29
     projection: Projection,
@@ -59,7 +59,11 @@ impl MapViewGl {
59 59
     {
60 60
         let tile_size = 256;
61 61
 
62
-        let mut map_view = MercatorView::initial_map_view(f64::from(initial_size.0), f64::from(initial_size.1), tile_size);
62
+        let mut map_view = MercatorView::initial_map_view(
63
+            f64::from(initial_size.0),
64
+            f64::from(initial_size.1),
65
+            tile_size,
66
+        );
63 67
 
64 68
         if map_view.zoom < MIN_ZOOM_LEVEL {
65 69
             map_view.zoom = MIN_ZOOM_LEVEL;
@@ -88,7 +92,7 @@ impl MapViewGl {
88 92
         tile_atlas.double_texture_size(cx);
89 93
         tile_atlas.double_texture_size(cx);
90 94
 
91
-        let tile_layer = TileLayer::new(cx, &tile_atlas);
95
+        let mercator_tile_layer = MercatorTileLayer::new(cx, &tile_atlas);
92 96
 
93 97
         MapViewGl {
94 98
             map_view,
@@ -96,7 +100,7 @@ impl MapViewGl {
96 100
             dpi_factor,
97 101
             tile_cache: TileCache::new(move |_tile| update_func(), use_network),
98 102
             tile_atlas,
99
-            tile_layer,
103
+            mercator_tile_layer,
100 104
             marker_layer: MarkerLayer::new(cx),
101 105
             ortho_tile_layer: OrthoTileLayer::new(cx),
102 106
             projection: Projection::Mercator,
@@ -138,16 +142,16 @@ impl MapViewGl {
138 142
         };
139 143
     }
140 144
 
141
-    fn draw_flat_tiles(&mut self, cx: &mut Context, source: &TileSource, snap_to_pixel: bool)
145
+    fn draw_mercator_tiles(&mut self, cx: &mut Context, source: &TileSource, snap_to_pixel: bool)
142 146
         -> Result<usize, usize>
143 147
     {
144 148
         if self.last_draw_type != DrawType::Tiles {
145 149
             self.last_draw_type = DrawType::Tiles;
146
-            self.tile_layer.prepare_draw(cx, &self.tile_atlas);
150
+            self.mercator_tile_layer.prepare_draw(cx, &self.tile_atlas);
147 151
         }
148 152
 
149 153
         //TODO remove viewport_size parameter
150
-        self.tile_layer.draw(
154
+        self.mercator_tile_layer.draw(
151 155
             cx,
152 156
             &self.map_view,
153 157
             source,
@@ -198,7 +202,7 @@ impl MapViewGl {
198 202
 
199 203
         match self.projection {
200 204
             Projection::Mercator => {
201
-                let ret = self.draw_flat_tiles(cx, source, snap_to_pixel);
205
+                let ret = self.draw_mercator_tiles(cx, source, snap_to_pixel);
202 206
                 if !self.marker_layer.is_empty() {
203 207
                     self.draw_marker(cx, snap_to_pixel);
204 208
                 }

src/tile_layer.rs → src/mercator_tile_layer.rs View File

@@ -12,17 +12,17 @@ use vertex_attrib::VertexAttribParams;
12 12
 
13 13
 
14 14
 #[derive(Debug)]
15
-pub struct TileLayer {
15
+pub struct MercatorTileLayer {
16 16
     program: Program,
17 17
     buffer: Buffer,
18 18
 }
19 19
 
20 20
 
21
-impl TileLayer {
21
+impl MercatorTileLayer {
22 22
     pub fn new(
23 23
         cx: &mut Context,
24 24
         atlas: &TileAtlas,
25
-    ) -> TileLayer
25
+    ) -> MercatorTileLayer
26 26
     {
27 27
         let buffer = Buffer::new(cx, &[], 0);
28 28
         check_gl_errors!(cx);
@@ -55,7 +55,7 @@ impl TileLayer {
55 55
         );
56 56
         check_gl_errors!(cx);
57 57
 
58
-        TileLayer {
58
+        MercatorTileLayer {
59 59
             program,
60 60
             buffer,
61 61
         }