From 860adeb2517257189896926ba6df24ca2f6aa809 Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Mon, 2 Aug 2021 15:25:55 -0700 Subject: [PATCH 001/143] Added storyboard and swift file --- .../project.pbxproj | 16 +++++ .../FeatureRequestMode.storyboard | 64 +++++++++++++++++++ .../FeatureRequestViewController.swift | 49 ++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard create mode 100644 arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift diff --git a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj index 877c49499..243672acd 100644 --- a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj +++ b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj @@ -865,6 +865,8 @@ F1987D0323F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1987D0223F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift */; }; F1A355272411B35E000BA240 /* CreateAndSaveKMLViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1D1E2C22409AB9F006B2801 /* CreateAndSaveKMLViewController.swift */; }; F1BCA98F268102EB0027F5A8 /* naperville_imagery.tpkx in Resources */ = {isa = PBXBuildFile; fileRef = F1BCA98E268102EB0027F5A8 /* naperville_imagery.tpkx */; settings = {ASSET_TAGS = (naperville_imagery, ); }; }; + F1C4529F26B37008002FDB34 /* FeatureRequestMode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */; }; + F1C452A326B374C4002FDB34 /* FeatureRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */; }; F1C81C4522FCEC1C00229CAA /* GetElevationPoint.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1C81C4422FCEC1C00229CAA /* GetElevationPoint.storyboard */; }; F1C81C4722FCEC3C00229CAA /* GetElevationPointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */; }; F1C81C4822FCED5400229CAA /* GetElevationPointViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */; }; @@ -1809,6 +1811,8 @@ F1987CFE23F7314000DF41CC /* FindClosestFacilityInteractive.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FindClosestFacilityInteractive.storyboard; sourceTree = ""; }; F1987D0223F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplaySubtypeSettingsViewController.swift; sourceTree = ""; }; F1BCA98E268102EB0027F5A8 /* naperville_imagery.tpkx */ = {isa = PBXFileReference; lastKnownFileType = file; path = naperville_imagery.tpkx; sourceTree = ""; }; + F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FeatureRequestMode.storyboard; sourceTree = ""; }; + F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureRequestViewController.swift; sourceTree = ""; }; F1C81C4422FCEC1C00229CAA /* GetElevationPoint.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = GetElevationPoint.storyboard; sourceTree = ""; }; F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetElevationPointViewController.swift; sourceTree = ""; }; F1D1E2C02409AB8A006B2801 /* CreateAndSaveKML.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CreateAndSaveKML.storyboard; sourceTree = ""; }; @@ -3113,6 +3117,7 @@ 3ED027FE1B8E39DD00ACA70D /* Features */ = { isa = PBXGroup; children = ( + F1C4529D26B36EB0002FDB34 /* Feature request mode */, 001ECB58248B002B009AC6C0 /* Feature collection layer (portal item) */, F4E5CD7720704369000A6D35 /* Feature layer rendering mode (map) */, C7FF07D321B9D227000D4055 /* Feature layer rendering mode (scene) */, @@ -4540,6 +4545,15 @@ path = "Find closest facility to an incident (interactive)"; sourceTree = ""; }; + F1C4529D26B36EB0002FDB34 /* Feature request mode */ = { + isa = PBXGroup; + children = ( + F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */, + F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */, + ); + path = "Feature request mode"; + sourceTree = ""; + }; F1C81C4322FCEBD100229CAA /* Get elevation at a point */ = { isa = PBXGroup; children = ( @@ -4929,6 +4943,7 @@ C7D0EEDB215EA60800ECDD2C /* DisplayKMLNetworkLinks.storyboard in Resources */, F15694D3265DBE96007AEB61 /* SanDiego_StreetAddress.loc in Resources */, 3E1183DE1ECF5A1000180152 /* Hawaii.csv in Resources */, + F1C4529F26B37008002FDB34 /* FeatureRequestMode.storyboard in Resources */, F1987D0023F7325300DF41CC /* FindClosestFacilityInteractive.storyboard in Resources */, 3EEA060F1D21C44000E03774 /* DisplayScene.storyboard in Resources */, 3EFDE0F51E36ABB700CBCD92 /* FeatureCollectionLayer.storyboard in Resources */, @@ -5352,6 +5367,7 @@ C7E9D7C721C0500300E6C47E /* BufferOptionsViewController.swift in Sources */, 1259FB931FD295C90037105E /* WMSLayerUsingURLViewController.swift in Sources */, 4C66AAF92107C50B00EE6346 /* QueryMapImageSublayerViewController.swift in Sources */, + F1C452A326B374C4002FDB34 /* FeatureRequestViewController.swift in Sources */, C7237D0E2190F07500A72C76 /* DisplayLocationSettingsViewController.swift in Sources */, 3ED028F81B8E3AA500ACA70D /* ManualCacheViewController.swift in Sources */, 4C1EF2D2221232C500F73EAE /* IntegratedWindowsAuthenticationMapViewController.swift in Sources */, diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard new file mode 100644 index 000000000..b64da4691 --- /dev/null +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift new file mode 100644 index 000000000..ac53d9917 --- /dev/null +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift @@ -0,0 +1,49 @@ +// Copyright 2021 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 UIKit +import ArcGIS + +class FeatureRequestModeViewController: UIViewController { + @IBOutlet weak var mapView: AGSMapView! + @IBOutlet weak var featureRequestModeButton: UIBarButtonItem! + + @IBAction func modeButonTapped(_ button: UIBarButtonItem) { + let alertController = UIAlertController( + title: "Choose a feature request mode.", + message: nil, + preferredStyle: .actionSheet + ) + filterBarrierCategories.forEach { category in + let action = UIAlertAction(title: category.name, style: .default) { [self] _ in + selectedCategory = category + setStatus(message: "\(category.name) selected.") + traceResetBarButtonItem.isEnabled = true + } + alertController.addAction(action) + } + let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) + alertController.addAction(cancelAction) + alertController.popoverPresentationController?.barButtonItem = featureRequestModeButton + present(alertController, animated: true) + } + + + override func viewDidLoad() { + super.viewDidLoad() + + // add the source code button item to the right of navigation bar + (self.navigationItem.rightBarButtonItem as! SourceCodeBarButtonItem).filenames = ["FeatureRequestModeViewController"] + } +} From 3ec438eefbaa7a2384b87dba60942ac642bac049 Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Tue, 3 Aug 2021 17:57:36 -0700 Subject: [PATCH 002/143] Added enum --- .../FeatureRequestViewController.swift | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift index ac53d9917..5017af830 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift @@ -19,17 +19,53 @@ class FeatureRequestModeViewController: UIViewController { @IBOutlet weak var mapView: AGSMapView! @IBOutlet weak var featureRequestModeButton: UIBarButtonItem! + private enum FeatureRequestMode: CaseIterable { + case undefined, cache, noCache, manualCache + + var title: String { + switch self { + case .undefined: + return "Undefined" + case .cache: + return "Cache" + case .noCache: + return "No cache" + case .manualCache: + return "Manual cache" + } + } + + var mode: AGSFeatureRequestMode { + switch self { + case .undefined: + return .undefined + case .cache: + return .onInteractionCache + case .noCache: + return .onInteractionNoCache + case .manualCache: + return .manualCache + } + } + } + @IBAction func modeButonTapped(_ button: UIBarButtonItem) { let alertController = UIAlertController( title: "Choose a feature request mode.", message: nil, preferredStyle: .actionSheet ) - filterBarrierCategories.forEach { category in - let action = UIAlertAction(title: category.name, style: .default) { [self] _ in - selectedCategory = category - setStatus(message: "\(category.name) selected.") - traceResetBarButtonItem.isEnabled = true +// filterBarrierCategories.forEach { category in +// let action = UIAlertAction(title: category.name, style: .default) { [self] _ in +// selectedCategory = category +// setStatus(message: "\(category.name) selected.") +// traceResetBarButtonItem.isEnabled = true +// } +// alertController.addAction(action) +// } + FeatureRequestMode.allCases.forEach { mode in + let action = UIAlertAction(title: mode.title, style: .default) { [self] _ in + changeFeatureRequestMode(to: mode) } alertController.addAction(action) } @@ -39,6 +75,9 @@ class FeatureRequestModeViewController: UIViewController { present(alertController, animated: true) } + private func changeFeatureRequestMode(to mode: FeatureRequestMode) { + + } override func viewDidLoad() { super.viewDidLoad() From 46fedd519282d01fb1e0ef6467f5c5d8617151dd Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Wed, 4 Aug 2021 15:58:08 -0700 Subject: [PATCH 003/143] First draft of working sample --- .../project.pbxproj | 2 + .../Content Display Logic/ContentPList.plist | 8 +++ .../FeatureRequestMode.storyboard | 2 +- .../FeatureRequestViewController.swift | 69 ++++++++++++++++++- 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj index 243672acd..ecb6a068b 100644 --- a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj +++ b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj @@ -876,6 +876,7 @@ F1D5022E245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D5022D245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift */; }; F1D5022F24525E2E00583CFB /* DisplayUtilityAssociationsViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1D5022D245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift */; }; F1D7508F230730360018B812 /* ElevationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D7508E230730360018B812 /* ElevationViewController.swift */; }; + F1D938FD26BA5555001ECB9A /* FeatureRequestViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */; }; F1E4B10A22D66180005FDB4D /* CreateTerrainSurfaceFromLocalRaster.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1E4B10922D66180005FDB4D /* CreateTerrainSurfaceFromLocalRaster.storyboard */; }; F1E4B10C22D6659D005FDB4D /* CreateTerrainSurfaceFromLocalRasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1E4B10B22D6659D005FDB4D /* CreateTerrainSurfaceFromLocalRasterViewController.swift */; }; F1E4B10F22D6AF28005FDB4D /* ColormapRenderer.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1E4B10E22D6AF28005FDB4D /* ColormapRenderer.storyboard */; }; @@ -935,6 +936,7 @@ dstPath = ""; dstSubfolderSpec = 7; files = ( + F1D938FD26BA5555001ECB9A /* FeatureRequestViewController.swift in CopyFiles */, 00FFE6DD26606343001E92ED /* QueryWithCQLFiltersViewController.swift in CopyFiles */, 00FFE6DE26606343001E92ED /* QueryWithCQLFiltersSettingsViewController.swift in CopyFiles */, 0087A55D265C8FEA00D9601D /* BrowseOGCAPIFeatureServiceViewController.swift in CopyFiles */, diff --git a/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist b/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist index 8013f738d..397c5a940 100644 --- a/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist +++ b/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist @@ -918,6 +918,14 @@ descriptionText Query data using a time extent. + + displayName + Feature request mode + storyboardName + FeatureRequestMode + descriptionText + Set different feature request modes for a feature table. + diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard index b64da4691..ab73a3ca7 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard @@ -1,5 +1,5 @@ - + diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift index 5017af830..95d7f9571 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift @@ -16,9 +16,26 @@ import UIKit import ArcGIS class FeatureRequestModeViewController: UIViewController { - @IBOutlet weak var mapView: AGSMapView! + @IBOutlet weak var mapView: AGSMapView! { + didSet { + mapView.map = AGSMap(basemapStyle: .arcGISLightGrayBase) + let extent = AGSEnvelope( + xMin: -1.30758164047166E7, + yMin: 4014771.46954516, + xMax: -1.30730056797177E7, + yMax: 4016869.78617381, + spatialReference: .webMercator() + ) + mapView.setViewpoint(AGSViewpoint(targetExtent: extent)) + } + } @IBOutlet weak var featureRequestModeButton: UIBarButtonItem! + private static let featureServiceURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0" + private static let featureServiceSFURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" + let featureTable = AGSServiceFeatureTable(url: URL(string: featureServiceURL)!) + let featureTableSF = AGSServiceFeatureTable(url: URL(string: featureServiceSFURL)!) + private enum FeatureRequestMode: CaseIterable { case undefined, cache, noCache, manualCache @@ -65,7 +82,7 @@ class FeatureRequestModeViewController: UIViewController { // } FeatureRequestMode.allCases.forEach { mode in let action = UIAlertAction(title: mode.title, style: .default) { [self] _ in - changeFeatureRequestMode(to: mode) + changeFeatureRequestMode(to: mode.mode) } alertController.addAction(action) } @@ -75,8 +92,54 @@ class FeatureRequestModeViewController: UIViewController { present(alertController, animated: true) } - private func changeFeatureRequestMode(to mode: FeatureRequestMode) { + private func changeFeatureRequestMode(to mode: AGSFeatureRequestMode) { + let featureTable: AGSServiceFeatureTable + if mode == .manualCache { + featureTable = featureTableSF + mapView.map = AGSMap(basemapStyle: .arcGISTopographic) + mapView.setViewpoint(AGSViewpoint(center: AGSPoint(x: -13630484, y: 4545415, spatialReference: .webMercator()), scale: 500000)) + populateManualCache() + } else { + featureTable = self.featureTable + mapView.map = AGSMap(basemapStyle: .arcGISLightGrayBase) + let extent = AGSEnvelope( + xMin: -1.30758164047166E7, + yMin: 4014771.46954516, + xMax: -1.30730056797177E7, + yMax: 4016869.78617381, + spatialReference: .webMercator() + ) + mapView.setViewpoint(AGSViewpoint(targetExtent: extent)) + } + let map = mapView.map + map?.operationalLayers.removeAllObjects() + featureTable.clearCache(withKeepLocalEdits: false) + // set the request mode + featureTable.featureRequestMode = mode + let featureLayer = AGSFeatureLayer(featureTable: featureTable) + // add the feature layer to the map + map?.operationalLayers.add(featureLayer) + mapView.map = map + } + + func populateManualCache() { + // set query parameters + let params = AGSQueryParameters() + // for specific request type + params.whereClause = "req_Type = 'Tree Maintenance or Damage'" + + // populate features based on query + self.featureTableSF.populateFromService(with: params, clearCache: true, outFields: ["*"]) { [weak self] (result: AGSFeatureQueryResult?, error: Error?) in + // check for error + if let error = error { + self?.presentAlert(error: error) + } else { + // the resulting features should be displayed on the map + // you can print the count of features + print("Populated \(result?.featureEnumerator().allObjects.count ?? 0) features.") + } + } } override func viewDidLoad() { From 2416850067b0d32c8b145c37b70655517a20dfd4 Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Thu, 5 Aug 2021 15:05:10 -0700 Subject: [PATCH 004/143] Changed service and viewpoint --- .../FeatureRequestViewController.swift | 44 +++---------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift index 95d7f9571..d54ffe65e 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift +++ b/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift @@ -18,23 +18,16 @@ import ArcGIS class FeatureRequestModeViewController: UIViewController { @IBOutlet weak var mapView: AGSMapView! { didSet { - mapView.map = AGSMap(basemapStyle: .arcGISLightGrayBase) - let extent = AGSEnvelope( - xMin: -1.30758164047166E7, - yMin: 4014771.46954516, - xMax: -1.30730056797177E7, - yMax: 4016869.78617381, - spatialReference: .webMercator() - ) - mapView.setViewpoint(AGSViewpoint(targetExtent: extent)) + mapView.map = AGSMap(basemapStyle: .arcGISTopographic) + mapView.setViewpoint(AGSViewpoint(latitude: 45.5185, longitude: -122.5965, scale: 6000)) } } @IBOutlet weak var featureRequestModeButton: UIBarButtonItem! - private static let featureServiceURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0" - private static let featureServiceSFURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" + private static let featureServiceURL = "https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Trees_of_Portland/FeatureServer/0" +// private static let featureServiceSFURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" let featureTable = AGSServiceFeatureTable(url: URL(string: featureServiceURL)!) - let featureTableSF = AGSServiceFeatureTable(url: URL(string: featureServiceSFURL)!) +// let featureTableSF = AGSServiceFeatureTable(url: URL(string: featureServiceSFURL)!) private enum FeatureRequestMode: CaseIterable { case undefined, cache, noCache, manualCache @@ -72,14 +65,6 @@ class FeatureRequestModeViewController: UIViewController { message: nil, preferredStyle: .actionSheet ) -// filterBarrierCategories.forEach { category in -// let action = UIAlertAction(title: category.name, style: .default) { [self] _ in -// selectedCategory = category -// setStatus(message: "\(category.name) selected.") -// traceResetBarButtonItem.isEnabled = true -// } -// alertController.addAction(action) -// } FeatureRequestMode.allCases.forEach { mode in let action = UIAlertAction(title: mode.title, style: .default) { [self] _ in changeFeatureRequestMode(to: mode.mode) @@ -93,23 +78,8 @@ class FeatureRequestModeViewController: UIViewController { } private func changeFeatureRequestMode(to mode: AGSFeatureRequestMode) { - let featureTable: AGSServiceFeatureTable if mode == .manualCache { - featureTable = featureTableSF - mapView.map = AGSMap(basemapStyle: .arcGISTopographic) - mapView.setViewpoint(AGSViewpoint(center: AGSPoint(x: -13630484, y: 4545415, spatialReference: .webMercator()), scale: 500000)) populateManualCache() - } else { - featureTable = self.featureTable - mapView.map = AGSMap(basemapStyle: .arcGISLightGrayBase) - let extent = AGSEnvelope( - xMin: -1.30758164047166E7, - yMin: 4014771.46954516, - xMax: -1.30730056797177E7, - yMax: 4016869.78617381, - spatialReference: .webMercator() - ) - mapView.setViewpoint(AGSViewpoint(targetExtent: extent)) } let map = mapView.map map?.operationalLayers.removeAllObjects() @@ -127,10 +97,10 @@ class FeatureRequestModeViewController: UIViewController { // set query parameters let params = AGSQueryParameters() // for specific request type - params.whereClause = "req_Type = 'Tree Maintenance or Damage'" + params.whereClause = "Condition = '4'" // populate features based on query - self.featureTableSF.populateFromService(with: params, clearCache: true, outFields: ["*"]) { [weak self] (result: AGSFeatureQueryResult?, error: Error?) in + self.featureTable.populateFromService(with: params, clearCache: true, outFields: ["*"]) { [weak self] (result: AGSFeatureQueryResult?, error: Error?) in // check for error if let error = error { self?.presentAlert(error: error) From 4cc47a20e6aeb9d6fb8831c246a8ba1d87a3488a Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Tue, 10 Aug 2021 17:21:05 -0700 Subject: [PATCH 005/143] Renamed sample --- .../project.pbxproj | 26 +++++------ .../Content Display Logic/ContentPList.plist | 4 +- .../DisplayFeatureRequestMode.storyboard} | 15 +++++-- ...DisplayFeatureRequestViewController.swift} | 43 ++++++++++--------- 4 files changed, 49 insertions(+), 39 deletions(-) rename arcgis-ios-sdk-samples/Features/{Feature request mode/FeatureRequestMode.storyboard => Display feature request mode/DisplayFeatureRequestMode.storyboard} (81%) rename arcgis-ios-sdk-samples/Features/{Feature request mode/FeatureRequestViewController.swift => Display feature request mode/DisplayFeatureRequestViewController.swift} (91%) diff --git a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj index ecb6a068b..5105e1b5e 100644 --- a/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj +++ b/arcgis-ios-sdk-samples.xcodeproj/project.pbxproj @@ -865,8 +865,8 @@ F1987D0323F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1987D0223F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift */; }; F1A355272411B35E000BA240 /* CreateAndSaveKMLViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1D1E2C22409AB9F006B2801 /* CreateAndSaveKMLViewController.swift */; }; F1BCA98F268102EB0027F5A8 /* naperville_imagery.tpkx in Resources */ = {isa = PBXBuildFile; fileRef = F1BCA98E268102EB0027F5A8 /* naperville_imagery.tpkx */; settings = {ASSET_TAGS = (naperville_imagery, ); }; }; - F1C4529F26B37008002FDB34 /* FeatureRequestMode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */; }; - F1C452A326B374C4002FDB34 /* FeatureRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */; }; + F1C4529F26B37008002FDB34 /* DisplayFeatureRequestMode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1C4529E26B37008002FDB34 /* DisplayFeatureRequestMode.storyboard */; }; + F1C452A326B374C4002FDB34 /* DisplayFeatureRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* DisplayFeatureRequestViewController.swift */; }; F1C81C4522FCEC1C00229CAA /* GetElevationPoint.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1C81C4422FCEC1C00229CAA /* GetElevationPoint.storyboard */; }; F1C81C4722FCEC3C00229CAA /* GetElevationPointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */; }; F1C81C4822FCED5400229CAA /* GetElevationPointViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */; }; @@ -876,7 +876,7 @@ F1D5022E245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D5022D245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift */; }; F1D5022F24525E2E00583CFB /* DisplayUtilityAssociationsViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1D5022D245246EC00583CFB /* DisplayUtilityAssociationsViewController.swift */; }; F1D7508F230730360018B812 /* ElevationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D7508E230730360018B812 /* ElevationViewController.swift */; }; - F1D938FD26BA5555001ECB9A /* FeatureRequestViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */; }; + F1D938FD26BA5555001ECB9A /* DisplayFeatureRequestViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1C452A226B374C4002FDB34 /* DisplayFeatureRequestViewController.swift */; }; F1E4B10A22D66180005FDB4D /* CreateTerrainSurfaceFromLocalRaster.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1E4B10922D66180005FDB4D /* CreateTerrainSurfaceFromLocalRaster.storyboard */; }; F1E4B10C22D6659D005FDB4D /* CreateTerrainSurfaceFromLocalRasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1E4B10B22D6659D005FDB4D /* CreateTerrainSurfaceFromLocalRasterViewController.swift */; }; F1E4B10F22D6AF28005FDB4D /* ColormapRenderer.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1E4B10E22D6AF28005FDB4D /* ColormapRenderer.storyboard */; }; @@ -936,7 +936,7 @@ dstPath = ""; dstSubfolderSpec = 7; files = ( - F1D938FD26BA5555001ECB9A /* FeatureRequestViewController.swift in CopyFiles */, + F1D938FD26BA5555001ECB9A /* DisplayFeatureRequestViewController.swift in CopyFiles */, 00FFE6DD26606343001E92ED /* QueryWithCQLFiltersViewController.swift in CopyFiles */, 00FFE6DE26606343001E92ED /* QueryWithCQLFiltersSettingsViewController.swift in CopyFiles */, 0087A55D265C8FEA00D9601D /* BrowseOGCAPIFeatureServiceViewController.swift in CopyFiles */, @@ -1813,8 +1813,8 @@ F1987CFE23F7314000DF41CC /* FindClosestFacilityInteractive.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FindClosestFacilityInteractive.storyboard; sourceTree = ""; }; F1987D0223F7677E00DF41CC /* DisplaySubtypeSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplaySubtypeSettingsViewController.swift; sourceTree = ""; }; F1BCA98E268102EB0027F5A8 /* naperville_imagery.tpkx */ = {isa = PBXFileReference; lastKnownFileType = file; path = naperville_imagery.tpkx; sourceTree = ""; }; - F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FeatureRequestMode.storyboard; sourceTree = ""; }; - F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureRequestViewController.swift; sourceTree = ""; }; + F1C4529E26B37008002FDB34 /* DisplayFeatureRequestMode.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DisplayFeatureRequestMode.storyboard; sourceTree = ""; }; + F1C452A226B374C4002FDB34 /* DisplayFeatureRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayFeatureRequestViewController.swift; sourceTree = ""; }; F1C81C4422FCEC1C00229CAA /* GetElevationPoint.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = GetElevationPoint.storyboard; sourceTree = ""; }; F1C81C4622FCEC3C00229CAA /* GetElevationPointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetElevationPointViewController.swift; sourceTree = ""; }; F1D1E2C02409AB8A006B2801 /* CreateAndSaveKML.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CreateAndSaveKML.storyboard; sourceTree = ""; }; @@ -3119,7 +3119,7 @@ 3ED027FE1B8E39DD00ACA70D /* Features */ = { isa = PBXGroup; children = ( - F1C4529D26B36EB0002FDB34 /* Feature request mode */, + F1C4529D26B36EB0002FDB34 /* Display feature request mode */, 001ECB58248B002B009AC6C0 /* Feature collection layer (portal item) */, F4E5CD7720704369000A6D35 /* Feature layer rendering mode (map) */, C7FF07D321B9D227000D4055 /* Feature layer rendering mode (scene) */, @@ -4547,13 +4547,13 @@ path = "Find closest facility to an incident (interactive)"; sourceTree = ""; }; - F1C4529D26B36EB0002FDB34 /* Feature request mode */ = { + F1C4529D26B36EB0002FDB34 /* Display feature request mode */ = { isa = PBXGroup; children = ( - F1C4529E26B37008002FDB34 /* FeatureRequestMode.storyboard */, - F1C452A226B374C4002FDB34 /* FeatureRequestViewController.swift */, + F1C4529E26B37008002FDB34 /* DisplayFeatureRequestMode.storyboard */, + F1C452A226B374C4002FDB34 /* DisplayFeatureRequestViewController.swift */, ); - path = "Feature request mode"; + path = "Display feature request mode"; sourceTree = ""; }; F1C81C4322FCEBD100229CAA /* Get elevation at a point */ = { @@ -4945,7 +4945,7 @@ C7D0EEDB215EA60800ECDD2C /* DisplayKMLNetworkLinks.storyboard in Resources */, F15694D3265DBE96007AEB61 /* SanDiego_StreetAddress.loc in Resources */, 3E1183DE1ECF5A1000180152 /* Hawaii.csv in Resources */, - F1C4529F26B37008002FDB34 /* FeatureRequestMode.storyboard in Resources */, + F1C4529F26B37008002FDB34 /* DisplayFeatureRequestMode.storyboard in Resources */, F1987D0023F7325300DF41CC /* FindClosestFacilityInteractive.storyboard in Resources */, 3EEA060F1D21C44000E03774 /* DisplayScene.storyboard in Resources */, 3EFDE0F51E36ABB700CBCD92 /* FeatureCollectionLayer.storyboard in Resources */, @@ -5369,7 +5369,7 @@ C7E9D7C721C0500300E6C47E /* BufferOptionsViewController.swift in Sources */, 1259FB931FD295C90037105E /* WMSLayerUsingURLViewController.swift in Sources */, 4C66AAF92107C50B00EE6346 /* QueryMapImageSublayerViewController.swift in Sources */, - F1C452A326B374C4002FDB34 /* FeatureRequestViewController.swift in Sources */, + F1C452A326B374C4002FDB34 /* DisplayFeatureRequestViewController.swift in Sources */, C7237D0E2190F07500A72C76 /* DisplayLocationSettingsViewController.swift in Sources */, 3ED028F81B8E3AA500ACA70D /* ManualCacheViewController.swift in Sources */, 4C1EF2D2221232C500F73EAE /* IntegratedWindowsAuthenticationMapViewController.swift in Sources */, diff --git a/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist b/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist index 397c5a940..59dd5f818 100644 --- a/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist +++ b/arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist @@ -920,9 +920,9 @@ displayName - Feature request mode + Display feature request mode storyboardName - FeatureRequestMode + DisplayFeatureRequestMode descriptionText Set different feature request modes for a feature table. diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard similarity index 81% rename from arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard rename to arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard index ab73a3ca7..70e4a9b41 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestMode.storyboard +++ b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard @@ -9,10 +9,10 @@ - + - + @@ -25,12 +25,18 @@ - + + + + + + + @@ -47,8 +53,9 @@ - + + diff --git a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift similarity index 91% rename from arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift rename to arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift index d54ffe65e..12a75bffa 100644 --- a/arcgis-ios-sdk-samples/Features/Feature request mode/FeatureRequestViewController.swift +++ b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift @@ -15,14 +15,15 @@ import UIKit import ArcGIS -class FeatureRequestModeViewController: UIViewController { +class DisplayFeatureRequestModeViewController: UIViewController { @IBOutlet weak var mapView: AGSMapView! { didSet { mapView.map = AGSMap(basemapStyle: .arcGISTopographic) mapView.setViewpoint(AGSViewpoint(latitude: 45.5185, longitude: -122.5965, scale: 6000)) } } - @IBOutlet weak var featureRequestModeButton: UIBarButtonItem! + @IBOutlet weak var modeBarButtonItem: UIBarButtonItem! + @IBOutlet weak var populateBarButtonItem: UIBarButtonItem! private static let featureServiceURL = "https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Trees_of_Portland/FeatureServer/0" // private static let featureServiceSFURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" @@ -73,27 +74,11 @@ class FeatureRequestModeViewController: UIViewController { } let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) alertController.addAction(cancelAction) - alertController.popoverPresentationController?.barButtonItem = featureRequestModeButton + alertController.popoverPresentationController?.barButtonItem = modeBarButtonItem present(alertController, animated: true) } - private func changeFeatureRequestMode(to mode: AGSFeatureRequestMode) { - if mode == .manualCache { - populateManualCache() - } - let map = mapView.map - map?.operationalLayers.removeAllObjects() - featureTable.clearCache(withKeepLocalEdits: false) - // set the request mode - featureTable.featureRequestMode = mode - let featureLayer = AGSFeatureLayer(featureTable: featureTable) - // add the feature layer to the map - map?.operationalLayers.add(featureLayer) - - mapView.map = map - } - - func populateManualCache() { + @IBAction func populateManualCache(_ button: UIBarButtonItem) { // set query parameters let params = AGSQueryParameters() // for specific request type @@ -112,6 +97,24 @@ class FeatureRequestModeViewController: UIViewController { } } + private func changeFeatureRequestMode(to mode: AGSFeatureRequestMode) { + if mode == .manualCache { + populateBarButtonItem.isEnabled = true + } else { + populateBarButtonItem.isEnabled = false + } + let map = mapView.map + map?.operationalLayers.removeAllObjects() + featureTable.clearCache(withKeepLocalEdits: false) + // set the request mode + featureTable.featureRequestMode = mode + let featureLayer = AGSFeatureLayer(featureTable: featureTable) + // add the feature layer to the map + map?.operationalLayers.add(featureLayer) + + mapView.map = map + } + override func viewDidLoad() { super.viewDidLoad() From 337a119d43bdb88bf0a7a4ff7090112c858746f2 Mon Sep 17 00:00:00 2001 From: Vivian Quach Date: Tue, 10 Aug 2021 17:41:16 -0700 Subject: [PATCH 006/143] Added status label and removed undefined --- .../DisplayFeatureRequestMode.storyboard | 22 ++++++++++++++++++ .../DisplayFeatureRequestViewController.swift | 23 ++++++++++++------- .../PerformValveIsolationTrace.storyboard | 8 +++---- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard index 70e4a9b41..c4c8cc9b5 100644 --- a/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard +++ b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestMode.storyboard @@ -21,6 +21,22 @@ + + + + + + + + + + + @@ -43,19 +59,25 @@ + + + + + + diff --git a/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift index 12a75bffa..7dc6ce064 100644 --- a/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift +++ b/arcgis-ios-sdk-samples/Features/Display feature request mode/DisplayFeatureRequestViewController.swift @@ -24,6 +24,7 @@ class DisplayFeatureRequestModeViewController: UIViewController { } @IBOutlet weak var modeBarButtonItem: UIBarButtonItem! @IBOutlet weak var populateBarButtonItem: UIBarButtonItem! + @IBOutlet weak var statusLabel: UILabel! private static let featureServiceURL = "https://services2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/rest/services/Trees_of_Portland/FeatureServer/0" // private static let featureServiceSFURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0" @@ -31,12 +32,10 @@ class DisplayFeatureRequestModeViewController: UIViewController { // let featureTableSF = AGSServiceFeatureTable(url: URL(string: featureServiceSFURL)!) private enum FeatureRequestMode: CaseIterable { - case undefined, cache, noCache, manualCache + case cache, noCache, manualCache var title: String { switch self { - case .undefined: - return "Undefined" case .cache: return "Cache" case .noCache: @@ -48,8 +47,6 @@ class DisplayFeatureRequestModeViewController: UIViewController { var mode: AGSFeatureRequestMode { switch self { - case .undefined: - return .undefined case .cache: return .onInteractionCache case .noCache: @@ -69,6 +66,8 @@ class DisplayFeatureRequestModeViewController: UIViewController { FeatureRequestMode.allCases.forEach { mode in let action = UIAlertAction(title: mode.title, style: .default) { [self] _ in changeFeatureRequestMode(to: mode.mode) + let message = "\(mode.title) enabled." + setStatus(message: message) } alertController.addAction(action) } @@ -83,20 +82,28 @@ class DisplayFeatureRequestModeViewController: UIViewController { let params = AGSQueryParameters() // for specific request type params.whereClause = "Condition = '4'" - + UIApplication.shared.showProgressHUD(message: "Populating") // populate features based on query self.featureTable.populateFromService(with: params, clearCache: true, outFields: ["*"]) { [weak self] (result: AGSFeatureQueryResult?, error: Error?) in + // hide progress hud + UIApplication.shared.hideProgressHUD() // check for error if let error = error { self?.presentAlert(error: error) } else { // the resulting features should be displayed on the map // you can print the count of features - print("Populated \(result?.featureEnumerator().allObjects.count ?? 0) features.") + let message = "Populated \(result?.featureEnumerator().allObjects.count ?? 0) features." + self?.setStatus(message: message) } } } + // MARK: UI and Feedback + private func setStatus(message: String) { + statusLabel.text = message + } + private func changeFeatureRequestMode(to mode: AGSFeatureRequestMode) { if mode == .manualCache { populateBarButtonItem.isEnabled = true @@ -117,7 +124,7 @@ class DisplayFeatureRequestModeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - + setStatus(message: "Select a feature request mode.") // add the source code button item to the right of navigation bar (self.navigationItem.rightBarButtonItem as! SourceCodeBarButtonItem).filenames = ["FeatureRequestModeViewController"] } diff --git a/arcgis-ios-sdk-samples/Utility network/Perform valve isolation trace/PerformValveIsolationTrace.storyboard b/arcgis-ios-sdk-samples/Utility network/Perform valve isolation trace/PerformValveIsolationTrace.storyboard index 2e73a7529..03a7ef14b 100644 --- a/arcgis-ios-sdk-samples/Utility network/Perform valve isolation trace/PerformValveIsolationTrace.storyboard +++ b/arcgis-ios-sdk-samples/Utility network/Perform valve isolation trace/PerformValveIsolationTrace.storyboard @@ -1,9 +1,9 @@ - + - + @@ -22,10 +22,10 @@ - +