objc2_map_kit/generated/
MKGeometry.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-location")]
9use objc2_core_location::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14#[cfg(feature = "objc2-core-location")]
16#[repr(C)]
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub struct MKCoordinateSpan {
19 pub latitudeDelta: CLLocationDegrees,
20 pub longitudeDelta: CLLocationDegrees,
21}
22
23#[cfg(feature = "objc2-core-location")]
24unsafe impl Encode for MKCoordinateSpan {
25 const ENCODING: Encoding = Encoding::Struct(
26 "?",
27 &[<CLLocationDegrees>::ENCODING, <CLLocationDegrees>::ENCODING],
28 );
29}
30
31#[cfg(feature = "objc2-core-location")]
32unsafe impl RefEncode for MKCoordinateSpan {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36#[cfg(feature = "objc2-core-location")]
38#[repr(C)]
39#[derive(Clone, Copy, Debug, PartialEq)]
40pub struct MKCoordinateRegion {
41 pub center: CLLocationCoordinate2D,
42 pub span: MKCoordinateSpan,
43}
44
45#[cfg(feature = "objc2-core-location")]
46unsafe impl Encode for MKCoordinateRegion {
47 const ENCODING: Encoding = Encoding::Struct(
48 "?",
49 &[
50 <CLLocationCoordinate2D>::ENCODING,
51 <MKCoordinateSpan>::ENCODING,
52 ],
53 );
54}
55
56#[cfg(feature = "objc2-core-location")]
57unsafe impl RefEncode for MKCoordinateRegion {
58 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern "C-unwind" {
66 #[cfg(feature = "objc2-core-location")]
67 pub fn MKCoordinateRegionMakeWithDistance(
68 center_coordinate: CLLocationCoordinate2D,
69 latitudinal_meters: CLLocationDistance,
70 longitudinal_meters: CLLocationDistance,
71 ) -> MKCoordinateRegion;
72}
73
74#[repr(C)]
76#[derive(Clone, Copy, Debug, PartialEq)]
77pub struct MKMapPoint {
78 pub x: c_double,
79 pub y: c_double,
80}
81
82unsafe impl Encode for MKMapPoint {
83 const ENCODING: Encoding = Encoding::Struct("?", &[<c_double>::ENCODING, <c_double>::ENCODING]);
84}
85
86unsafe impl RefEncode for MKMapPoint {
87 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
88}
89
90#[repr(C)]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub struct MKMapSize {
94 pub width: c_double,
95 pub height: c_double,
96}
97
98unsafe impl Encode for MKMapSize {
99 const ENCODING: Encoding = Encoding::Struct("?", &[<c_double>::ENCODING, <c_double>::ENCODING]);
100}
101
102unsafe impl RefEncode for MKMapSize {
103 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106#[repr(C)]
108#[derive(Clone, Copy, Debug, PartialEq)]
109pub struct MKMapRect {
110 pub origin: MKMapPoint,
111 pub size: MKMapSize,
112}
113
114unsafe impl Encode for MKMapRect {
115 const ENCODING: Encoding =
116 Encoding::Struct("?", &[<MKMapPoint>::ENCODING, <MKMapSize>::ENCODING]);
117}
118
119unsafe impl RefEncode for MKMapRect {
120 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
121}
122
123#[cfg(feature = "objc2-core-foundation")]
125pub type MKZoomScale = CGFloat;
126
127extern "C" {
128 pub static MKMapSizeWorld: MKMapSize;
130}
131
132extern "C" {
133 pub static MKMapRectWorld: MKMapRect;
135}
136
137extern "C-unwind" {
138 #[cfg(feature = "objc2-core-location")]
139 pub fn MKMapPointForCoordinate(coordinate: CLLocationCoordinate2D) -> MKMapPoint;
140}
141
142extern "C-unwind" {
143 #[cfg(feature = "objc2-core-location")]
144 pub fn MKCoordinateForMapPoint(map_point: MKMapPoint) -> CLLocationCoordinate2D;
145}
146
147extern "C-unwind" {
148 #[cfg(feature = "objc2-core-location")]
149 pub fn MKMetersPerMapPointAtLatitude(latitude: CLLocationDegrees) -> CLLocationDistance;
150}
151
152extern "C-unwind" {
153 #[cfg(feature = "objc2-core-location")]
154 pub fn MKMapPointsPerMeterAtLatitude(latitude: CLLocationDegrees) -> c_double;
155}
156
157extern "C-unwind" {
158 #[cfg(feature = "objc2-core-location")]
159 pub fn MKMetersBetweenMapPoints(a: MKMapPoint, b: MKMapPoint) -> CLLocationDistance;
160}
161
162extern "C" {
163 pub static MKMapRectNull: MKMapRect;
165}
166
167extern "C-unwind" {
206 pub fn MKMapRectUnion(rect1: MKMapRect, rect2: MKMapRect) -> MKMapRect;
207}
208
209extern "C-unwind" {
210 pub fn MKMapRectIntersection(rect1: MKMapRect, rect2: MKMapRect) -> MKMapRect;
211}
212
213extern "C-unwind" {
214 pub fn MKMapRectInset(rect: MKMapRect, dx: c_double, dy: c_double) -> MKMapRect;
215}
216
217extern "C-unwind" {
218 pub fn MKMapRectOffset(rect: MKMapRect, dx: c_double, dy: c_double) -> MKMapRect;
219}
220
221extern "C-unwind" {
222 #[cfg(feature = "objc2-core-foundation")]
223 pub fn MKMapRectDivide(
224 rect: MKMapRect,
225 slice: NonNull<MKMapRect>,
226 remainder: NonNull<MKMapRect>,
227 amount: c_double,
228 edge: CGRectEdge,
229 );
230}
231
232#[inline]
233pub unsafe extern "C-unwind" fn MKMapRectContainsPoint(rect: MKMapRect, point: MKMapPoint) -> bool {
234 extern "C-unwind" {
235 fn MKMapRectContainsPoint(rect: MKMapRect, point: MKMapPoint) -> Bool;
236 }
237 unsafe { MKMapRectContainsPoint(rect, point) }.as_bool()
238}
239
240#[inline]
241pub unsafe extern "C-unwind" fn MKMapRectContainsRect(rect1: MKMapRect, rect2: MKMapRect) -> bool {
242 extern "C-unwind" {
243 fn MKMapRectContainsRect(rect1: MKMapRect, rect2: MKMapRect) -> Bool;
244 }
245 unsafe { MKMapRectContainsRect(rect1, rect2) }.as_bool()
246}
247
248#[inline]
249pub unsafe extern "C-unwind" fn MKMapRectIntersectsRect(
250 rect1: MKMapRect,
251 rect2: MKMapRect,
252) -> bool {
253 extern "C-unwind" {
254 fn MKMapRectIntersectsRect(rect1: MKMapRect, rect2: MKMapRect) -> Bool;
255 }
256 unsafe { MKMapRectIntersectsRect(rect1, rect2) }.as_bool()
257}
258
259extern "C-unwind" {
260 #[cfg(feature = "objc2-core-location")]
261 pub fn MKCoordinateRegionForMapRect(rect: MKMapRect) -> MKCoordinateRegion;
262}
263
264#[inline]
265pub unsafe extern "C-unwind" fn MKMapRectSpans180thMeridian(rect: MKMapRect) -> bool {
266 extern "C-unwind" {
267 fn MKMapRectSpans180thMeridian(rect: MKMapRect) -> Bool;
268 }
269 unsafe { MKMapRectSpans180thMeridian(rect) }.as_bool()
270}
271
272extern "C-unwind" {
273 pub fn MKMapRectRemainder(rect: MKMapRect) -> MKMapRect;
274}
275
276mod private_NSValueMapKitGeometryExtensions {
277 pub trait Sealed {}
278}
279
280pub unsafe trait NSValueMapKitGeometryExtensions:
282 ClassType + Sized + private_NSValueMapKitGeometryExtensions::Sealed
283{
284 extern_methods!(
285 #[cfg(feature = "objc2-core-location")]
286 #[unsafe(method(valueWithMKCoordinate:))]
287 #[unsafe(method_family = none)]
288 unsafe fn valueWithMKCoordinate(coordinate: CLLocationCoordinate2D) -> Retained<NSValue>;
289
290 #[cfg(feature = "objc2-core-location")]
291 #[unsafe(method(valueWithMKCoordinateSpan:))]
292 #[unsafe(method_family = none)]
293 unsafe fn valueWithMKCoordinateSpan(span: MKCoordinateSpan) -> Retained<NSValue>;
294
295 #[cfg(feature = "objc2-core-location")]
296 #[unsafe(method(MKCoordinateValue))]
297 #[unsafe(method_family = none)]
298 unsafe fn MKCoordinateValue(&self) -> CLLocationCoordinate2D;
299
300 #[cfg(feature = "objc2-core-location")]
301 #[unsafe(method(MKCoordinateSpanValue))]
302 #[unsafe(method_family = none)]
303 unsafe fn MKCoordinateSpanValue(&self) -> MKCoordinateSpan;
304 );
305}
306
307impl private_NSValueMapKitGeometryExtensions::Sealed for NSValue {}
308unsafe impl NSValueMapKitGeometryExtensions for NSValue {}