use mln_map_types::{ConstrainMode, MapMode, NorthOrientation, ViewportMode};
use mln_util::size::Size;
#[derive(Clone, Debug)]
pub struct MapOptions {
map_mode: MapMode,
constrain_mode: ConstrainMode,
viewport_mode: ViewportMode,
orientation: NorthOrientation,
cross_source_collisions: bool,
capture_rendered_features: bool,
size: Size,
pixel_ratio: f32,
fast_pfor_enabled: bool,
}
impl Default for MapOptions {
fn default() -> Self {
MapOptions {
map_mode: MapMode::Continuous,
constrain_mode: ConstrainMode::HeightOnly,
viewport_mode: ViewportMode::Default,
orientation: NorthOrientation::Upwards,
cross_source_collisions: true,
capture_rendered_features: false,
size: Size::new(64, 64),
pixel_ratio: 1.0,
fast_pfor_enabled: false,
}
}
}
impl MapOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_map_mode(mut self, mode: MapMode) -> Self {
self.map_mode = mode;
self
}
pub fn map_mode(&self) -> MapMode {
self.map_mode
}
pub fn with_constrain_mode(mut self, mode: ConstrainMode) -> Self {
self.constrain_mode = mode;
self
}
pub fn constrain_mode(&self) -> ConstrainMode {
self.constrain_mode
}
pub fn with_viewport_mode(mut self, mode: ViewportMode) -> Self {
self.viewport_mode = mode;
self
}
pub fn viewport_mode(&self) -> ViewportMode {
self.viewport_mode
}
pub fn with_cross_source_collisions(mut self, enable_collisions: bool) -> Self {
self.cross_source_collisions = enable_collisions;
self
}
pub fn cross_source_collisions(&self) -> bool {
self.cross_source_collisions
}
pub fn with_north_orientation(mut self, orientation: NorthOrientation) -> Self {
self.orientation = orientation;
self
}
pub fn north_orientation(&self) -> NorthOrientation {
self.orientation
}
pub fn with_size(mut self, size: Size) -> Self {
self.size = size;
self
}
pub fn size(&self) -> Size {
self.size
}
pub fn with_pixel_ratio(mut self, ratio: f32) -> Self {
self.pixel_ratio = ratio;
self
}
pub fn pixel_ratio(&self) -> f32 {
self.pixel_ratio
}
pub fn with_rendered_feature_info(mut self, capture: bool) -> Self {
self.capture_rendered_features = capture;
self
}
pub fn rendered_feature_info(&self) -> bool {
self.capture_rendered_features
}
pub fn with_fast_pfor_enabled(mut self, enable: bool) -> Self {
self.fast_pfor_enabled = enable;
self
}
pub fn fast_pfor_enabled(&self) -> bool {
self.fast_pfor_enabled
}
}