pub struct Graph {
pub at: Option<At>,
/* private fields */
}Expand description
A draw.land graph, built a call at a time.
The library’s functions are Graph::call by name ("areas.union"),
as JavaScript and Python call them, or the typed methods of crate::api
for Rust. Graph::finish gives the graph the engine draws.
Fields§
§at: Option<At>Where in the script the call being made is, for the graph’s nodes and for errors: set by the caller before each call.
Implementations§
Source§impl Graph
impl Graph
pub fn features(&mut self) -> FeaturesApi<'_>
pub fn areas(&mut self) -> AreasApi<'_>
pub fn lines(&mut self) -> LinesApi<'_>
pub fn fills(&mut self) -> FillsApi<'_>
pub fn modules(&mut self) -> ModulesApi<'_>
pub fn compose(&mut self) -> ComposeApi<'_>
pub fn page(&mut self) -> PageApi<'_>
pub fn world(&mut self) -> WorldApi<'_>
Sourcepub fn output(&mut self, spec: Obj) -> Result<()>
pub fn output(&mut self, spec: Obj) -> Result<()>
Where the map is and on what paper: { lat, lng, width, height, scale, bearing, projection, padding, slices, warp, tileZoom }. A
remap warp is a function of page points: Graph::output_remap.
Sourcepub fn output_remap(
&mut self,
spec: Obj,
remaps: &mut [&mut dyn FnMut(&mut Graph, [f64; 2]) -> Result<[f64; 2]>],
) -> Result<()>
pub fn output_remap( &mut self, spec: Obj, remaps: &mut [&mut dyn FnMut(&mut Graph, [f64; 2]) -> Result<[f64; 2]>], ) -> Result<()>
output with remaps[i] the function of the i-th remap warp in
spec.warp (written { "remap": true, "grid": 64 }): each runs on a
grid of page points, and may read the ground under one with
g.page().to_world(p) (through the warps before it).
Source§impl Graph
impl Graph
Sourcepub fn new(place: Option<(f64, f64)>) -> Graph
pub fn new(place: Option<(f64, f64)>) -> Graph
An empty graph. place ((lat, lng)) goes over whatever place the
output asks: world answers for it.
Sourcepub fn draft(place: Option<(f64, f64)>) -> Graph
pub fn draft(place: Option<(f64, f64)>) -> Graph
A draft graph, for a page following a drag: output leaves its
remap warps out, since sampling one runs a function hundreds of
times. Graph::drafted says whether one was.
Sourcepub fn wanted_address(&self) -> Option<&str>
pub fn wanted_address(&self) -> Option<&str>
The address the script needed coordinates for, if it asked world
about an output that names only one.
Sourcepub fn current_output(&self, asked: &str) -> Result<OutputSpec>
pub fn current_output(&self, asked: &str) -> Result<OutputSpec>
The output page and world describe: the script’s own, or inside
a view whose style never called output, the view’s keys.
Sourcepub fn frame(&mut self, asked: &str) -> Result<Frame>
pub fn frame(&mut self, asked: &str) -> Result<Frame>
The frame world and the conversions answer from, worked out once
per output.
Sourcepub fn view_begin(&mut self, spec: &Arg) -> Result<()>
pub fn view_begin(&mut self, spec: &Arg) -> Result<()>
view({ … }, style) begins: the calls until Graph::view_end
build the view’s own graph.
Source§impl Graph
impl Graph
Sourcepub fn call(&mut self, name: &str, args: &[Arg]) -> Result<Arg>
pub fn call(&mut self, name: &str, args: &[Arg]) -> Result<Arg>
Call the library’s function name ("areas.union") with args.
Sourcepub fn get_property(&mut self, name: &str) -> Result<Arg>
pub fn get_property(&mut self, name: &str) -> Result<Arg>
The value of page.width, world.center and the like.
Sourcepub fn get(&mut self, of: &Arg, part: &str) -> Result<Arg>
pub fn get(&mut self, of: &Arg, part: &str) -> Result<Arg>
A module’s part made when it is first asked for: graticule.keys,
labels.area, a label rule’s lines. The same part every time.
Sourcepub fn parts(of: &Lazy) -> Vec<String>
pub fn parts(of: &Lazy) -> Vec<String>
The parts a lazy module part has, for a binding to expose.
Sourcepub fn output_begin(&mut self, spec: &Obj) -> Result<bool>
pub fn output_begin(&mut self, spec: &Obj) -> Result<bool>
output with its remap warps still to sample: the output set with
none, and whether to sample them (not in a draft, which leaves them
out and keeps the others).
Sourcepub fn output_warps(&mut self, done: &[Arg]) -> Result<()>
pub fn output_warps(&mut self, done: &[Arg]) -> Result<()>
The warps done so far set on the output, so page.toWorld answers
through them while the next remap is sampled.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Graph
impl Freeze for Graph
impl Move for Graph
impl RefUnwindSafe for Graph
impl Send for Graphwhere
RawVecInner: Send,
RawTable<usize>: Send,
BoxRaw<Op>: Send,
NodeRef<Owned, String, Value, LeafOrInternal>: Send,
BoxRaw<(String, Value)>: Send,
NodeRef<Owned, String, Name, LeafOrInternal>: Send,
BoxRaw<(String, Name)>: Send,
NodeRef<Owned, String, RoadClassSpec, LeafOrInternal>: Send,
BoxRaw<(String, RoadClassSpec)>: Send,
&'static str: Send,
BoxRaw<Expr>: Send,
Arc<Mutex<HashMap<String, Option<Look>>>>: Send,
BoxRaw<Grammar>: Send,
BoxRaw<Proj>: Send,
RawTable<(String, Arg)>: Send,
impl Sync for Graphwhere
RawVecInner: Sync,
RawTable<usize>: Sync,
BoxRaw<Op>: Sync,
NodeRef<Owned, String, Value, LeafOrInternal>: Sync,
BoxRaw<(String, Value)>: Sync,
NodeRef<Owned, String, Name, LeafOrInternal>: Sync,
BoxRaw<(String, Name)>: Sync,
NodeRef<Owned, String, RoadClassSpec, LeafOrInternal>: Sync,
BoxRaw<(String, RoadClassSpec)>: Sync,
BoxRaw<Expr>: Sync,
Arc<Mutex<HashMap<String, Option<Look>>>>: Sync,
BoxRaw<Grammar>: Sync,
BoxRaw<Proj>: Sync,
RawTable<(String, Arg)>: Sync,
impl Unpin for Graphwhere
*const u8 is !null: Unpin,
Box<Op>: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
*const LeafNode<String, Name> is !null: Unpin,
Box<(String, Name)>: Unpin,
*const LeafNode<String, RoadClassSpec> is !null: Unpin,
Box<(String, RoadClassSpec)>: Unpin,
&'static str: Unpin,
Box<Expr>: Unpin,
Arc<Mutex<HashMap<String, Option<Look>>>>: Unpin,
Box<Grammar>: Unpin,
Box<Proj>: Unpin,
impl UnsafeUnpin for Graphwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Builder>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Graphwhere
RawVecInner: UnwindSafe,
NonNull<u8>: UnwindSafe,
BoxRaw<Op>: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BTreeMap<String, Name>: UnwindSafe,
BTreeMap<String, RoadClassSpec>: UnwindSafe,
&'static str: UnwindSafe,
BoxRaw<Expr>: UnwindSafe,
Arc<Mutex<HashMap<String, Option<Look>>>>: UnwindSafe,
BoxRaw<Grammar>: UnwindSafe,
BoxRaw<Proj>: UnwindSafe,
HashMap<String, Arg>: UnwindSafe,
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> 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