From: Ian Jackson Date: Sun, 20 Sep 2020 22:27:02 +0000 (+0100) Subject: shapelib: wip, still does not compile X-Git-Tag: otter-0.2.0~921 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=55ebd64770f49fe97ebffcb4cfd34d2397c3a592;p=otter.git shapelib: wip, still does not compile Signed-off-by: Ian Jackson --- diff --git a/src/pieces.rs b/src/pieces.rs index 842ddfdb..d5df249a 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -18,7 +18,7 @@ struct SimpleShape { colours : ColourMap, } -const SELECT_SCALE : f64 = 1.1; +pub const SELECT_SCALE : f64 = 1.1; #[derive(Copy,Clone,Debug,Error,Serialize,Deserialize)] pub enum SVGProcessingError { diff --git a/src/shapelib.rs b/src/shapelib.rs index 1716c5b3..ad007ac7 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -291,6 +291,15 @@ struct Circle { diam: f64 } #[typetag::serde(name="Circle")] impl Outline for Circle { + #[throws(IE)] + fn surround_path(&self, _pri : &PieceRenderInstructions) -> Html { + svg_circle_path(self.diam * SELECT_SCALE)? + } + #[throws(IE)] + fn thresh_dragraise(&self, _pri : &PieceRenderInstructions) + -> Option { + Some(self.diam / 2) + } } #[derive(Deserialize,Debug)] @@ -299,6 +308,7 @@ struct CircleDefn { } impl OutlineDefn for CircleDefn { #[throws(LibraryLoadError)] fn check(&self, lgd: &GroupData) { Self::get_size(lgd)?; } + #[throws(InternalError)] fn load(&self, lgd: &GroupData) -> Box { Box::new(Circle { diam: Self::get_size(lgd).unrap()