WTArchitectView Class Reference
Inherits from | UIView |
---|---|
Declared in | WTArchitectView.h |
Overview
WTArchitectView class
This class allows you to load and display the content from ARchitect Worlds. It is the “Entry Point” to the SDK which exposes all SDK functionality. Instantiating and adding this Component to the UI should be sufficient to use ARchitect in any application.
WTArchitectView+Plugins defines some methods that can be used to register C++ plugins.
To use C++ code within your Objective-C class, set the file extension to .mm or change the type to Objective-C++ source in the Xcode Identity and Type inspector.
Plugins need to derive from wikitude::sdk::Plugin and have to be passed as std::shared_ptr.
Managing the Delegate
delegate
The object that acts as the delegate of the receiving WTArchitectView
@property (nonatomic, weak) id<WTArchitectViewDelegate> delegate
Declared In
WTArchitectView.h
requiredFeatures
Architect Worlds can be loaded with different required features. Features specifies which SDK functionalities are required by the World. For example the WTFeature_ImageTracking does not start any GPS location related APIs and the user is not interrupted with a location access alert. As a result any geo related SDK functionalities do not work but the target image recognition is faster and the SDK does not cosume as much CPU performance than with an enabled GPS module. Choose the most suitable mode for your ARchitect World to experience the full functionality and the best performance.
@property (nonatomic, assign) WTFeatures requiredFeatures
Declared In
WTArchitectView.h
Accessing Device Compatibility
+ isDeviceSupportedForRequiredFeatures:error:
This method should be used to determine if the current device supports all features that are required. (Deprecated: Use isDeviceSupportingFeatures:error: instead.)
+ (BOOL)isDeviceSupportedForRequiredFeatures:(WTFeatures)requiredFeatures error:(NSError **)error
Parameters
requiredFeatures |
Bitmask that describes wich features are used from the Wikitude SDK. |
---|---|
error |
An error object containing more information why the device is not supported if the return value is NO. |
Return Value
true if the device supports all required features, false otherwise.
Declared In
WTArchitectView.h
+ isDeviceSupportingFeatures:error:
This method should be used to determine if the current device supports all features that are required.
+ (BOOL)isDeviceSupportingFeatures:(WTFeatures)requiredFeatures error:(NSError **)error
Parameters
requiredFeatures |
Bitmask that describes wich features are used from the Wikitude SDK. |
---|---|
error |
An error object containing more information why the device is not supported if the return value is NO. |
Return Value
true if the device supports all required features, false otherwise.
Declared In
WTArchitectView.h
Accessing ARchitect settings
+ sdkVersion
Use this method to get the current ARchitect version number
+ (NSString *)sdkVersion
Return Value
The current available ARchitect verison within the SDK.
Declared In
WTArchitectView.h
+ SDKBuildInformation
Use this method to get information about the sdk build.
+ (WTSDKBuildInformation *)SDKBuildInformation
Return Value
The current available SDKBuildInformation within the SKD.
Declared In
WTArchitectView.h
– setLicenseKey:
Enables SDK features based on the given license key.
- (void)setLicenseKey:(NSString *)licenseKey
Parameters
licenseKey |
Your developer key, provided with your licence information. |
---|
Declared In
WTArchitectView.h
Loading Architect Worlds
– loadArchitectWorldFromURL:
Loads the ARchitect World specified by the given URL. If an ARchitect World is already loaded all it’s created objects are destroyed before the new one will be loaded.
- (WTNavigation *)loadArchitectWorldFromURL:(NSURL *)architectWorldURL
Parameters
architectWorldURL |
The URL that points to the ARchitect world. |
---|
Return Value
WTNavigation a navigation object representing the requested URL load and the finally loaded URL (They may differ because of some redirects)
Discussion
Architect Worlds can be either loaded from the application bundle or a remote server. It is possible to load a different Architect World with a different augmented reality mode using the same architect view instance.
Declared In
WTArchitectView.h
– reloadArchitectWorld
Reloads the Architect World URL that was passed at last to the -loadArchitectWorldFromURL:withRequiredFeatures
method.
- (void)reloadArchitectWorld
Discussion
Reloading an Architect World does not produce a new WTNavigation
object. Instead the old one is still valid but with all parameters resetted. This means that both, isLoading
and wasInterrupted
will represent the current Architect World reload status.
Declared In
WTArchitectView.h
Managing the WTArchitectView updates
– start:completion:
Starts activity of the ARchitect view (starts UI updates of background camera, AR objects etc).
- (void)start:(nullable void ( ^ ) ( WTArchitectStartupConfiguration *configuration ))startupHandler completion:(nullable void ( ^ ) ( BOOL isRunning , NSError *error ))completionHandler
Parameters
startupHandler |
A block which contains a configuration object as parameter. The WTStartupConfiguration parameter can be used to specify the startup behaviour in more detail. |
---|---|
completionHandler |
A block which provices information if the SDK could be started or not. |
Discussion
Since version 4.1 of the Wikitude SDK, the SDK startup behaviour can be defined in more detail. It is now possible to define the camera position and camera options when the SDK starts. See WTStartupConfiguration for more information about the available options and there possible values. Most of the settings can also be set using the JS API.
As a specific example, use the configuration object to start the SDK with an active front camera instead of the default rear cam.
Declared In
WTArchitectView.h
– stop
Stops all activity of the ARchitect view (suspends UI updates of background camera, AR objects etc).
- (void)stop
Declared In
WTArchitectView.h
Interacting with Architect Worlds
– callJavaScript:
Executes the passed JavaScript string in the context of the currently loaded ARchitect World. This can be used to pass data to the ARchitect World or to notify it of external events.
- (void)callJavaScript:(NSString *)javaScript
Parameters
javaScript |
A string, representing the javascript code which should be executed. |
---|
Declared In
WTArchitectView.h
Managing the WTArchitectView rotation behavior
– shouldTransitionToSize:withTransitionCoordinator:
This method can be called to force a layout of this view including all it’s subviews. In general this is not necessary as this view overrides layoutSubviews to handle view size changes automatically
- (void)shouldTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)transitionCoordinator
Declared In
WTArchitectView.h
– setShouldRotate:toInterfaceOrientation:
Use this method to set the auto rotation behavior for the WTArchitectview.
- (void)setShouldRotate:(BOOL)shouldAutoRotate toInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
Parameters
shouldAutoRotate |
Should your SDK view change orientation automatically |
---|---|
interfaceOrientation |
The interface orientation the device is going to take on |
Discussion
You should pass YES if you wan’t your WTArchitectView to autoamtically change rotation to the new interface orientation.
Declared In
WTArchitectView.h
– isRotatingToInterfaceOrientation
Retrieves the current auto rotate behavior.
- (BOOL)isRotatingToInterfaceOrientation
Return Value
The current auto rotation option, used by the SDK.
Declared In
WTArchitectView.h
Accessing WTArchitectView content
– captureScreenWithMode:usingSaveMode:saveOptions:context:
Triggers the generation of a UIImage which contains a screenshot of the next available frame.
- (void)captureScreenWithMode:(WTScreenshotCaptureMode)captureMode usingSaveMode:(WTScreenshotSaveMode)saveMode saveOptions:(WTScreenshotSaveOptions)options context:(nullable NSDictionary *)context
Parameters
captureMode |
Defines if the WebView is included in the screenshot or not. |
---|---|
saveMode |
Defines how the captured screenshot should be processed. Possible ways are to save it to the Photo Library, to a specific bundle directory or to receive a delegate call where the image is passed in. |
options |
Defines more option for a specific SaveMode. |
context |
A NSDictionary containing information about the CaptureMode, SaveMode and SaveMode specific objects. See Protocol reference for more information. |
Declared In
WTArchitectView.h
Injecting Locations
– injectLocationWithLatitude:longitude:altitude:accuracy:
Injects the supplied location information. To use the injected location -setUseInjectedLocation:YES has to be called.
- (void)injectLocationWithLatitude:(CLLocationDegrees)latitude longitude:(CLLocationDegrees)longitude altitude:(CLLocationDistance)altitude accuracy:(CLLocationAccuracy)accuracy
Parameters
latitude |
The latitude that has to be simulated. |
---|---|
longitude |
The longitude that has to be simulated. |
altitude |
The to altitude that has to be simulated. |
accuracy |
The accuracy of the simulated location. |
Declared In
WTArchitectView.h
– injectLocationWithLatitude:longitude:accuracy:
Injects the supplied location information. To use the injected location -setUseInjectedLocation:YES has to be called.
- (void)injectLocationWithLatitude:(CLLocationDegrees)latitude longitude:(CLLocationDegrees)longitude accuracy:(CLLocationAccuracy)accuracy
Parameters
latitude |
The latitude that has to be simulated. |
---|---|
longitude |
The longitude that has to be simulated. |
accuracy |
The accuracy of the simulated location. |
Declared In
WTArchitectView.h
– setUseInjectedLocation:
If true is supplied the injected location will be used. If false is supplied the default location provider will be used.
- (void)setUseInjectedLocation:(BOOL)useInjectedLocation
Parameters
useInjectedLocation |
The location simulation status |
---|
Declared In
WTArchitectView.h
– isUsingInjectedLocation
True if an injected location is currently used. false if default location provider is used.
- (BOOL)isUsingInjectedLocation
Return Value
Indicates, if the location provider is simulating the injected location.
Declared In
WTArchitectView.h
Manipulating Object Visibility
– setCullingDistance:
Sets the culling distance in meters. Objects in AR that are further away won’t be visible. The default value is 50000 meters (= 50 km).
- (void)setCullingDistance:(float)cullingDistance
Parameters
cullingDistance |
The culling distance that has to be applied to your AR objects. |
---|
Declared In
WTArchitectView.h
– cullingDistance
Retrieves the current culling distance in meters.
- (float)cullingDistance
Return Value
The current culling distance, used by the SDK.
Declared In
WTArchitectView.h
– clearCache
Use this method to clear all cached data and requests.
- (void)clearCache
Discussion
This method clears the cache used by the webView, as well as the internal caches used by the SDK.
Declared In
WTArchitectView.h
– setCustomTrackerConfiguration:
Enables a custom Tracker configuration to be applied.
- (bool)setCustomTrackerConfiguration:(NSString *)configuration
Parameters
configuration |
A JSON String containing the custom configuration for Trackers. |
---|
Return Value
bool The returned value is true if the custom tracker configuration is set successfuly, false otherwise.
Declared In
WTArchitectView.h
– onTouchBegan:withX:andY:
The following 4 methods are meant in case a custom gesture recognizer is implemented outside the view that doesn’t conform to the UIGestureRecognizerDelegate protocol.
- (void)onTouchBegan:(int)touch withX:(double)x andY:(double)y
Discussion
Before these methods are used, please make sure to overwrite the gesture recognizers on this view by setting them to nil so that they won’t interfere with the custom touch events.
The touch parameter should uniquely identify a certain touch through its lifetime (begin -> moved -> ended or cancelled). The x and y parameters should provide the location of the touch event in screen coordinates, taking into account device orientation changes.
Declared In
WTArchitectView.h
Plugins Methods
– registerPlugin:error:
Use this method to register a custom plugin which derives from wikitude::sdk::Plugin.
- (BOOL)registerPlugin:(std : : shared_ptr<wikitude::sdk::Plugin>)plugin error:(NSError *__autoreleasing *)error
Parameters
plugin |
The wikitude::sdk::Plugin sublclass that should be registered |
---|---|
error |
An error object that will be filled when plugin registration fails |
Return Value
BOOL YES if the plugin could be registered with the given identifier, NO otherwise.
Declared In
WTArchitectView+Plugins.h
– registerPlugin:
Use this method to register a custom plugin which derives from wikitude::sdk::Plugin. (Deprecated: Since version 6.1.0. Use -registerPlugin:error: instead.)
- (BOOL)registerPlugin:(std : : shared_ptr<wikitude::sdk::Plugin>)plugin
Parameters
plugin |
The wikitude::sdk::Plugin sublclass that should be registered |
---|
Return Value
BOOL YES if the plugin could be registered with the given identifier, NO otherwise.
Declared In
WTArchitectView+Plugins.h
– removePlugin:
Use this method to remove an already registered plugin.
- (BOOL)removePlugin:(std : : shared_ptr<wikitude::sdk::Plugin>)plugin
Parameters
plugin |
The wikitude::sdk::Plugin sublclass that should be removed |
---|
Return Value
BOOL YES if the plugin could be removed, NO otherwise.
Declared In
WTArchitectView+Plugins.h
– removeNamedPlugin:
Call this method to remove an already registered plugin.
- (BOOL)removeNamedPlugin:(NSString *)pluginIdentifier
Parameters
pluginIdentifier |
The Identifier that uniquely identifies the plugin that should be removed. |
---|
Return Value
BOOL YES if the plugin was known and could be removed, NO otherwise.
Discussion
Same as -removePlugin but searches for the plugin to remove by the given identifier. Using this method, no shared_ptr property needs to be added to any object because the Wikitude Architect SDK takes ownership of any plugin.
Declared In
WTArchitectView+Plugins.h