pub struct SvgElement {
pub pos: GeoPos,
pub text: String,
pub metadata: String,
pub scalable: bool,
pub clickable: bool,
pub draggable: bool,
pub anchor: Pos2,
}Expand description
An SVG element on the map.
Fields§
§pos: GeoPosThe geographical position (longitude, latitude) of the SVG element.
text: StringThe SVG content string.
metadata: StringArbitrary metadata string, not rendered.
scalable: boolWhether the SVG element should scale with the zoom level. If false, the image size stays the same in screen pixels. If true, the image size scales with the map.
clickable: boolWhether the SVG element is clickable. If true, click events will be emitted for this element. If false, no click events will be emitted.
draggable: boolWhether the SVG element is draggable. If true, the element can be moved on the map by dragging it with the mouse.
anchor: Pos2The anchor point of the SVG element, relative to its size. (0.5, 0.5) is the center (default). (0.0, 0.0) is the top-left. (1.0, 1.0) is the bottom-right.
Implementations§
Source§impl SvgElement
impl SvgElement
Sourcepub fn new(
pos: GeoPos,
text: impl Into<String>,
metadata: impl Into<String>,
) -> Self
pub fn new( pos: GeoPos, text: impl Into<String>, metadata: impl Into<String>, ) -> Self
Creates a new SVG element.
Sourcepub fn from_xy(
lon: f64,
lat: f64,
text: impl Into<String>,
metadata: impl Into<String>,
) -> Self
pub fn from_xy( lon: f64, lat: f64, text: impl Into<String>, metadata: impl Into<String>, ) -> Self
Creates a new SVG element from x (longitude) and y (latitude) coordinates.
Sourcepub fn with_scalable(self, scalable: bool) -> Self
pub fn with_scalable(self, scalable: bool) -> Self
Sets whether the SVG element is scalable.
Sourcepub fn with_clickable(self, clickable: bool) -> Self
pub fn with_clickable(self, clickable: bool) -> Self
Sets whether the SVG element is clickable.
Sourcepub fn with_draggable(self, draggable: bool) -> Self
pub fn with_draggable(self, draggable: bool) -> Self
Sets whether the SVG element is draggable.
Sourcepub fn with_anchor(self, anchor: Pos2) -> Self
pub fn with_anchor(self, anchor: Pos2) -> Self
Sets the anchor point of the SVG element.
Trait Implementations§
Source§impl Clone for SvgElement
impl Clone for SvgElement
Source§fn clone(&self) -> SvgElement
fn clone(&self) -> SvgElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SvgElement
impl Debug for SvgElement
Source§impl<'de> Deserialize<'de> for SvgElement
impl<'de> Deserialize<'de> for SvgElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SvgElement
impl PartialEq for SvgElement
Source§impl Serialize for SvgElement
impl Serialize for SvgElement
impl StructuralPartialEq for SvgElement
Auto Trait Implementations§
impl Freeze for SvgElement
impl RefUnwindSafe for SvgElement
impl Send for SvgElement
impl Sync for SvgElement
impl Unpin for SvgElement
impl UnsafeUnpin for SvgElement
impl UnwindSafe for SvgElement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more