pub trait Hatch {
    fn hatch(
        &self,
        pattern: Hatches,
        angle: f64,
        scale: f64,
        inset: f64
    ) -> Result<MultiLineString<f64>, InvalidHatchGeometry>; }
Expand description

Hatch

Trait which can be implemented for various geo_types, to provide fills on their interiors. Requires an instance of a Pattern type <P>, which will be used to generate the hatch lines. Angle is the angle to rotate the hatch pattern in Radians. Scale is the distance between lines (although other Pattern types may not honor this, and generate alternative based scales for the 1.0 value. Inset is the distance to inset the boundary before filling, and it’s a good idea to inset by approximately the scale value to keep the line endpoints inside of the boundary/container.

Example hatching


use geo_types::Polygon;
use wkt::{TryFromWkt, Wkt, geo_types_from_wkt} ;
use aoer_plotty_rs::geo_types::hatch::{Hatch, Hatches};
use std::str::FromStr;
let geoms: Polygon::<f64> = Polygon::try_from(
    Wkt::<f64>::from_str("POLYGON ((350 100, 450 450, 150 400, 100 200, 350 100), (200 300, 350 350, 300 200, 200 300))")
        .expect("Failed to load WKT"))
    .expect("Failed to load box");
let hatch = geoms.hatch(Hatches::line(), 45.0, 5.0, 2.5).expect("Got some hatches in here failin'");

hatch-example-1

Required Methods

Implementations on Foreign Types

Implementors