Skip to content

Commit

Permalink
Merge pull request #77 from Esri/update6
Browse files Browse the repository at this point in the history
Update6
  • Loading branch information
mhdostal committed Oct 4, 2019
2 parents 14a9adc + 4bab2a9 commit e6f1fe8
Show file tree
Hide file tree
Showing 45 changed files with 3,170 additions and 1,157 deletions.
63 changes: 63 additions & 0 deletions .swiftlint.yml
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
53 changes: 53 additions & 0 deletions Documentation/AR/README.md
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.
1 change: 1 addition & 0 deletions Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
* [Measure Toolbar](MeasureToolbar)
* [Scalebar](Scalebar)
* [TimeSlider](TimeSlider)
* [AR](AR)
1 change: 1 addition & 0 deletions Examples/.swiftlint.yml
53 changes: 52 additions & 1 deletion Examples/ArcGISToolkitExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
88B689CE1E96EDF400B67FAB /* ScalebarExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B689C41E96EDF400B67FAB /* ScalebarExample.swift */; };
88B689D11E96EDF400B67FAB /* VCListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B689C71E96EDF400B67FAB /* VCListViewController.swift */; };
88DBC2A11FE83D6000255921 /* JobManagerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88DBC2A01FE83D6000255921 /* JobManagerExample.swift */; };
E447A12B2267BB9500578C0B /* ARExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E447A12A2267BB9500578C0B /* ARExample.swift */; };
E464AA9122E62DC600969DBA /* Plane.swift in Sources */ = {isa = PBXBuildFile; fileRef = E464AA9022E62DC600969DBA /* Plane.swift */; };
E46893271FEDAE29008ADA79 /* CompassExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E46893261FEDAE29008ADA79 /* CompassExample.swift */; };
E47B16FA22F8DECC000C9C8B /* ARStatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */; };
E47B16FB22F8DECC000C9C8B /* ARStatusViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */; };
E47B17362304AB7D000C9C8B /* UserDirectionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */; };
E47B17372304AB7D000C9C8B /* CalibrationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B17352304AB7D000C9C8B /* CalibrationView.swift */; };
E48405751E9BE7E600927208 /* LegendExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48405741E9BE7E600927208 /* LegendExample.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -83,7 +89,13 @@
88B689C41E96EDF400B67FAB /* ScalebarExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScalebarExample.swift; sourceTree = "<group>"; };
88B689C71E96EDF400B67FAB /* VCListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VCListViewController.swift; sourceTree = "<group>"; };
88DBC2A01FE83D6000255921 /* JobManagerExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JobManagerExample.swift; sourceTree = "<group>"; };
E447A12A2267BB9500578C0B /* ARExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARExample.swift; sourceTree = "<group>"; };
E464AA9022E62DC600969DBA /* Plane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plane.swift; sourceTree = "<group>"; };
E46893261FEDAE29008ADA79 /* CompassExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompassExample.swift; sourceTree = "<group>"; };
E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARStatusViewController.swift; sourceTree = "<group>"; };
E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ARStatusViewController.storyboard; sourceTree = "<group>"; };
E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDirectionsView.swift; sourceTree = "<group>"; };
E47B17352304AB7D000C9C8B /* CalibrationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalibrationView.swift; sourceTree = "<group>"; };
E48405741E9BE7E600927208 /* LegendExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegendExample.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -121,6 +133,7 @@
8839043D1DF6022A001F3188 /* ArcGISToolkitExamples */ = {
isa = PBXGroup;
children = (
E464AA8F22E62D5B00969DBA /* Misc */,
883904421DF6022A001F3188 /* Main.storyboard */,
883904451DF6022A001F3188 /* Assets.xcassets */,
883904471DF6022A001F3188 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -152,10 +165,23 @@
2140781D209B629000FBFDCC /* TimeSliderExample.swift */,
883EA74A20741A56006D6F72 /* PopupExample.swift */,
8800656D2228577A00F76945 /* TemplatePickerExample.swift */,
E447A12A2267BB9500578C0B /* ARExample.swift */,
);
name = Examples;
sourceTree = "<group>";
};
E464AA8F22E62D5B00969DBA /* Misc */ = {
isa = PBXGroup;
children = (
E47B17352304AB7D000C9C8B /* CalibrationView.swift */,
E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */,
E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */,
E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */,
E464AA9022E62DC600969DBA /* Plane.swift */,
);
path = Misc;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -168,6 +194,7 @@
883904391DF6022A001F3188 /* Resources */,
883904531DF60296001F3188 /* Embed Frameworks */,
88AE77111EFC267A00AFC80A /* ShellScript */,
E47ED066233AC27B0032440E /* Run Linter */,
);
buildRules = (
);
Expand Down Expand Up @@ -243,6 +270,7 @@
files = (
883904491DF6022A001F3188 /* LaunchScreen.storyboard in Resources */,
883904461DF6022A001F3188 /* Assets.xcassets in Resources */,
E47B16FB22F8DECC000C9C8B /* ARStatusViewController.storyboard in Resources */,
883904441DF6022A001F3188 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -261,7 +289,25 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ArcGIS.framework/strip-frameworks.sh\"";
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ArcGIS.framework/strip-frameworks.sh\"\n";
};
E47ED066233AC27B0032440E /* Run Linter */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Linter";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand All @@ -273,12 +319,17 @@
883EA74B20741A56006D6F72 /* PopupExample.swift in Sources */,
88B689C81E96EDF400B67FAB /* AppDelegate.swift in Sources */,
2140781E209B629000FBFDCC /* TimeSliderExample.swift in Sources */,
E47B17372304AB7D000C9C8B /* CalibrationView.swift in Sources */,
E464AA9122E62DC600969DBA /* Plane.swift in Sources */,
88B689CB1E96EDF400B67FAB /* MeasureExample.swift in Sources */,
88DBC2A11FE83D6000255921 /* JobManagerExample.swift in Sources */,
88B689D11E96EDF400B67FAB /* VCListViewController.swift in Sources */,
E47B16FA22F8DECC000C9C8B /* ARStatusViewController.swift in Sources */,
8800656E2228577A00F76945 /* TemplatePickerExample.swift in Sources */,
E47B17362304AB7D000C9C8B /* UserDirectionsView.swift in Sources */,
88B689CE1E96EDF400B67FAB /* ScalebarExample.swift in Sources */,
88B689C91E96EDF400B67FAB /* ExamplesViewController.swift in Sources */,
E447A12B2267BB9500578C0B /* ARExample.swift in Sources */,
E48405751E9BE7E600927208 /* LegendExample.swift in Sources */,
E46893271FEDAE29008ADA79 /* CompassExample.swift in Sources */,
);
Expand Down
Loading

0 comments on commit e6f1fe8

Please sign in to comment.