pub struct DrawSimpleRoadLabels {
draw: Drawable,
include_roads: Box<dyn Fn(&Road) -> bool>,
fg_color: Color,
pub label_covers_road: HashMap<RoadID, (Distance, Distance)>,
}
Expand description
Draws labels in map-space that roughly fit on the roads. Don’t change behavior during zooming; labels are only meant to be legible when zoomed in.
Fields§
§draw: Drawable
§include_roads: Box<dyn Fn(&Road) -> bool>
§fg_color: Color
§label_covers_road: HashMap<RoadID, (Distance, Distance)>
Implementations§
Source§impl DrawSimpleRoadLabels
impl DrawSimpleRoadLabels
Sourcepub fn new(
ctx: &mut EventCtx<'_>,
app: &dyn AppLike,
fg_color: Color,
include_roads: Box<dyn Fn(&Road) -> bool>,
) -> Self
pub fn new( ctx: &mut EventCtx<'_>, app: &dyn AppLike, fg_color: Color, include_roads: Box<dyn Fn(&Road) -> bool>, ) -> Self
Label roads that the predicate approves
pub fn empty(ctx: &EventCtx<'_>) -> Self
Sourcepub fn only_major_roads(
ctx: &mut EventCtx<'_>,
app: &dyn AppLike,
fg_color: Color,
) -> Self
pub fn only_major_roads( ctx: &mut EventCtx<'_>, app: &dyn AppLike, fg_color: Color, ) -> Self
Only label major roads
pub fn all_roads( ctx: &mut EventCtx<'_>, app: &dyn AppLike, fg_color: Color, ) -> Self
pub fn draw(&self, g: &mut GfxCtx<'_>)
fn render( &mut self, ctx: &mut EventCtx<'_>, app: &dyn AppLike, timer: &mut Timer<'_>, )
Auto Trait Implementations§
impl Freeze for DrawSimpleRoadLabels
impl !RefUnwindSafe for DrawSimpleRoadLabels
impl !Send for DrawSimpleRoadLabels
impl !Sync for DrawSimpleRoadLabels
impl Unpin for DrawSimpleRoadLabels
impl !UnwindSafe for DrawSimpleRoadLabels
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.