Skip to content

Commit

Permalink
Merge pull request #172 from Esri/v.next
Browse files Browse the repository at this point in the history
V.next
  • Loading branch information
mhdostal committed Apr 27, 2022
2 parents b47ca46 + a65ad9e commit fa94e6f
Show file tree
Hide file tree
Showing 30 changed files with 1,485 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Documentation/AR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NSLayoutConstraint.activate([


// Create a simple scene.
arView.sceneView.scene = AGSScene(basemapType: .imagery)
arView.sceneView.scene = AGSScene(basemapStyle: .arcGISImagery)

// Set a AGSCLLocationDataSource, used to get our initial real-world location.
arView.locationDataSource = AGSCLLocationDataSource()
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Bookmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Bookmarks component will display a list of bookmarks in a table view and allows the user to select a bookmark and perform some action.

## Bookmarks Behavior:
## Bookmarks Behavior

The `BookmarksTableViewController` can be created using either an `AGSGeoView` or an array of `AGSBookmark`s.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Compass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The Compass (alias North arrow) shows where north is in the MapView. The Compass

The ArcGIS Runtime SDK currently supports rotating the map with 2-finger gesture on MapView and SceneView interactively by default and while the map will snap to north when rotating using gestures, the compass provides an easier way. The Compass Toolkit component will appear when the map is rotated and, when tapped, re-orientates the map back to north and hides the compass icon (note that the MapView auto-snaps back to north when it's within a threshold of north, and in that case the compass also auto hides).

### Compass Behavior:
### Compass Behavior

Whenever the map is not orientated North (non-zero bearing) the compass appears. When reset to north, it disappears. A property allows you to disable the auto-hide feature so that it always shows.

Expand Down
23 changes: 23 additions & 0 deletions Documentation/FloorFilter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# FloorFilter

The `FloorFilter` component simplifies visualization of GIS data for a specific floor of a building in your application. It allows you to filter down the floor plan data displayed in your geo view to a site, a building in the site, or a floor in the building.

The ArcGIS Runtime SDK currently supports filtering a 2D floor aware map based on the sites, buildings, or levels in the map.

<img src="https://user-images.githubusercontent.com/3998072/163230061-6578a899-2167-4bb1-b6a5-65651931f2c7.png" width="512" height="384">

### Behavior

When the Site button is tapped, a prompt opens so the user can select a site and then a facility. After selecting a site and facility, a list of levels is displayed either above or below the site button.

### Usage

```swift

addChild(floorFilterViewController)
view.addSubview(floorFilterViewController.view)
floorFilterViewController.didMove(toParent: self)

```

To see it in action, try out the [Examples](../../Examples) and refer to [FloorFilterExample.swift](../../Examples/ArcGISToolkitExamples/FloorFilterExample.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 @@ -3,6 +3,7 @@
* [Augmented reality (AR)](AR) - Integrates the scene view with ARKit to enable augmented reality (AR).
* [Bookmarks](Bookmarks) - Shows bookmarks, from a map, scene, or a list.
* [Compass](Compass) - Shows a compass direction when the map is rotated. Auto-hides when the map points north up.
* [FloorFilter](FloorFilter) - Allows to filter floor plan data in a geo view by a site, a building in the site, or a floor in the building.
* [JobManager](JobManager) - Suspends and resumes ArcGIS Runtime tasks when the app is background, terminated, and relaunched.
* [LegendViewController](LegendViewController) - Displays a legend for all the layers in a map or scene contained in an `AGSGeoView`.
* [MeasureToolbar](MeasureToolbar) - Allows measurement of distances and areas on the map view.
Expand Down
9 changes: 7 additions & 2 deletions Examples/ArcGISToolkitExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
2140781E209B629000FBFDCC /* TimeSliderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2140781D209B629000FBFDCC /* TimeSliderExample.swift */; };
79CA564425F1952D00E9FE3D /* ArcGISToolkit in Frameworks */ = {isa = PBXBuildFile; productRef = 79CA564325F1952D00E9FE3D /* ArcGISToolkit */; };
82EACDA9270CE8BA00A40C11 /* FloorFilterExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82EACDA8270CE8BA00A40C11 /* FloorFilterExample.swift */; };
8800656E2228577A00F76945 /* TemplatePickerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8800656D2228577A00F76945 /* TemplatePickerExample.swift */; };
883904441DF6022A001F3188 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 883904421DF6022A001F3188 /* Main.storyboard */; };
883904461DF6022A001F3188 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 883904451DF6022A001F3188 /* Assets.xcassets */; };
Expand All @@ -34,6 +35,7 @@
/* Begin PBXFileReference section */
2140781D209B629000FBFDCC /* TimeSliderExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeSliderExample.swift; sourceTree = "<group>"; };
79CA564025F1942200E9FE3D /* arcgis-runtime-toolkit-ios */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "arcgis-runtime-toolkit-ios"; path = ..; sourceTree = "<group>"; };
82EACDA8270CE8BA00A40C11 /* FloorFilterExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloorFilterExample.swift; sourceTree = "<group>"; };
8800656D2228577A00F76945 /* TemplatePickerExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemplatePickerExample.swift; sourceTree = "<group>"; };
8839043B1DF6022A001F3188 /* ArcGISToolkitExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ArcGISToolkitExamples.app; sourceTree = BUILT_PRODUCTS_DIR; };
883904431DF6022A001F3188 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -116,6 +118,7 @@
8800656D2228577A00F76945 /* TemplatePickerExample.swift */,
E447A12A2267BB9500578C0B /* ARExample.swift */,
E48ADDB923563E17005A53AF /* BookmarksExample.swift */,
82EACDA8270CE8BA00A40C11 /* FloorFilterExample.swift */,
);
name = Examples;
sourceTree = "<group>";
Expand Down Expand Up @@ -253,6 +256,7 @@
E447A12B2267BB9500578C0B /* ARExample.swift in Sources */,
E48405751E9BE7E600927208 /* LegendExample.swift in Sources */,
E46893271FEDAE29008ADA79 /* CompassExample.swift in Sources */,
82EACDA9270CE8BA00A40C11 /* FloorFilterExample.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -406,7 +410,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 100.13;
MARKETING_VERSION = 100.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.${PRODUCT_NAME}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -420,13 +424,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
ENABLE_TESTABILITY = YES;
INFOPLIST_FILE = ArcGISToolkitExamples/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 100.13;
MARKETING_VERSION = 100.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.${PRODUCT_NAME}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
10 changes: 5 additions & 5 deletions Examples/ArcGISToolkitExamples/ARExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ARExample: UIViewController {
private let arView = ArcGISARView(renderVideoFeed: true)

/// Denotes whether we've placed the scene in table top experiences.
private var didPlaceScene: Bool = false
private var didPlaceScene = false

// View controller displaying current status of `ARExample`.
private let statusViewController: ARStatusViewController? = {
Expand Down Expand Up @@ -67,10 +67,10 @@ class ARExample: UIViewController {
private var toolbar = UIToolbar(frame: .zero)

/// Button used to display the `CalibrationView`.
private let calibrationItem = UIBarButtonItem(title: "Calibration", style: .plain, target: self, action: #selector(displayCalibration(_:)))
private let calibrationItem = UIBarButtonItem(title: "Calibration", style: .plain, target: ARExample.self, action: #selector(displayCalibration(_:)))

/// Button used to change the current scene.
private let sceneItem = UIBarButtonItem(title: "Change Scene", style: .plain, target: self, action: #selector(changeScene(_:)))
private let sceneItem = UIBarButtonItem(title: "Change Scene", style: .plain, target: ARExample.self, action: #selector(changeScene(_:)))

// MARK: Initialization

Expand Down Expand Up @@ -506,7 +506,7 @@ extension ARExample {
/// - Returns: The new scene.
private func streetsScene() -> AGSScene {
// Create scene with the streets basemap.
let scene = AGSScene(basemapType: .streets)
let scene = AGSScene(basemapStyle: .arcGISStreets)
scene.addElevationSource()

// Set the location data source so we use our GPS location as the originCamera.
Expand All @@ -521,7 +521,7 @@ extension ARExample {
/// - Returns: The new scene.
private func imageryScene() -> AGSScene {
// Create scene with the streets basemap.
let scene = AGSScene(basemapType: .imageryWithLabels)
let scene = AGSScene(basemapStyle: .arcGISImagery)
scene.addElevationSource()

// Set the location data source so we use our GPS location as the originCamera.
Expand Down
3 changes: 2 additions & 1 deletion Examples/ArcGISToolkitExamples/ExamplesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ExamplesViewController: VCListViewController {
("Popup Controller", PopupExample.self, nil),
("Template Picker", TemplatePickerExample.self, nil),
("AR", ARExample.self, nil),
("Bookmarks", BookmarksExample.self, nil)
("Bookmarks", BookmarksExample.self, nil),
("Floor Filter", FloorFilterExample.self, nil)
]
}
}
62 changes: 62 additions & 0 deletions Examples/ArcGISToolkitExamples/FloorFilterExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// Copyright 2022 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit
import ArcGIS
import ArcGISToolkit

class FloorFilterExample: MapViewController {
var floorFilterVC: FloorFilterViewController?

override func viewDidLoad() {
super.viewDidLoad()

// Create the map from a portal item and assign to the mapView.
let portal = AGSPortal(url: URL(string: "https://indoors.maps.arcgis.com/")!, loginRequired: false)
let portalItem = AGSPortalItem(portal: portal, itemID: "f133a698536f44c8884ad81f80b6cfc7")
let map = AGSMap(item: portalItem)
mapView.map = map

// The expansion direction of the floor filter determines which way it will open.
// If the floor filter is placed on the top of the screen, it is recommended to use the style 'down'.
// If floor filter placed on the bottom of the screen, then use 'up'.
let floorFilterVC = FloorFilterViewController.makeFloorFilterView(
geoView: mapView,
expansionDirection: .up
)
self.floorFilterVC = floorFilterVC
floorFilterVC.onSelectedLevelChangedListener = {
print("Level was changed.")
}

// Add floor filter to the current view.
floorFilterVC.view.translatesAutoresizingMaskIntoConstraints = false
addChild(floorFilterVC)
view.addSubview(floorFilterVC.view)
floorFilterVC.didMove(toParent: self)

let leadingConstraint = CGFloat(40)
floorFilterVC.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: leadingConstraint).isActive = true

// This places the floor filter at the bottom of the view,
// anchored to the top of the map view's attribution bar.
floorFilterVC.view.bottomAnchor.constraint(equalTo: mapView.attributionTopAnchor, constant: -leadingConstraint).isActive = true

// This places the floor filter at the top of the view,
// just below the top anchor of the safe area layout guide.
// Set the constraint to true and set the bottom constraint to false
floorFilterVC.view.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: leadingConstraint).isActive = false
}
}
2 changes: 2 additions & 0 deletions Examples/ArcGISToolkitExamples/JobManagerExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ extension AGSJobStatus {
return "Succeeded"
case .started:
return "Started"
case .canceling:
return "Canceling"
@unknown default:
fatalError("Unknown AGSJobStatus")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ extension AGSLocationDataSourceStatus {
return "Started"
case .failedToStart:
return "Failed to start"
case .stopping:
return "Stopping"
@unknown default:
fatalError("Unknown AGSLocationDataSourceStatus")
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/ArcGISToolkitExamples/Misc/CalibrationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ArcGISToolkit
/// A view displaying controls for adjusting a scene view's location, heading, and elevation. Used to calibrate an AR session.
class CalibrationView: UIView {
/// Denotes whether to show the elevation control and label; defaults to `true`.
var elevationControlVisibility: Bool = true {
var elevationControlVisibility = true {
didSet {
elevationSlider.isHidden = !elevationControlVisibility
elevationLabel.isHidden = !elevationControlVisibility
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let package = Package(
.package(
name: "arcgis-runtime-ios",
// path: localArcGISPackage
url: "https://github.com/Esri/arcgis-runtime-ios", .upToNextMinor(from: "100.13.0")
url: "https://github.com/Esri/arcgis-runtime-ios", .upToNextMinor(from: "100.14.0")
)
],
targets: [
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ To use Toolkit in your project:
* **[Bookmarks](Documentation/Bookmarks)** - Shows bookmarks, from a map, scene, or a list.
* **[Compass](Documentation/Compass)** - Shows a compass direction when the map is rotated. Auto-hides when the map
points north up.
* **[FloorFilter](Documentation/FloorFilter)** - Allows to filter floor plan data in a geo view by a site, a building in the site, or a floor in the building.
* **[JobManager](Documentation/JobManager)** - Suspends and resumes ArcGIS Runtime tasks when the app is background,
terminated, and relaunched.
* **[LegendViewController](Documentation/LegendViewController)** - Displays a legend for all the layers in a map or
Expand All @@ -38,8 +39,8 @@ To use Toolkit in your project:

## Requirements

* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.13.0 (or higher)
* Xcode 12.0 (or higher)
* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.14.0 (or higher)
* Xcode 13.0 (or higher)

The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meaning that it can run on devices with *iOS
13.0* or newer.
Expand All @@ -51,9 +52,8 @@ The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meani
1. Open your project in Xcode
2. Go to *File* > *Swift Packages* > *Add Package Dependency* option
3. Enter `https://github.com/Esri/arcgis-runtime-toolkit-ios` as the package repository URL
4. Choose version 100.13.0 or a later version. Click Next. Only version 100.11.0 or newer supports Swift Package
Manager.

4. Choose version 100.14.0 or a later version. Click Next.

Note: The Toolkit Swift Package adds the ArcGIS SDK Swift Package as a dependency so no need to add both separately. If
you already have the ArcGIS SDK Swift Package delete that and just add the Toolkit Swift Package.

Expand All @@ -80,6 +80,10 @@ The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meani
Note: The manual installation method also allows you to use a local installation ArcGIS Runtime SDK for iOS by making
minor edits to the [swift package](Package.swift).

## Configure API Key

Some of the toolkit components and examples utilize a set of ready-to-use ArcGIS Platform services, including basemaps, and therefore require an API Key to be set in `AppDelegate.swift`. Please see the [setup guide](https://developers.arcgis.com/ios/get-started/#3-access-services-and-content-with-an-api-key) for more information.

## SwiftLint

Both the Toolkit and Examples app support SwiftLint. You can install SwiftLint from
Expand Down Expand Up @@ -107,7 +111,7 @@ contributing](https://github.com/esri/contributing).

## Licensing

Copyright 2017 - 2021 Esri
Copyright 2017 - 2022 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
Expand Down
7 changes: 4 additions & 3 deletions Sources/ArcGISToolkit/AR/ArcGISARView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ public class ArcGISARView: UIView {
/// - Since: 100.6.0
public func stopTracking() {
arSCNView.session.pause()
locationDataSource?.stop()
isTracking = false
locationDataSource?.stop { [weak self] in
self?.isTracking = false
}
}

// MARK: Private
Expand Down Expand Up @@ -528,7 +529,7 @@ extension ArcGISARView: AGSLocationChangeHandlerDelegate {

if locationTrackingMode != .continuous {
// Stop the data source if the tracking mode is not continuous.
locationDataSource.stop()
locationDataSource.stop(completion: nil)
}

locationChangeHandlerDelegate?.locationDataSource?(locationDataSource, locationDidChange: location)
Expand Down
Loading

0 comments on commit fa94e6f

Please sign in to comment.