|
|
@@ -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
|
}
|