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
-
– initWithFrame:motionManager:
-
– initWithFrame:motionManager:augmentedRealityMode:
-
– initializeWithKey:motionManager:
-
– setLicenseKey:
Loading Architect Worlds
-
– loadArchitectWorldFromURL:withRequiredFeatures:
-
– reloadArchitectWorld
-
– loadArchitectWorldFromURL:withAugmentedRealityMode:
-
– loadArchitectWorldFromUrl:
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
Accessing ARchitect settings
Interacting with Device Motion
Class Methods
isDeviceSupportedForAugmentedRealityMode:
Returns true if the device supports the requested ARMode, false otherwise.
+ (BOOL)isDeviceSupportedForAugmentedRealityMode:(WTAugmentedRealityMode)supportedARMode
Parameters
- supportedARMode
Enum value which describes the required ARMode.
Return Value
true if the requested ARMode is supported for the current device, false otherwise.
Discussion
If the device supports ARMode_Geo, also ARMode_IR is supported.
Declared In
WTArchitectView.h
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
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
versionNumber
See sdkVersion
for more information (Deprecated: since version 4.1. Use +sdkVersion instead.)
+ (NSString *)versionNumber
Return Value
The current available ARchitect verison within the SDK.
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
initWithFrame:motionManager:augmentedRealityMode:
Returns a newly initialized architect view with the given motion manager object, capable of running ARchitect Worlds in the given augmented reality mode. (Deprecated: since version 4.0.2. Use -initWithFrame:motionManager: instead.)
- (id)initWithFrame:(CGRect)frame motionManager:(CMMotionManager *)motionManagerOrNil augmentedRealityMode:(WTAugmentedRealityMode)augmentedRealityMode
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.
- augmentedRealityMode
The ARMode which describes the ARchitectWorld best.
Return Value
A newly initialized WTArchitectView object.
Discussion
This is the designated initializer for this class.
If your ARchitect World is only using image recognition, it is sufficient to pass WTAugmentedRealityMode_IR as augmentedRealityMode. Doing so will disable all location relevant components of the SDK.
Warning: If the architect view object is initialized with WTAugmentedRealityMode_IR, it is not possible to load an ARchitect World correctly that uses ARGeoObjects or ARGeoLocations objects.
Declared In
WTArchitectView.h
initializeWithKey:motionManager:
Initializes the ARchitectView with the specified license key and motion manager that will be shared by the Wikitude SDK and the third party application. If a motion manager instance is passed, it will be set to Wikitudes preferred settings (update intervals etc.) The motion manager argument may be nil in which case Wikitude creates and manages its own motion manager instance. (Deprecated: since version 3.2.2)
- (void)initializeWithKey:(NSString *)key motionManager:(CMMotionManager *)motionManager
Parameters
- key
Your developer key, provided with your licence information.
- motionManager
The CMMotionManager instance which should be used from the SDK.
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:withAugmentedRealityMode:
The same as loadArchitectWorldFromURL:withRequiredFeatures: but uses the old WTAugmentedReality API to define the features used by the ARchitect World. (Deprecated: since version 4.1. Use -loadArchitectWorldFromURL:withRequiredFeatures: instead.)
- (WTNavigation *)loadArchitectWorldFromURL:(NSURL *)architectWorldURL withAugmentedRealityMode:(WTAugmentedRealityMode)augmentedRealityMode
Parameters
- architectWorldURL
The URL that points to the ARchitect world.
- augmentedRealityMode
The augmented reality mode that specifies details about the functionality that is required 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)
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
loadArchitectWorldFromUrl:
The same as loadArchitectWorldFromURL:withAugmentedRealityMode: but specifies a default augmented reality mode of WTAugmentedRealityMode_GeoAndImageRecognition. (Deprecated: since version 4.0.2)
- (void)loadArchitectWorldFromUrl:(NSURL *)architectWorldUrl
Parameters
- architectWorldUrl
The URL that points to the ARchitect world.
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
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
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
The same as -start:completion but without the additional configuration or completion handler. (Deprecated: since verison 4.1. Use -start:completion: instead.)
- (void)start
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