Skip to content

Commit e6f1fe8

Browse files
authored
Merge pull request #77 from Esri/update6
Update6
2 parents 14a9adc + 4bab2a9 commit e6f1fe8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3170
-1157
lines changed

.swiftlint.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
opt_in_rules:
2+
- anyobject_protocol
3+
- array_init
4+
- attributes
5+
- block_based_kvo
6+
- closure_end_indentation
7+
- closure_spacing
8+
- collection_alignment
9+
- contains_over_filter_count
10+
- contains_over_filter_is_empty
11+
- contains_over_first_not_nil
12+
- convenience_type
13+
- discouraged_direct_init
14+
- discouraged_optional_boolean
15+
- empty_collection_literal
16+
- empty_count
17+
- empty_string
18+
- empty_xctest_method
19+
- explicit_init
20+
- extension_access_modifier
21+
- fatal_error_message
22+
- first_where
23+
- function_default_parameter_at_end
24+
- identical_operands
25+
- joined_default_parameter
26+
- legacy_random
27+
- let_var_whitespace
28+
- literal_expression_end_indentation
29+
- lower_acl_than_parent
30+
- modifier_order
31+
- multiline_arguments
32+
- multiline_function_chains
33+
- multiline_parameters
34+
- operator_usage_whitespace
35+
- operator_whitespace
36+
- overridden_super_call
37+
- override_in_extension
38+
- prohibited_super_call
39+
- redundant_nil_coalescing
40+
- redundant_type_annotation
41+
- sorted_first_last
42+
- static_operator
43+
- toggle_bool
44+
- trailing_closure
45+
- untyped_error_in_catch
46+
- vertical_parameter_alignment_on_call
47+
- vertical_whitespace_closing_braces
48+
- vertical_whitespace_opening_braces
49+
- xctfail_message
50+
- yoda_condition
51+
disabled_rules:
52+
- file_length
53+
- for_where
54+
- force_cast
55+
- function_body_length
56+
- function_parameter_count
57+
- identifier_name
58+
- large_tuple
59+
- line_length
60+
- nesting
61+
- todo
62+
- trailing_whitespace
63+
- type_body_length

Documentation/AR/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# AR
2+
3+
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.
4+
5+
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: 
6+
* **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. 
7+
* **Tabletop**: Scene content is anchored to a physical surface, as if it were a 3D-printed model. 
8+
* **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.
9+
10+
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.
11+
12+
### Features of the AR component
13+
14+
- Allows display of the live camera feed
15+
- Manages `ARKit` `ARSession` lifecycle
16+
- Tracks user location and device orientation through a combination of `ARKit` and the device GPS
17+
- Provides access to an `AGSSceneView` to display your GIS 3D data over the live camera feed
18+
- `ARScreenToLocation` method to convert a screen point to a real-world coordinate
19+
- Easy access to all `ARKit` and `AGSLocationDataSource` delegate methods
20+
21+
### Usage
22+
23+
```swift
24+
let arView = ArcGISARView(renderVideoFeed: true)
25+
view.addSubview(arView)
26+
arView.translatesAutoresizingMaskIntoConstraints = false
27+
NSLayoutConstraint.activate([
28+
arView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
29+
arView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
30+
arView.topAnchor.constraint(equalTo: view.topAnchor),
31+
arView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
32+
])
33+
34+
35+
// Create a simple scene.
36+
arView.sceneView.scene = AGSScene(basemapType: .imagery)
37+
38+
// Set a AGSCLLocationDataSource, used to get our initial real-world location.
39+
arView.locationDataSource = AGSCLLocationDataSource()
40+
41+
// Start tracking our location and device orientation
42+
arView.startTracking(.initial) { (error) in
43+
print("Start tracking error: \(String(describing: error))")
44+
}
45+
46+
```
47+
48+
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`):
49+
50+
* Privacy – Camera Usage Description ([NSCameraUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription))
51+
* Privacy – Location When In Use Usage Description ([NSLocationWhenInUseUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nslocationwheninuseusagedescription))
52+
53+
To see it in action, try out the [Examples](../../Examples) and refer to [ARExample.swift](../../Examples/ArcGISToolkitExamples/ARExample.swift) in the project.

Documentation/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
* [Measure Toolbar](MeasureToolbar)
77
* [Scalebar](Scalebar)
88
* [TimeSlider](TimeSlider)
9+
* [AR](AR)

Examples/.swiftlint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.swiftlint.yml

Examples/ArcGISToolkitExamples.xcodeproj/project.pbxproj

+52-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@
2323
88B689CE1E96EDF400B67FAB /* ScalebarExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B689C41E96EDF400B67FAB /* ScalebarExample.swift */; };
2424
88B689D11E96EDF400B67FAB /* VCListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B689C71E96EDF400B67FAB /* VCListViewController.swift */; };
2525
88DBC2A11FE83D6000255921 /* JobManagerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88DBC2A01FE83D6000255921 /* JobManagerExample.swift */; };
26+
E447A12B2267BB9500578C0B /* ARExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E447A12A2267BB9500578C0B /* ARExample.swift */; };
27+
E464AA9122E62DC600969DBA /* Plane.swift in Sources */ = {isa = PBXBuildFile; fileRef = E464AA9022E62DC600969DBA /* Plane.swift */; };
2628
E46893271FEDAE29008ADA79 /* CompassExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E46893261FEDAE29008ADA79 /* CompassExample.swift */; };
29+
E47B16FA22F8DECC000C9C8B /* ARStatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */; };
30+
E47B16FB22F8DECC000C9C8B /* ARStatusViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */; };
31+
E47B17362304AB7D000C9C8B /* UserDirectionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */; };
32+
E47B17372304AB7D000C9C8B /* CalibrationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E47B17352304AB7D000C9C8B /* CalibrationView.swift */; };
2733
E48405751E9BE7E600927208 /* LegendExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48405741E9BE7E600927208 /* LegendExample.swift */; };
2834
/* End PBXBuildFile section */
2935

@@ -83,7 +89,13 @@
8389
88B689C41E96EDF400B67FAB /* ScalebarExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScalebarExample.swift; sourceTree = "<group>"; };
8490
88B689C71E96EDF400B67FAB /* VCListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VCListViewController.swift; sourceTree = "<group>"; };
8591
88DBC2A01FE83D6000255921 /* JobManagerExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JobManagerExample.swift; sourceTree = "<group>"; };
92+
E447A12A2267BB9500578C0B /* ARExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARExample.swift; sourceTree = "<group>"; };
93+
E464AA9022E62DC600969DBA /* Plane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plane.swift; sourceTree = "<group>"; };
8694
E46893261FEDAE29008ADA79 /* CompassExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompassExample.swift; sourceTree = "<group>"; };
95+
E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARStatusViewController.swift; sourceTree = "<group>"; };
96+
E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ARStatusViewController.storyboard; sourceTree = "<group>"; };
97+
E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDirectionsView.swift; sourceTree = "<group>"; };
98+
E47B17352304AB7D000C9C8B /* CalibrationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalibrationView.swift; sourceTree = "<group>"; };
8799
E48405741E9BE7E600927208 /* LegendExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegendExample.swift; sourceTree = "<group>"; };
88100
/* End PBXFileReference section */
89101

@@ -121,6 +133,7 @@
121133
8839043D1DF6022A001F3188 /* ArcGISToolkitExamples */ = {
122134
isa = PBXGroup;
123135
children = (
136+
E464AA8F22E62D5B00969DBA /* Misc */,
124137
883904421DF6022A001F3188 /* Main.storyboard */,
125138
883904451DF6022A001F3188 /* Assets.xcassets */,
126139
883904471DF6022A001F3188 /* LaunchScreen.storyboard */,
@@ -152,10 +165,23 @@
152165
2140781D209B629000FBFDCC /* TimeSliderExample.swift */,
153166
883EA74A20741A56006D6F72 /* PopupExample.swift */,
154167
8800656D2228577A00F76945 /* TemplatePickerExample.swift */,
168+
E447A12A2267BB9500578C0B /* ARExample.swift */,
155169
);
156170
name = Examples;
157171
sourceTree = "<group>";
158172
};
173+
E464AA8F22E62D5B00969DBA /* Misc */ = {
174+
isa = PBXGroup;
175+
children = (
176+
E47B17352304AB7D000C9C8B /* CalibrationView.swift */,
177+
E47B17342304AB7D000C9C8B /* UserDirectionsView.swift */,
178+
E47B16F922F8DECC000C9C8B /* ARStatusViewController.storyboard */,
179+
E47B16F822F8DECC000C9C8B /* ARStatusViewController.swift */,
180+
E464AA9022E62DC600969DBA /* Plane.swift */,
181+
);
182+
path = Misc;
183+
sourceTree = "<group>";
184+
};
159185
/* End PBXGroup section */
160186

161187
/* Begin PBXNativeTarget section */
@@ -168,6 +194,7 @@
168194
883904391DF6022A001F3188 /* Resources */,
169195
883904531DF60296001F3188 /* Embed Frameworks */,
170196
88AE77111EFC267A00AFC80A /* ShellScript */,
197+
E47ED066233AC27B0032440E /* Run Linter */,
171198
);
172199
buildRules = (
173200
);
@@ -243,6 +270,7 @@
243270
files = (
244271
883904491DF6022A001F3188 /* LaunchScreen.storyboard in Resources */,
245272
883904461DF6022A001F3188 /* Assets.xcassets in Resources */,
273+
E47B16FB22F8DECC000C9C8B /* ARStatusViewController.storyboard in Resources */,
246274
883904441DF6022A001F3188 /* Main.storyboard in Resources */,
247275
);
248276
runOnlyForDeploymentPostprocessing = 0;
@@ -261,7 +289,25 @@
261289
);
262290
runOnlyForDeploymentPostprocessing = 0;
263291
shellPath = /bin/sh;
264-
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ArcGIS.framework/strip-frameworks.sh\"";
292+
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ArcGIS.framework/strip-frameworks.sh\"\n";
293+
};
294+
E47ED066233AC27B0032440E /* Run Linter */ = {
295+
isa = PBXShellScriptBuildPhase;
296+
buildActionMask = 2147483647;
297+
files = (
298+
);
299+
inputFileListPaths = (
300+
);
301+
inputPaths = (
302+
);
303+
name = "Run Linter";
304+
outputFileListPaths = (
305+
);
306+
outputPaths = (
307+
);
308+
runOnlyForDeploymentPostprocessing = 0;
309+
shellPath = /bin/sh;
310+
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
265311
};
266312
/* End PBXShellScriptBuildPhase section */
267313

@@ -273,12 +319,17 @@
273319
883EA74B20741A56006D6F72 /* PopupExample.swift in Sources */,
274320
88B689C81E96EDF400B67FAB /* AppDelegate.swift in Sources */,
275321
2140781E209B629000FBFDCC /* TimeSliderExample.swift in Sources */,
322+
E47B17372304AB7D000C9C8B /* CalibrationView.swift in Sources */,
323+
E464AA9122E62DC600969DBA /* Plane.swift in Sources */,
276324
88B689CB1E96EDF400B67FAB /* MeasureExample.swift in Sources */,
277325
88DBC2A11FE83D6000255921 /* JobManagerExample.swift in Sources */,
278326
88B689D11E96EDF400B67FAB /* VCListViewController.swift in Sources */,
327+
E47B16FA22F8DECC000C9C8B /* ARStatusViewController.swift in Sources */,
279328
8800656E2228577A00F76945 /* TemplatePickerExample.swift in Sources */,
329+
E47B17362304AB7D000C9C8B /* UserDirectionsView.swift in Sources */,
280330
88B689CE1E96EDF400B67FAB /* ScalebarExample.swift in Sources */,
281331
88B689C91E96EDF400B67FAB /* ExamplesViewController.swift in Sources */,
332+
E447A12B2267BB9500578C0B /* ARExample.swift in Sources */,
282333
E48405751E9BE7E600927208 /* LegendExample.swift in Sources */,
283334
E46893271FEDAE29008ADA79 /* CompassExample.swift in Sources */,
284335
);

0 commit comments

Comments
 (0)