pub struct ScreenPoint { /* private fields */ }Expand description
Normalized screen coordinate with (0, 0) at the top left.
Implementations§
Source§impl ScreenPoint
impl ScreenPoint
Sourcepub const fn x(self) -> f64
pub const fn x(self) -> f64
Returns normalized horizontal position.
Examples found in repository?
examples/layout_labels.rs (line 32)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22 let viewport = Viewport::new(35.5, 139.4, 35.9, 140.0)?;
23 let features = vec![
24 feature("駅", 35.6812, 139.7671, LabelPriority::Transit)?,
25 feature("広場", 35.6820, 139.7680, LabelPriority::Local)?,
26 ];
27 let labels = MapDisplay::layout(&features, viewport, 12, "ja", "ja", 0.02)?;
28 for label in labels {
29 println!(
30 "{} at ({:.3}, {:.3})",
31 label.text,
32 label.position.x(),
33 label.position.y()
34 );
35 }
36 Ok(())
37}Sourcepub const fn y(self) -> f64
pub const fn y(self) -> f64
Returns normalized vertical position.
Examples found in repository?
examples/layout_labels.rs (line 33)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22 let viewport = Viewport::new(35.5, 139.4, 35.9, 140.0)?;
23 let features = vec![
24 feature("駅", 35.6812, 139.7671, LabelPriority::Transit)?,
25 feature("広場", 35.6820, 139.7680, LabelPriority::Local)?,
26 ];
27 let labels = MapDisplay::layout(&features, viewport, 12, "ja", "ja", 0.02)?;
28 for label in labels {
29 println!(
30 "{} at ({:.3}, {:.3})",
31 label.text,
32 label.position.x(),
33 label.position.y()
34 );
35 }
36 Ok(())
37}Trait Implementations§
Source§impl Clone for ScreenPoint
impl Clone for ScreenPoint
impl Copy for ScreenPoint
Source§impl Debug for ScreenPoint
impl Debug for ScreenPoint
Source§impl PartialEq for ScreenPoint
impl PartialEq for ScreenPoint
impl StructuralPartialEq for ScreenPoint
Auto Trait Implementations§
impl Freeze for ScreenPoint
impl RefUnwindSafe for ScreenPoint
impl Send for ScreenPoint
impl Sync for ScreenPoint
impl Unpin for ScreenPoint
impl UnsafeUnpin for ScreenPoint
impl UnwindSafe for ScreenPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more