1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Information about the location of items on a document page.</p>
/// <p>For additional information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/API_Geometry.html">Geometry</a> in the Amazon Textract API reference.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Geometry {
/// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
pub bounding_box: ::std::option::Option<crate::types::BoundingBox>,
/// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
pub polygon: ::std::option::Option<::std::vec::Vec<crate::types::Point>>,
}
impl Geometry {
/// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
pub fn bounding_box(&self) -> ::std::option::Option<&crate::types::BoundingBox> {
self.bounding_box.as_ref()
}
/// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.polygon.is_none()`.
pub fn polygon(&self) -> &[crate::types::Point] {
self.polygon.as_deref().unwrap_or_default()
}
}
impl Geometry {
/// Creates a new builder-style object to manufacture [`Geometry`](crate::types::Geometry).
pub fn builder() -> crate::types::builders::GeometryBuilder {
crate::types::builders::GeometryBuilder::default()
}
}
/// A builder for [`Geometry`](crate::types::Geometry).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GeometryBuilder {
pub(crate) bounding_box: ::std::option::Option<crate::types::BoundingBox>,
pub(crate) polygon: ::std::option::Option<::std::vec::Vec<crate::types::Point>>,
}
impl GeometryBuilder {
/// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
pub fn bounding_box(mut self, input: crate::types::BoundingBox) -> Self {
self.bounding_box = ::std::option::Option::Some(input);
self
}
/// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
pub fn set_bounding_box(mut self, input: ::std::option::Option<crate::types::BoundingBox>) -> Self {
self.bounding_box = input;
self
}
/// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
pub fn get_bounding_box(&self) -> &::std::option::Option<crate::types::BoundingBox> {
&self.bounding_box
}
/// Appends an item to `polygon`.
///
/// To override the contents of this collection use [`set_polygon`](Self::set_polygon).
///
/// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
pub fn polygon(mut self, input: crate::types::Point) -> Self {
let mut v = self.polygon.unwrap_or_default();
v.push(input);
self.polygon = ::std::option::Option::Some(v);
self
}
/// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
pub fn set_polygon(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Point>>) -> Self {
self.polygon = input;
self
}
/// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
pub fn get_polygon(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Point>> {
&self.polygon
}
/// Consumes the builder and constructs a [`Geometry`](crate::types::Geometry).
pub fn build(self) -> crate::types::Geometry {
crate::types::Geometry {
bounding_box: self.bounding_box,
polygon: self.polygon,
}
}
}