Expand description
The library for Rust: the same functions a JavaScript or Python profile
calls, as methods. Handles are typed (Features, Area, Lines);
options are objects (crate::obj!), with the keys the library documents
(drawland.d.ts, the reference at draw.land/docs).
use drawland_graph::{obj, Graph};
let mut g = Graph::new(Some((37.8053, -122.4436)));
g.output(obj! { "width" => "6in", "height" => "4in", "scale" => "1:10000" })?;
let water = g.features().tiles(&["water"])?;
let sea = g.areas().polygons(&water)?;
let waves = g.fills().fill(obj! { "in" => &sea, "pattern" => "waves", "spacing" => "0.8mm" })?;
g.draw(obj! { "id" => "water", "from" => &waves })?;
let centre = g.world().center()?;
assert!((centre.0 - 37.8053).abs() < 1e-9);Structs§
- Area
- An area (
areas.*,page.frame, a module’s area). - Areas
Api areas.*: shapes on the page.- Compose
Api compose.*: stacking, masks, and the plotter’s steps.- Features
- A set of map features (
features.*). - Features
Api features.*: what to read from the map.- Fills
Api fills.*: patterns inside areas.- Lines
- Lines (
lines.*,fills.fill, a module’s output). - Lines
Api lines.*: strokes.- Module
modules.labels(…)or a graticule: parts made when asked for withModule::area, [Module::part]…- Modules
Api modules.*: roads, labels, graticules.- PageApi
page.*: the paper, in mm from its top left.- Roads
modules.roads(…): what the roads module publishes.- World
Api world.*: the ground under the page.