Skip to main content

geoengine_api_client/models/
spatial_partition2_d.rs

1/*
2 * Geo Engine API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 0.9.0
7 * Contact: dev@geoengine.de
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// SpatialPartition2D : A partition of space that include the upper left but excludes the lower right coordinate
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct SpatialPartition2D {
17    #[serde(rename = "lowerRightCoordinate")]
18    pub lower_right_coordinate: Box<models::Coordinate2D>,
19    #[serde(rename = "upperLeftCoordinate")]
20    pub upper_left_coordinate: Box<models::Coordinate2D>,
21}
22
23impl SpatialPartition2D {
24    /// A partition of space that include the upper left but excludes the lower right coordinate
25    pub fn new(lower_right_coordinate: models::Coordinate2D, upper_left_coordinate: models::Coordinate2D) -> SpatialPartition2D {
26        SpatialPartition2D {
27            lower_right_coordinate: Box::new(lower_right_coordinate),
28            upper_left_coordinate: Box::new(upper_left_coordinate),
29        }
30    }
31}
32
33impl std::fmt::Display for SpatialPartition2D {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        write!(
36            f,
37            "{xmin},{ymin},{xmax},{ymax}",
38            xmin = self.upper_left_coordinate.x,
39            ymin = self.lower_right_coordinate.y,
40            xmax = self.lower_right_coordinate.x,
41            ymax = self.upper_left_coordinate.y
42        )
43    }
44}