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.
Tasks
Managing the Delegate
-
delegate
property
Accessing Device Compatibility
Accessing ARchitect settings
Initializing a WTArchitectView Object
Loading Architect Worlds
Managing the WTArchitectView updates
Interacting with Architect Worlds
Managing the WTArchitectView rotation behavior
Accessing WTArchitectView content
Injecting Locations
-
– injectLocationWithLatitude:longitude:altitude:accuracy:
-
– injectLocationWithLatitude:longitude:accuracy:
-
– setUseInjectedLocation:
-
– isUsingInjectedLocation
Manipulating Object Visibility
Interacting with Device Motion
Plugins Methods
Class Methods
isDeviceSupportedForRequiredFeatures:error:
This method should be used to determine if the current device supports all features that are required.
+ (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
Instance Methods
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
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:(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
clearCache
Use this method to clear all cached data and requests.
- (void)clearCache
Discussion
This method clears the cache used by the webView.
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
initWithFrame:motionManager:
Returns a newly initialized architect view with the given motion manager object.
- (instancetype)initWithFrame:(CGRect)frame motionManager:(CMMotionManager *)motionManagerOrNil
Parameters
- frame
A CGRect describing the size of the view
- motionManagerOrNil
A CMMotionManager object which should be used from the SDK. If nil is given, the SDK will create there own CMMotionManager object.
Return Value
A newly initialized WTArchitectView object.
Discussion
This is the designated initializer for this class.
Declared In
WTArchitectView.h
injectLocationWithLatitude:longitude:accuracy:
Injects the supplied location information. To use the injected location setUseInjectedLocation(true) 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
injectLocationWithLatitude:longitude:altitude:accuracy:
Injects the supplied location information. To use the injected location setUseInjectedLocation(true) 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
isRotatingToInterfaceOrientation
Retrieves the current auto rotate behavior.
- (BOOL)isRotatingToInterfaceOrientation
Return Value
The current auto rotation option, used by the SDK.
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
loadArchitectWorldFromURL:withRequiredFeatures:
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 withRequiredFeatures:(WTFeatures)requiredFeatures
Parameters
- architectWorldURL
The URL that points to the ARchitect world.
- requiredFeatures
Required features who specifies in more detail which functionality is used by 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.
Architect Worlds can be loaded with different required features. Features specifies which SDK functionalities are required by the World. For example the WTFeature_2DTracking 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.
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
motionManager
Returns the motion manager used by the Wikitude SDK.
- (CMMotionManager *)motionManager
Return Value
The CMMotionManager instance, provided in the method “InitializeWithKey:motionManager”, otherwise nil;
Declared In
WTArchitectView.h
registerPlugin:
Use this method to register a custom plugin which derives from wikitude::sdk::Plugin.
- (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
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
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
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
setLicenseKey:
Enables SDK features based on the given license key.
- (void)setLicenseKey:(NSString *)licenseKey
Parameters
- licenseKey
Your developer key, provided with your licence information.
Return Value
YES if the license key was valid for this app bundle name, NO otherwise.
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
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
start:completion:
Starts activity of the ARchitect view (starts UI updates of background camera, AR objects etc).
- (void)start:(void ( ^ ) ( WTStartupConfiguration *configuration ))startupHandler completion:(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