egml_core/model/geometry/primitives/
surface.rs1use crate::Error;
2use crate::model::geometry::{DirectPosition, LinearRing};
3use crate::operations::geometry::Geometry;
4use nalgebra::Isometry3;
5
6#[derive(Debug, Clone, PartialEq)]
7pub struct SurfaceProperty {
8 pub href: String,
9 pub linear_ring: Option<LinearRing>,
10}
11
12impl SurfaceProperty {
13 pub fn new(href: String, linear_ring: Option<LinearRing>) -> Result<Self, Error> {
14 Ok(Self { href, linear_ring })
15 }
16}
17
18impl Geometry for SurfaceProperty {
19 fn points(&self) -> Vec<&DirectPosition> {
20 match &self.linear_ring {
21 Some(ring) => ring.points(),
22 None => Vec::new(),
23 }
24 }
25
26 fn apply_transform(&mut self, m: &Isometry3<f64>) {
27 if let Some(solid) = &mut self.linear_ring {
28 solid.apply_transform(m);
29 }
30 }
31}