chiark / gitweb /
shapelib hidden: Spec for occultation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2021 15:35:17 +0000 (15:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Mar 2021 15:03:25 +0000 (15:03 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/shapelib-toml.rs

index b983f1e1a5b5ad4e8be2fb7758a091300ea26d14..f9f619fa4e83c80b28d0ce37bd2c6259c682a978 100644 (file)
@@ -134,6 +134,9 @@ pub struct GroupDetails {
   #[serde(default)]
   pub colours: HashMap<String, RecolourData>,
 
+  /// If specified, pieces in this group can be occulted.
+  pub occulted: Option<OccultationMethod>,
+
   /// One of `"Circle"` or `"Square"`, to define the outline shape.
   /// The size is taken from `size`.
   ///
@@ -142,6 +145,21 @@ pub struct GroupDetails {
   #[serde(flatten)] pub outline: Box<dyn shapelib::OutlineDefn>,
 }
 
+/// How pieces may be occulted.  Currently only one supported way.
+#[derive(Deserialize,Clone,Debug)]
+#[serde(tag="method")]
+pub enum OccultationMethod {
+  /// When occulted, display as a piece of a particular colour.
+  /// `colour` refers to one of the entries in
+  /// `GroupDetails::colours`.
+  ///
+  /// The description will be different too: `_colour` will be elided,
+  /// along with up to one of any spaces either side of it.
+  ByColour {
+    colour: String,
+  },
+}
+
 /// An entry in the `colours` table, specifying one recolouring.
 #[derive(Debug,Deserialize)]
 pub struct RecolourData {