objc2_ar_kit/generated/ARReferenceObject.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-foundation")]
8use objc2_foundation::*;
9#[cfg(feature = "objc2-ui-kit")]
10use objc2_ui_kit::*;
11
12use crate::*;
13
14extern "C" {
15 /// [Apple's documentation](https://developer.apple.com/documentation/arkit/arreferenceobjectarchiveextension?language=objc)
16 #[cfg(feature = "objc2-foundation")]
17 pub static ARReferenceObjectArchiveExtension: &'static NSString;
18}
19
20#[cfg(feature = "objc2")]
21extern_class!(
22 /// A reference object to track in the scene.
23 ///
24 /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arreferenceobject?language=objc)
25 #[unsafe(super(NSObject))]
26 #[derive(Debug, PartialEq, Eq, Hash)]
27 #[cfg(feature = "objc2")]
28 pub struct ARReferenceObject;
29);
30
31#[cfg(feature = "objc2")]
32unsafe impl Send for ARReferenceObject {}
33
34#[cfg(feature = "objc2")]
35unsafe impl Sync for ARReferenceObject {}
36
37#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
38extern_conformance!(
39 unsafe impl NSCoding for ARReferenceObject {}
40);
41
42#[cfg(feature = "objc2")]
43extern_conformance!(
44 unsafe impl NSObjectProtocol for ARReferenceObject {}
45);
46
47#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
48extern_conformance!(
49 unsafe impl NSSecureCoding for ARReferenceObject {}
50);
51
52#[cfg(feature = "objc2")]
53impl ARReferenceObject {
54 extern_methods!(
55 #[cfg(feature = "objc2-foundation")]
56 /// An optional name used to identify the object.
57 ///
58 /// This property is not atomic.
59 ///
60 /// # Safety
61 ///
62 /// This might not be thread-safe.
63 #[unsafe(method(name))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn name(&self) -> Option<Retained<NSString>>;
66
67 #[cfg(feature = "objc2-foundation")]
68 /// Setter for [`name`][Self::name].
69 ///
70 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
71 ///
72 /// # Safety
73 ///
74 /// This might not be thread-safe.
75 #[unsafe(method(setName:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn setName(&self, name: Option<&NSString>);
78
79 #[cfg(feature = "objc2-foundation")]
80 /// The AR resource group name for this object.
81 ///
82 /// If this object was loaded via an AR resource group in the Xcode asset catalogue this property will have the name of the resource group,
83 /// else be set to nil.
84 ///
85 /// This property is not atomic.
86 ///
87 /// # Safety
88 ///
89 /// This might not be thread-safe.
90 #[unsafe(method(resourceGroupName))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn resourceGroupName(&self) -> Option<Retained<NSString>>;
93
94 #[cfg(feature = "ARPointCloud")]
95 /// The feature points of the object.
96 ///
97 /// This property is not atomic.
98 ///
99 /// # Safety
100 ///
101 /// This might not be thread-safe.
102 #[unsafe(method(rawFeaturePoints))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn rawFeaturePoints(&self) -> Retained<ARPointCloud>;
105
106 #[cfg(feature = "objc2-foundation")]
107 /// Returns the set of ARReferenceObjects in the specified resource group and bundle.
108 ///
109 ///
110 /// Parameter `name`: The name of the resource group.
111 ///
112 /// Parameter `bundle`: The bundle containing the image file or asset catalog. Specify nil to search the app’s main bundle.
113 ///
114 /// Returns: The set of reference objects or nil on error.
115 #[unsafe(method(referenceObjectsInGroupNamed:bundle:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn referenceObjectsInGroupNamed_bundle(
118 name: &NSString,
119 bundle: Option<&NSBundle>,
120 ) -> Option<Retained<NSSet<ARReferenceObject>>>;
121
122 #[cfg(feature = "objc2-foundation")]
123 /// Initializes a new reference object with the contents of an archive at the specified URL.
124 ///
125 /// Parameter `url`: The URL from which to read data (.arobject archive).
126 ///
127 /// Parameter `error`: The error to populate if the object could not be initialized.
128 #[unsafe(method(initWithArchiveURL:error:_))]
129 #[unsafe(method_family = init)]
130 pub unsafe fn initWithArchiveURL_error(
131 this: Allocated<Self>,
132 url: &NSURL,
133 ) -> Result<Retained<Self>, Retained<NSError>>;
134
135 #[cfg(all(feature = "objc2-foundation", feature = "objc2-ui-kit"))]
136 /// Exports the object as an archive at the given URL.
137 ///
138 ///
139 /// The URL path should use ARReferenceObjectArchiveExtension (.arobject) for the file extension.
140 /// If serialization across devices is desired, NSKeyedArchiver should be used instead.
141 ///
142 /// Parameter `url`: The URL at which to write the exported object.
143 ///
144 /// Parameter `previewImage`: An optional preview image to include in the archive.
145 ///
146 /// Parameter `error`: The error to populate if the write is not successful.
147 ///
148 /// Returns: YES if the location is written successfully, otherwise NO.
149 #[unsafe(method(exportObjectToURL:previewImage:error:_))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn exportObjectToURL_previewImage_error(
152 &self,
153 url: &NSURL,
154 preview_image: Option<&UIImage>,
155 ) -> Result<(), Retained<NSError>>;
156
157 #[cfg(feature = "objc2-foundation")]
158 /// Returns a new reference object by aligning and merging the provided object with this reference.
159 ///
160 /// This can be used to combine multiple scans of the same object for detection in different conditions. The object being merged
161 /// must share similar feature points for the merge to succeed.
162 ///
163 /// Parameter `object`: The reference object to align and merge.
164 ///
165 /// Parameter `error`: The error to populate if the merge is not successful.
166 ///
167 /// Returns: A new reference object combining features of both scans or nil if the merge was not successful.
168 #[unsafe(method(referenceObjectByMergingObject:error:_))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn referenceObjectByMergingObject_error(
171 &self,
172 object: &ARReferenceObject,
173 ) -> Result<Retained<ARReferenceObject>, Retained<NSError>>;
174
175 /// Unavailable
176 #[unsafe(method(init))]
177 #[unsafe(method_family = init)]
178 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180 #[unsafe(method(new))]
181 #[unsafe(method_family = new)]
182 pub unsafe fn new() -> Retained<Self>;
183 );
184}