chiark / gitweb /
deck: Insist that it must be a rectangle
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 22 Mar 2021 03:10:20 +0000 (03:10 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 23 Mar 2021 22:42:43 +0000 (22:42 +0000)
We need this for the occultation region

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/deck.rs

index 3e965e395f9fbaabc2d9c7458a49eb6195113733..868062e1c4bff8fc2780723f25e03d480747db23 100644 (file)
@@ -11,7 +11,7 @@ pub const DISABLED_DESC: &str = "a pickup deck (disabled)";
 
 #[derive(Debug,Serialize,Deserialize)]
 struct Deck {
-  shape: GenericSimpleShape<(), Outline>,
+  shape: GenericSimpleShape<(), shapelib::Rectangle>,
 }
 
 #[dyn_upcast]
@@ -36,9 +36,13 @@ impl PieceSpec for piece_specs::Deck {
       edges: self.edges.clone(),
       edge_width: self.edge_width,
     };
+    let shape = match self.shape {
+      Outline::Rectangle(r) => r,
+      _ => throw!(SpecError::UnsupportedShape),
+    };
     let shape = GenericSimpleShape::new(
       (),
-      self.shape.clone(),
+      shape.clone(),
       "magic-pickupdeck",
       &common)?;
     if shape.count_faces() != 2 {