Skip to content

Commit

Permalink
expose camera and debug mode api
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Feb 9, 2025
1 parent de78b7d commit 9e91990
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions platform/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
mod map_renderer;
mod tile_server_options;

pub use ffi::MapDebugOptions;
pub use map_renderer::{Image, ImageRenderer, ImageRendererOptions, Static, Tile};
pub use tile_server_options::TileServerOptions;

Expand Down
10 changes: 9 additions & 1 deletion platform/rust/src/map_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::Path;

use cxx::{CxxString, UniquePtr};

use crate::ffi;
use crate::{ffi, MapDebugOptions};
use crate::ffi::MapMode;

/// A rendered map image.
Expand Down Expand Up @@ -114,6 +114,14 @@ impl<S> ImageRenderer<S> {
let path = path.as_ref().to_str().expect("Path is not valid UTF-8");
ffi::MapRenderer_setStyleUrl(self.0.pin_mut(), &format!("file://{path}"));
}

pub fn set_camera(&mut self, lat: f64, lon: f64, zoom: f64, bearing: f64, pitch: f64) {
ffi::MapRenderer_setCamera(self.0.pin_mut(), lat, lon, zoom, bearing, pitch);
}

pub fn set_debug_flags(&mut self, flags: MapDebugOptions) {
ffi::MapRenderer_setDebugFlags(self.0.pin_mut(), flags);
}
}

impl ImageRenderer<Static> {
Expand Down

0 comments on commit 9e91990

Please sign in to comment.