Skip to main content

tzf_rs/pbgen/
tzf.v1.rs

1// This file is @generated by prost-build.
2/// Basic point data define.
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct Point {
5    #[prost(float, tag = "1")]
6    pub lng: f32,
7    #[prost(float, tag = "2")]
8    pub lat: f32,
9}
10/// Define a polygon, mostly based on GeoJSON's Polygon define.
11///
12/// Excerpt from RFC-9476 section 'Polygon'
13///
14///    -  A linear ring is a closed LineString with four or more positions.
15///    -  The first and last positions are equivalent, and they MUST contain
16///      identical values; their representation SHOULD also be identical.
17///    -  A linear ring is the boundary of a surface or the boundary of a
18///      hole in a surface.
19///    -  A linear ring MUST follow the right-hand rule with respect to the
20///      area it bounds, i.e., exterior rings are counterclockwise, and
21///      holes are clockwise.
22///
23///    Note: the \[GJ2008\] specification did not discuss linear ring winding
24///    order.  For backwards compatibility, parsers SHOULD NOT reject
25///    Polygons that do not follow the right-hand rule.
26///
27///    Though a linear ring is not explicitly represented as a GeoJSON
28///    geometry type, it leads to a canonical formulation of the Polygon
29///    geometry type definition as follows:
30///
31///    -  For type "Polygon", the "coordinates" member MUST be an array of
32///      linear ring coordinate arrays.
33///    -  For Polygons with more than one of these rings, the first MUST be
34///      the exterior ring, and any others MUST be interior rings.  The
35///      exterior ring bounds the surface, and the interior rings (if
36///      present) bound holes within the surface.
37///
38/// \[GJ2008\]: <https://geojson.org/geojson-spec>
39///
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct Polygon {
42    /// define the "exterior ring"
43    #[prost(message, repeated, tag = "1")]
44    pub points: ::prost::alloc::vec::Vec<Point>,
45    /// define the "interior rings" as holes
46    #[prost(message, repeated, tag = "2")]
47    pub holes: ::prost::alloc::vec::Vec<Polygon>,
48}
49/// Timezone is a timezone's all data.
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct Timezone {
52    #[prost(message, repeated, tag = "1")]
53    pub polygons: ::prost::alloc::vec::Vec<Polygon>,
54    #[prost(string, tag = "2")]
55    pub name: ::prost::alloc::string::String,
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct Timezones {
59    #[prost(message, repeated, tag = "1")]
60    pub timezones: ::prost::alloc::vec::Vec<Timezone>,
61    /// Reduced data will toggle neighbor search as plan b
62    #[prost(bool, tag = "2")]
63    pub reduced: bool,
64    #[prost(string, tag = "3")]
65    pub version: ::prost::alloc::string::String,
66}
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct CompressedPolygon {
69    #[prost(bytes = "vec", tag = "1")]
70    pub points: ::prost::alloc::vec::Vec<u8>,
71    #[prost(message, repeated, tag = "2")]
72    pub holes: ::prost::alloc::vec::Vec<CompressedPolygon>,
73}
74/// CompressedTimezonesItem designed for binary file as small as possible.
75#[derive(Clone, PartialEq, ::prost::Message)]
76pub struct CompressedTimezone {
77    #[prost(message, repeated, tag = "1")]
78    pub data: ::prost::alloc::vec::Vec<CompressedPolygon>,
79    #[prost(string, tag = "2")]
80    pub name: ::prost::alloc::string::String,
81}
82#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct CompressedTimezones {
84    #[prost(enumeration = "CompressMethod", tag = "1")]
85    pub method: i32,
86    #[prost(message, repeated, tag = "2")]
87    pub timezones: ::prost::alloc::vec::Vec<CompressedTimezone>,
88    #[prost(string, tag = "3")]
89    pub version: ::prost::alloc::string::String,
90}
91/// PreindexTimezone tile item.
92///
93/// The X/Y/Z are OSM style like map tile index values.
94#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
95pub struct PreindexTimezone {
96    #[prost(string, tag = "1")]
97    pub name: ::prost::alloc::string::String,
98    #[prost(int32, tag = "2")]
99    pub x: i32,
100    #[prost(int32, tag = "3")]
101    pub y: i32,
102    #[prost(int32, tag = "4")]
103    pub z: i32,
104}
105/// PreindexTimezones is all preindex timezone's dumps.
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct PreindexTimezones {
108    /// which zoom value the tiles generated
109    #[prost(int32, tag = "1")]
110    pub idx_zoom: i32,
111    /// which zoom value the tiles merge up with.
112    #[prost(int32, tag = "2")]
113    pub agg_zoom: i32,
114    #[prost(message, repeated, tag = "3")]
115    pub keys: ::prost::alloc::vec::Vec<PreindexTimezone>,
116    #[prost(string, tag = "4")]
117    pub version: ::prost::alloc::string::String,
118}
119/// Wrapper for a sequence of inline points used inside a RingSegment oneof.
120/// (proto3 does not allow repeated fields directly in a oneof.)
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct InlinePoints {
123    #[prost(message, repeated, tag = "1")]
124    pub points: ::prost::alloc::vec::Vec<Point>,
125}
126/// A ring segment: either inline points or a reference to a shared edge.
127/// Shared edges are stored once in TopoTimezones.shared_edges and referenced
128/// by their index; edge_reversed references the same edge but traversed in
129/// the opposite direction.
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct RingSegment {
132    #[prost(oneof = "ring_segment::Content", tags = "1, 2, 3")]
133    pub content: ::core::option::Option<ring_segment::Content>,
134}
135/// Nested message and enum types in `RingSegment`.
136pub mod ring_segment {
137    #[derive(Clone, PartialEq, ::prost::Oneof)]
138    pub enum Content {
139        #[prost(message, tag = "1")]
140        Inline(super::InlinePoints),
141        /// index into TopoTimezones.shared_edges (canonical direction)
142        #[prost(int32, tag = "2")]
143        EdgeForward(i32),
144        /// index into TopoTimezones.shared_edges (reversed direction)
145        #[prost(int32, tag = "3")]
146        EdgeReversed(i32),
147    }
148}
149/// A timezone polygon in topology format.
150/// The exterior ring is represented as an ordered sequence of segments.
151/// Holes are nested TopoPolygons.
152#[derive(Clone, PartialEq, ::prost::Message)]
153pub struct TopoPolygon {
154    #[prost(message, repeated, tag = "1")]
155    pub exterior: ::prost::alloc::vec::Vec<RingSegment>,
156    #[prost(message, repeated, tag = "2")]
157    pub holes: ::prost::alloc::vec::Vec<TopoPolygon>,
158}
159/// A timezone in topology format.
160#[derive(Clone, PartialEq, ::prost::Message)]
161pub struct TopoTimezone {
162    #[prost(message, repeated, tag = "1")]
163    pub polygons: ::prost::alloc::vec::Vec<TopoPolygon>,
164    #[prost(string, tag = "2")]
165    pub name: ::prost::alloc::string::String,
166}
167/// A shared boundary edge stored once in the global edge library.
168/// Rings reference it by index (forward or reversed) instead of repeating
169/// the point sequence.
170#[derive(Clone, PartialEq, ::prost::Message)]
171pub struct SharedEdge {
172    #[prost(int32, tag = "1")]
173    pub id: i32,
174    #[prost(message, repeated, tag = "2")]
175    pub points: ::prost::alloc::vec::Vec<Point>,
176}
177/// Timezones in topology format with shared-edge deduplication.
178/// Shared timezone boundaries are stored exactly once in shared_edges;
179/// rings reference them by ID rather than duplicating the point sequences.
180/// This format targets full-precision data where ~52% of boundary edges are
181/// shared, reducing the 96 MB full dataset by ~30–35 MB.
182#[derive(Clone, PartialEq, ::prost::Message)]
183pub struct TopoTimezones {
184    #[prost(message, repeated, tag = "1")]
185    pub shared_edges: ::prost::alloc::vec::Vec<SharedEdge>,
186    #[prost(message, repeated, tag = "2")]
187    pub timezones: ::prost::alloc::vec::Vec<TopoTimezone>,
188    #[prost(string, tag = "3")]
189    pub version: ::prost::alloc::string::String,
190}
191/// CompressedSharedEdge stores a shared boundary edge with its point sequence
192/// polyline-encoded (delta + zigzag, same algorithm as CompressedPolygon).
193#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
194pub struct CompressedSharedEdge {
195    #[prost(int32, tag = "1")]
196    pub id: i32,
197    /// polyline-encoded point sequence
198    #[prost(bytes = "vec", tag = "2")]
199    pub points: ::prost::alloc::vec::Vec<u8>,
200}
201/// CompressedInlinePoints stores a short inline ring segment as polyline bytes.
202#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
203pub struct CompressedInlinePoints {
204    /// polyline-encoded point sequence
205    #[prost(bytes = "vec", tag = "1")]
206    pub points: ::prost::alloc::vec::Vec<u8>,
207}
208/// CompressedRingSegment mirrors RingSegment with polyline-encoded inline points.
209#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
210pub struct CompressedRingSegment {
211    #[prost(oneof = "compressed_ring_segment::Content", tags = "1, 2, 3")]
212    pub content: ::core::option::Option<compressed_ring_segment::Content>,
213}
214/// Nested message and enum types in `CompressedRingSegment`.
215pub mod compressed_ring_segment {
216    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
217    pub enum Content {
218        #[prost(message, tag = "1")]
219        Inline(super::CompressedInlinePoints),
220        #[prost(int32, tag = "2")]
221        EdgeForward(i32),
222        #[prost(int32, tag = "3")]
223        EdgeReversed(i32),
224    }
225}
226/// CompressedTopoPolygon mirrors TopoPolygon with compressed ring segments.
227#[derive(Clone, PartialEq, ::prost::Message)]
228pub struct CompressedTopoPolygon {
229    #[prost(message, repeated, tag = "1")]
230    pub exterior: ::prost::alloc::vec::Vec<CompressedRingSegment>,
231    #[prost(message, repeated, tag = "2")]
232    pub holes: ::prost::alloc::vec::Vec<CompressedTopoPolygon>,
233}
234/// CompressedTopoTimezone mirrors TopoTimezone with compressed polygons.
235#[derive(Clone, PartialEq, ::prost::Message)]
236pub struct CompressedTopoTimezone {
237    #[prost(message, repeated, tag = "1")]
238    pub polygons: ::prost::alloc::vec::Vec<CompressedTopoPolygon>,
239    #[prost(string, tag = "2")]
240    pub name: ::prost::alloc::string::String,
241}
242/// CompressedTopoTimezones combines shared-edge deduplication with polyline
243/// coordinate compression. Shared edge point sequences and inline segments are
244/// stored as polyline bytes instead of repeated Point messages, significantly
245/// reducing file size on top of the deduplication savings.
246/// grid_index is an optional embedded 1°×1° candidate-reduction index built
247/// at compress time. When present, Finder uses it to skip full linear scans.
248#[derive(Clone, PartialEq, ::prost::Message)]
249pub struct CompressedTopoTimezones {
250    #[prost(enumeration = "CompressMethod", tag = "1")]
251    pub method: i32,
252    #[prost(message, repeated, tag = "2")]
253    pub shared_edges: ::prost::alloc::vec::Vec<CompressedSharedEdge>,
254    #[prost(message, repeated, tag = "3")]
255    pub timezones: ::prost::alloc::vec::Vec<CompressedTopoTimezone>,
256    #[prost(string, tag = "4")]
257    pub version: ::prost::alloc::string::String,
258    #[prost(message, optional, tag = "5")]
259    pub grid_index: ::core::option::Option<GridIndex>,
260}
261/// GridIndexCell records the timezone indices that intersect a single 1°×1° cell.
262/// tz_indices are 0-based positions into the timezones array of the companion
263/// CompressedTopoTimezones (or Timezones) file, matching the order used by Finder.items.
264#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
265pub struct GridIndexCell {
266    /// floor(longitude), -180..179
267    #[prost(sint32, tag = "1")]
268    pub lng: i32,
269    /// floor(latitude), -90..89
270    #[prost(sint32, tag = "2")]
271    pub lat: i32,
272    #[prost(uint32, repeated, tag = "3")]
273    pub tz_indices: ::prost::alloc::vec::Vec<u32>,
274}
275/// GridIndex is the complete 1°×1° candidate-reduction index.
276/// Only cells with at least one intersecting timezone are stored.
277#[derive(Clone, PartialEq, ::prost::Message)]
278pub struct GridIndex {
279    #[prost(message, repeated, tag = "1")]
280    pub cells: ::prost::alloc::vec::Vec<GridIndexCell>,
281    #[prost(string, tag = "2")]
282    pub version: ::prost::alloc::string::String,
283}
284#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
285#[repr(i32)]
286pub enum CompressMethod {
287    Unspecified = 0,
288    /// <https://developers.google.com/maps/documentation/utilities/polylinealgorithm>
289    Polyline = 1,
290}
291impl CompressMethod {
292    /// String value of the enum field names used in the ProtoBuf definition.
293    ///
294    /// The values are not transformed in any way and thus are considered stable
295    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
296    pub fn as_str_name(&self) -> &'static str {
297        match self {
298            Self::Unspecified => "COMPRESS_METHOD_UNSPECIFIED",
299            Self::Polyline => "COMPRESS_METHOD_POLYLINE",
300        }
301    }
302    /// Creates an enum from field names used in the ProtoBuf definition.
303    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
304        match value {
305            "COMPRESS_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
306            "COMPRESS_METHOD_POLYLINE" => Some(Self::Polyline),
307            _ => None,
308        }
309    }
310}