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