1use crate::point::Point3d;
2use geo::Polygon;
3use serde::{Deserialize, Serialize};
4use std::time::SystemTime;
5
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7pub struct Polygon3D {
8 points: Vec<Point3d>,
9}
10
11impl Polygon3D {
12 pub fn new(points: Vec<Point3d>) -> Self {
13 Self { points }
14 }
15
16 pub fn points(&self) -> &Vec<Point3d> {
17 &self.points
18 }
19}
20
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct PolygonDynamic {
23 pub polygon: Polygon,
24 pub timestamp: SystemTime,
25}
26
27impl PolygonDynamic {
28 pub fn new(polygon: Polygon, timestamp: SystemTime) -> Self {
29 Self { polygon, timestamp }
30 }
31
32 pub fn polygon(&self) -> &Polygon {
33 &self.polygon
34 }
35
36 pub fn timestamp(&self) -> &SystemTime {
37 &self.timestamp
38 }
39}
40
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42pub struct PolygonDynamic3D {
43 pub polygon: Polygon3D,
44 pub timestamp: SystemTime,
45}
46
47impl PolygonDynamic3D {
48 pub fn new(polygon: Polygon3D, timestamp: SystemTime) -> Self {
49 Self { polygon, timestamp }
50 }
51
52 pub fn polygon(&self) -> &Polygon3D {
53 &self.polygon
54 }
55
56 pub fn timestamp(&self) -> &SystemTime {
57 &self.timestamp
58 }
59}