-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Esri/update6
Update6
- Loading branch information
Showing
45 changed files
with
3,170 additions
and
1,157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
opt_in_rules: | ||
- anyobject_protocol | ||
- array_init | ||
- attributes | ||
- block_based_kvo | ||
- closure_end_indentation | ||
- closure_spacing | ||
- collection_alignment | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- convenience_type | ||
- discouraged_direct_init | ||
- discouraged_optional_boolean | ||
- empty_collection_literal | ||
- empty_count | ||
- empty_string | ||
- empty_xctest_method | ||
- explicit_init | ||
- extension_access_modifier | ||
- fatal_error_message | ||
- first_where | ||
- function_default_parameter_at_end | ||
- identical_operands | ||
- joined_default_parameter | ||
- legacy_random | ||
- let_var_whitespace | ||
- literal_expression_end_indentation | ||
- lower_acl_than_parent | ||
- modifier_order | ||
- multiline_arguments | ||
- multiline_function_chains | ||
- multiline_parameters | ||
- operator_usage_whitespace | ||
- operator_whitespace | ||
- overridden_super_call | ||
- override_in_extension | ||
- prohibited_super_call | ||
- redundant_nil_coalescing | ||
- redundant_type_annotation | ||
- sorted_first_last | ||
- static_operator | ||
- toggle_bool | ||
- trailing_closure | ||
- untyped_error_in_catch | ||
- vertical_parameter_alignment_on_call | ||
- vertical_whitespace_closing_braces | ||
- vertical_whitespace_opening_braces | ||
- xctfail_message | ||
- yoda_condition | ||
disabled_rules: | ||
- file_length | ||
- for_where | ||
- force_cast | ||
- function_body_length | ||
- function_parameter_count | ||
- identifier_name | ||
- large_tuple | ||
- line_length | ||
- nesting | ||
- todo | ||
- trailing_whitespace | ||
- type_body_length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# AR | ||
|
||
Augmented reality experiences are designed to "augment" the physical world with virtual content that respects real world scale, position, and orientation of a device. In the case of Runtime, a SceneView displays 3D geographic data as virtual content on top of a camera feed which represents the real, physical world. | ||
|
||
The Augmented Reality (AR) toolkit component allows quick and easy integration of AR into your application for a wide variety of scenarios. The toolkit recognizes the following common patterns for AR: | ||
* **Flyover**: Flyover AR allows you to explore a scene using your device as a window into the virtual world. A typical flyover AR scenario will start with the scene’s virtual camera positioned over an area of interest. You can walk around and reorient the device to focus on specific content in the scene. | ||
* **Tabletop**: Scene content is anchored to a physical surface, as if it were a 3D-printed model. | ||
* **Real-scale**: Scene content is rendered exactly where it would be in the physical world. A camera feed is shown and GIS content is rendered on top of that feed. This is used in scenarios ranging from viewing hidden infrastructure to displaying waypoints for navigation. | ||
|
||
The AR toolkit component is comprised of one class: `ArcGISARView`. This is a subclass of `UIView` that contains the functionality needed to display an AR experience in your application. It uses `ARKit`, Apple's augmented reality framework to display the live camera feed and handle real world tracking and synchronization with the Runtime SDK's `AGSSceneView`. The `ArcGISARView` is responsible for starting and managing an `ARKit` session. It uses a user-provided `AGSLocationDataSource` for getting an initial GPS location and when continuous GPS tracking is required. | ||
|
||
### Features of the AR component | ||
|
||
- Allows display of the live camera feed | ||
- Manages `ARKit` `ARSession` lifecycle | ||
- Tracks user location and device orientation through a combination of `ARKit` and the device GPS | ||
- Provides access to an `AGSSceneView` to display your GIS 3D data over the live camera feed | ||
- `ARScreenToLocation` method to convert a screen point to a real-world coordinate | ||
- Easy access to all `ARKit` and `AGSLocationDataSource` delegate methods | ||
|
||
### Usage | ||
|
||
```swift | ||
let arView = ArcGISARView(renderVideoFeed: true) | ||
view.addSubview(arView) | ||
arView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
arView.leadingAnchor.constraint(equalTo: view.leadingAnchor), | ||
arView.trailingAnchor.constraint(equalTo: view.trailingAnchor), | ||
arView.topAnchor.constraint(equalTo: view.topAnchor), | ||
arView.bottomAnchor.constraint(equalTo: view.bottomAnchor) | ||
]) | ||
|
||
|
||
// Create a simple scene. | ||
arView.sceneView.scene = AGSScene(basemapType: .imagery) | ||
|
||
// Set a AGSCLLocationDataSource, used to get our initial real-world location. | ||
arView.locationDataSource = AGSCLLocationDataSource() | ||
|
||
// Start tracking our location and device orientation | ||
arView.startTracking(.initial) { (error) in | ||
print("Start tracking error: \(String(describing: error))") | ||
} | ||
|
||
``` | ||
|
||
You must also add the following entries to your application's `Info.plist` file. These are required to allow access to the camera (for the live video feed) and to allow access to location services (when using the `AGSCLLocationDataSource`): | ||
|
||
* Privacy – Camera Usage Description ([NSCameraUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription)) | ||
* Privacy – Location When In Use Usage Description ([NSLocationWhenInUseUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nslocationwheninuseusagedescription)) | ||
|
||
To see it in action, try out the [Examples](../../Examples) and refer to [ARExample.swift](../../Examples/ArcGISToolkitExamples/ARExample.swift) in the project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
* [Measure Toolbar](MeasureToolbar) | ||
* [Scalebar](Scalebar) | ||
* [TimeSlider](TimeSlider) | ||
* [AR](AR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.swiftlint.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.