@@ -19,6 +19,7 @@ pub struct TileSchemaBuilder {
1919 tile_width : u32 ,
2020 tile_height : u32 ,
2121 y_direction : VerticalDirection ,
22+ wrap_x : bool ,
2223}
2324
2425#[ derive( Debug ) ]
@@ -165,6 +166,7 @@ impl TileSchemaBuilder {
165166 tile_width : self . tile_width ,
166167 tile_height : self . tile_height ,
167168 y_direction : self . y_direction ,
169+ wrap_x : self . wrap_x ,
168170 } )
169171 }
170172
@@ -192,6 +194,7 @@ impl TileSchemaBuilder {
192194 tile_width : 0 ,
193195 tile_height : 0 ,
194196 y_direction : VerticalDirection :: TopToBottom ,
197+ wrap_x : true ,
195198 }
196199 }
197200
@@ -218,6 +221,21 @@ impl TileSchemaBuilder {
218221 self . lods = Lods :: Custom ( z_levels. into_iter ( ) . collect ( ) ) ;
219222 self
220223 }
224+
225+ /// If set to true, tiles will wrap around x axis of the schema bounds.
226+ ///
227+ /// This means, that if a tile requested for x coordinate that is larger than the maximum x of the
228+ /// bounding box or smaller than the minimum x value, the tile index will be calculated by reducing
229+ /// or increasing x coordinate by the whole number of bounding box widths. This produces an effect of
230+ /// horizontally infinite map, where a user can pan as log as they want to the right or left.
231+ ///
232+ /// Note, that for wrapping to work property, bounds of the tile schema should cover the whole globe.
233+ /// This is not enforced in `.build()` method validatation since tile schema is agnostic to the CRS
234+ /// it will be used for.
235+ pub fn wrap_x ( mut self , shall_wrap : bool ) -> Self {
236+ self . wrap_x = shall_wrap;
237+ self
238+ }
221239}
222240
223241#[ cfg( test) ]
0 commit comments