File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,6 +339,16 @@ impl TileSchemaBuilder {
339339 self . world_bounds = bounds;
340340 self
341341 }
342+
343+ /// Sets direction of Y-indices of the tiles.
344+ ///
345+ /// The direction is specified relative to the projected coordinates direction. We consider negative Y
346+ /// coordinates of the projection to be at the bottom and positive at the top. So if
347+ /// `VerticalDirection::TopToBottom` is set, tiles with Y index 0 will be at the very top of the map.
348+ pub fn y_direction ( mut self , direction : VerticalDirection ) -> Self {
349+ self . y_direction = direction;
350+ self
351+ }
342352}
343353
344354#[ cfg( test) ]
@@ -621,4 +631,13 @@ mod tests {
621631 ) ;
622632 }
623633 }
634+
635+ #[ test]
636+ fn setting_y_direction ( ) {
637+ let schema = TileSchemaBuilder :: web_mercator ( 0 ..18 )
638+ . y_direction ( VerticalDirection :: BottomToTop )
639+ . build ( )
640+ . unwrap ( ) ;
641+ assert_eq ! ( schema. y_direction( ) , VerticalDirection :: BottomToTop ) ;
642+ }
624643}
Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ impl TileSchema {
6666 self . tile_height
6767 }
6868
69+ /// Direction of Y-indices of the tiles.
70+ ///
71+ /// The direction is specified relative to the projected coordinates direction. We consider negative Y
72+ /// coordinates of the projection to be at the bottom and positive at the top. So if
73+ /// `VerticalDirection::TopToBottom` is set, tiles with Y index 0 will be at the very top of the map.
74+ pub fn y_direction ( & self ) -> VerticalDirection {
75+ self . y_direction
76+ }
77+
6978 /// Iterate over tile indices that should be displayed for the given map view.
7079 pub fn iter_tiles ( & self , view : & MapView ) -> Option < impl Iterator < Item = WrappingTileIndex > > {
7180 let resolution = view. resolution ( ) ;
You can’t perform that action at this time.
0 commit comments