use bland::{Figure, GraticuleOpts, PaperSize, Projection, Stroke};
fn main() {
let xs: Vec<f64> = vec![-180.0, 180.0, 180.0, -180.0, -180.0];
let ys: Vec<f64> = vec![-70.0, -70.0, 70.0, 70.0, -70.0];
let cont_x: Vec<f64> = vec![10.0, 30.0, 35.0, 25.0, 20.0, 5.0, 10.0];
let cont_y: Vec<f64> = vec![5.0, 0.0, 15.0, 30.0, 35.0, 25.0, 5.0];
let fig = Figure::new()
.size(PaperSize::A4Landscape)
.projection(Projection::Mercator)
.title("Mercator projection")
.xlim(-180.0, 180.0)
.ylim(-70.0, 75.0)
.graticule(GraticuleOpts {
lon_step: 30.0,
lat_step: 30.0,
..GraticuleOpts::default()
})
.polygon(&xs, &ys, |p| p.stroke(Stroke::Solid))
.polygon(&cont_x, &cont_y, |p| {
p.label("continent").hatch(bland::Hatch::DotsSparse)
})
.legend_bottom_left();
std::fs::create_dir_all("out").expect("create out/");
std::fs::write("out/mercator.svg", fig.to_svg()).expect("write svg");
println!("wrote out/mercator.svg");
}