File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,30 @@ impl AppState {
6565 self . feature_collection . clone ( )
6666 }
6767
68+ pub fn load_tile ( & mut self , tile_id : TileId ) {
69+ self . tile_cache . finalize_loaded_tiles ( ) ;
70+ if !self . visible_tiles . contains ( & tile_id) {
71+ println ! ( "Loading: {}" , tile_id) ;
72+ self . tile_cache . load_tile (
73+ & tile_id,
74+ self . feature_collection . clone ( ) ,
75+ & CONFIG . renderer . selection_tags . clone ( ) ,
76+ ) ;
77+
78+ let tile_cache = & mut self . tile_cache ;
79+ if let Some ( tile) = tile_cache. try_get_tile_mut ( & tile_id) {
80+ println ! ( "Loading collider: {}" , tile_id) ;
81+ tile. load_collider ( ) ;
82+
83+ self . visible_tiles . push ( tile_id) ;
84+ }
85+ }
86+
87+ if let Ok ( mut feature_collection) = self . feature_collection . try_write ( ) {
88+ feature_collection. load_styles ( self . zoom , & mut self . css_cache ) ;
89+ }
90+ }
91+
6892 pub fn load_tiles ( & mut self ) {
6993 let tile_field = self . screen . get_tile_boundaries_for_zoom_level ( self . zoom , 1 ) ;
7094
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use std::sync::Arc;
77
88use crate :: config:: CONFIG ;
99use lyon:: math:: vector;
10- use osm:: math:: { deg2num, tile_to_world_space} ;
10+ use osm:: math:: { deg2num, tile_to_world_space, TileId } ;
1111use winit:: {
1212 application:: ApplicationHandler ,
1313 dpi:: { LogicalPosition , LogicalSize , PhysicalPosition } ,
@@ -194,7 +194,7 @@ impl ApplicationHandler for Application {
194194 WindowEvent :: RedrawRequested => {
195195 if !event_loop. exiting ( ) {
196196 self . painter . update_shader ( ) ;
197- self . app_state . load_tiles ( ) ;
197+ self . app_state . load_tile ( TileId :: new ( 13 , 4290 , 2868 ) ) ;
198198 self . painter . paint ( & mut self . hud , & mut self . app_state ) ;
199199
200200 self . app_state . stats . capture_frame ( ) ;
You can’t perform that action at this time.
0 commit comments