Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Sove merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
yo1995 committed Aug 6, 2020
2 parents c59df76 + 4fcb639 commit 80be91b
Show file tree
Hide file tree
Showing 285 changed files with 359 additions and 87 deletions.
26 changes: 22 additions & 4 deletions arcgis-ios-sdk-samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
3E1E5EF21D9F0E6F00F4913C /* HillshadeRendererViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3E1E5EE41D9F08ED00F4913C /* HillshadeRendererViewController.swift */; };
3E1E5EF31D9F0E6F00F4913C /* HillshadeSettingsViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3E1E5EE61D9F095A00F4913C /* HillshadeSettingsViewController.swift */; };
3E23A9E61AFC28F6002E2214 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E23A9E51AFC28F6002E2214 /* AppDelegate.swift */; };
3E23A9EF1AFC28F6002E2214 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E23A9EE1AFC28F6002E2214 /* Images.xcassets */; };
3E23A9EF1AFC28F6002E2214 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E23A9EE1AFC28F6002E2214 /* Assets.xcassets */; };
3E23A9F21AFC28F6002E2214 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3E23A9F01AFC28F6002E2214 /* LaunchScreen.xib */; };
3E24E6741BFE560B00322DAC /* LayerStatusViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3ECCFE391BD0401A00CE256D /* LayerStatusViewController.swift */; };
3E2A680E1B0D2A7000A318AA /* ListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E2A680D1B0D2A7000A318AA /* ListViewController.swift */; };
Expand Down Expand Up @@ -826,6 +826,9 @@
F1F62C4022E64FFF00EFD599 /* FeatureLayerDictionaryRenderer.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1F62C3F22E64FFF00EFD599 /* FeatureLayerDictionaryRenderer.storyboard */; };
F1F62C4222E6560C00EFD599 /* FeatureLayerDictionaryRendererViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1F62C4122E6560C00EFD599 /* FeatureLayerDictionaryRendererViewController.swift */; };
F1F62C4422E65E0900EFD599 /* militaryoverlay.geodatabase in Resources */ = {isa = PBXBuildFile; fileRef = F1F62C4322E65E0900EFD599 /* militaryoverlay.geodatabase */; settings = {ASSET_TAGS = (militaryoverlay, ); }; };
F1F651AA24984850006DF277 /* ShowPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1F651A924984850006DF277 /* ShowPopupViewController.swift */; };
F1F651AC2498485C006DF277 /* ShowPopup.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F1F651AB2498485C006DF277 /* ShowPopup.storyboard */; };
F1F651AD24995294006DF277 /* ShowPopupViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1F651A924984850006DF277 /* ShowPopupViewController.swift */; };
F1FA9DED22DE74C600234601 /* ColormapRendererViewController.swift in CopyFiles */ = {isa = PBXBuildFile; fileRef = F1E4B11022D6AF5D005FDB4D /* ColormapRendererViewController.swift */; };
F4159C6B209257B50016E53D /* FeatureLayerRenderingModeMap.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4159C6A209257B50016E53D /* FeatureLayerRenderingModeMap.storyboard */; };
F4159C6F20925AAE0016E53D /* OpenScene.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4159C6E20925AAE0016E53D /* OpenScene.storyboard */; };
Expand Down Expand Up @@ -874,6 +877,7 @@
dstSubfolderSpec = 7;
files = (
00166C8C24D236A300DD317E /* RealisticLightingAndShadowsViewController.swift in CopyFiles */,
F1F651AD24995294006DF277 /* ShowPopupViewController.swift in CopyFiles */,
001ECB062486DDF3009AC6C0 /* NavigateARCalibrationViewController.swift in CopyFiles */,
00686FD52481CF4D00EDA705 /* NavigateARRoutePlannerViewController.swift in CopyFiles */,
00686FD62481CF4D00EDA705 /* NavigateARNavigatorViewController.swift in CopyFiles */,
Expand Down Expand Up @@ -1257,7 +1261,7 @@
3E23A9E01AFC28F6002E2214 /* ArcGIS Runtime SDK Samples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ArcGIS Runtime SDK Samples.app"; sourceTree = BUILT_PRODUCTS_DIR; };
3E23A9E41AFC28F6002E2214 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3E23A9E51AFC28F6002E2214 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = "arcgis-ios-sdk-samples/AppDelegate.swift"; sourceTree = "<group>"; };
3E23A9EE1AFC28F6002E2214 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "arcgis-ios-sdk-samples/Images.xcassets"; sourceTree = "<group>"; };
3E23A9EE1AFC28F6002E2214 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = "arcgis-ios-sdk-samples/Assets.xcassets"; sourceTree = "<group>"; };
3E23A9F11AFC28F6002E2214 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
3E2A680D1B0D2A7000A318AA /* ListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListViewController.swift; sourceTree = "<group>"; };
3E2A68171B153CDE00A318AA /* SourceCodeBarButtonItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceCodeBarButtonItem.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1724,6 +1728,8 @@
F1F62C3F22E64FFF00EFD599 /* FeatureLayerDictionaryRenderer.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FeatureLayerDictionaryRenderer.storyboard; sourceTree = "<group>"; };
F1F62C4122E6560C00EFD599 /* FeatureLayerDictionaryRendererViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureLayerDictionaryRendererViewController.swift; sourceTree = "<group>"; };
F1F62C4322E65E0900EFD599 /* militaryoverlay.geodatabase */ = {isa = PBXFileReference; lastKnownFileType = file; path = militaryoverlay.geodatabase; sourceTree = "<group>"; };
F1F651A924984850006DF277 /* ShowPopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowPopupViewController.swift; sourceTree = "<group>"; };
F1F651AB2498485C006DF277 /* ShowPopup.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ShowPopup.storyboard; sourceTree = "<group>"; };
F4159C6A209257B50016E53D /* FeatureLayerRenderingModeMap.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = FeatureLayerRenderingModeMap.storyboard; sourceTree = "<group>"; };
F4159C6E20925AAE0016E53D /* OpenScene.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = OpenScene.storyboard; sourceTree = "<group>"; };
F4159C7020925B710016E53D /* OpenSceneViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenSceneViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2160,7 +2166,7 @@
isa = PBXGroup;
children = (
3E23A9E21AFC28F6002E2214 /* arcgis-ios-sdk-samples */,
3E23A9EE1AFC28F6002E2214 /* Images.xcassets */,
3E23A9EE1AFC28F6002E2214 /* Assets.xcassets */,
3E23A9E51AFC28F6002E2214 /* AppDelegate.swift */,
4CD2B5552142EAF900767D87 /* arcgis-ios-sdk-samplesTests */,
4CB506D3224C2DBC006A3471 /* Portal Data */,
Expand Down Expand Up @@ -2892,6 +2898,7 @@
3ED027FD1B8E392500ACA70D /* Display information */ = {
isa = PBXGroup;
children = (
F1F651A724984742006DF277 /* Show a popup */,
00DAE5D924213D6B00D51281 /* Custom dictionary style */,
3ED028FD1B8E3AB300ACA70D /* Add graphics with renderer */,
3E71621D1BA0D7C2008DE398 /* Add graphics with symbols */,
Expand Down Expand Up @@ -4350,6 +4357,15 @@
path = "Dictionary renderer with feature layer";
sourceTree = "<group>";
};
F1F651A724984742006DF277 /* Show a popup */ = {
isa = PBXGroup;
children = (
F1F651A924984850006DF277 /* ShowPopupViewController.swift */,
F1F651AB2498485C006DF277 /* ShowPopup.storyboard */,
);
path = "Show a popup";
sourceTree = "<group>";
};
F4159C6D20925A8D0016E53D /* Open a scene (portal item) */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4560,7 +4576,7 @@
3E4BF45A1C5BD77300D85919 /* OfflineGeocode.storyboard in Resources */,
3EABC7C31DB191BC00C161C6 /* Shasta_Elevation.tif.aux.xml in Resources */,
3E6AE3EC1C6D11BA0026E59C /* OfflineRouting.storyboard in Resources */,
3E23A9EF1AFC28F6002E2214 /* Images.xcassets in Resources */,
3E23A9EF1AFC28F6002E2214 /* Assets.xcassets in Resources */,
3EBA25611D34178200AB0703 /* SimpleMarkerSymbol.storyboard in Resources */,
2182C9821FDA01A0003E3A0F /* StatisticalQuery.storyboard in Resources */,
3ED0286C1B8E3A8500ACA70D /* DisplayLocation.storyboard in Resources */,
Expand Down Expand Up @@ -4681,6 +4697,7 @@
4C783F422252DBAC00609B9C /* philadelphia.mspk in Resources */,
F4159C6F20925AAE0016E53D /* OpenScene.storyboard in Resources */,
00C6D421246CA8FD00C63EAF /* SA_EVI_8Day_03May20.tif.aux.xml in Resources */,
F1F651AC2498485C006DF277 /* ShowPopup.storyboard in Resources */,
00D4E8DE241AA18E002689DB /* ConvexHull.storyboard in Resources */,
4CCA30CF22399A91009D2AEF /* AddIntegratedMeshLayer.storyboard in Resources */,
3E4B05F81B39EF250072E514 /* SVProgressHUD.bundle in Resources */,
Expand Down Expand Up @@ -5109,6 +5126,7 @@
00E5B7D22458FE7900B11973 /* PerformValveIsolationTraceViewController.swift in Sources */,
3EAF09451D7108DC00F8538F /* ChangeMapViewBackgroundViewController.swift in Sources */,
3EEE1D701E4935FC003263FC /* GroupUsersViewController.swift in Sources */,
F1F651AA24984850006DF277 /* ShowPopupViewController.swift in Sources */,
3ED028591B8E3A8500ACA70D /* CreateOptionsViewController.swift in Sources */,
C7AF466521B1DCD60050CC49 /* SyncMapAndSceneViewsViewController.swift in Sources */,
F1C81C4722FCEC3C00229CAA /* GetElevationPointViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class NavigateARNavigatorViewController: UIViewController {
// MARK: Actions

@IBAction func startTurnByTurn(_ sender: UIBarButtonItem) {
routeTracker = AGSRouteTracker(routeResult: routeResult, routeIndex: 0)
routeTracker = AGSRouteTracker(routeResult: routeResult, routeIndex: 0, skipCoincidentStops: true)
if routeTask.routeTaskInfo().supportsRerouting {
routeTracker?.enableRerouting(with: routeTask, routeParameters: routeParameters, strategy: .toNextStop, visitFirstStopOnStart: true ) { [weak self] (error: Error?) in
if let error = error {
Expand Down
10 changes: 9 additions & 1 deletion arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@
<key>storyboardName</key>
<string>FLSelection</string>
<key>descriptionText</key>
<string>You can tap on the map to select or unselect features in a feature layer</string>
<string>Select features in a feature layer.</string>
</dict>
<dict>
<key>displayName</key>
Expand Down Expand Up @@ -976,6 +976,14 @@
<string>Restaurant</string>
</array>
</dict>
<dict>
<key>displayName</key>
<string>Show a popup</string>
<key>descriptionText</key>
<string>Show a predefined popup from a web map.</string>
<key>storyboardName</key>
<string>ShowPopup</string>
</dict>
</array>
</dict>
<dict>
Expand Down
35 changes: 35 additions & 0 deletions arcgis-ios-sdk-samples/Display information/Show a popup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Show a popup

Show a predefined popup from a web map.

![Show a popup screenshot](show-popup.png)

## Use case

Many web maps contain predefined popups which are used to display the attributes associated with each feature layer in the map, such as hiking trails, land values, or unemployment rates. You can display text, attachments, images, charts, and web links. Rather than creating new popups to display information, you can easily access and display the predefined popups.

## How to use the sample

Tap on the features to prompt a popup that displays information about the feature.

## How it works

1. Create and load an `AGSMap` using a URL.
2. Set the map to an `AGSMapView` and set the `touchDelegate`.
3. Use the `AGSGeoView.identifyLayer(_:screenPoint:tolerance:returnPopupsOnly:completion:)` method to identify the top-most feature.
4. Create an `AGSPopupsViewController` with the result's `popups`.
5. Present the view controller.

## Relevant API

* AGSIdentifyLayerResult
* AGSMap
* AGSPopupsViewController

## About the data

This sample uses a [feature layer](https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0) that displays reported incidents in San Francisco.

## Tags

feature, feature layer, popup, web map
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"category": "Display information",
"description": "Show a predefined popup from a web map.",
"ignore": false,
"images": [
"show-popup.png"
],
"keywords": [
"feature",
"feature layer",
"popup",
"web map",
"AGSIdentifyLayerResult",
"AGSMap",
"AGSPopupsViewController"
],
"redirect_from": [],
"relevant_apis": [
"AGSIdentifyLayerResult",
"AGSMap",
"AGSPopupsViewController"
],
"snippets": [
"ShowPopupViewController.swift"
],
"title": "Show a popup"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Tu7-xN-hEQ">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Show Popup View Controller-->
<scene sceneID="RbY-vT-1T7">
<objects>
<viewController id="Tu7-xN-hEQ" customClass="ShowPopupViewController" customModule="ArcGIS_Runtime_SDK_Samples" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="AnO-nA-r5S">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pQu-4s-zw3" customClass="AGSMapView">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="pQu-4s-zw3" firstAttribute="leading" secondItem="0fq-Sl-zPE" secondAttribute="leading" id="U8z-d9-9e5"/>
<constraint firstAttribute="bottom" secondItem="pQu-4s-zw3" secondAttribute="bottom" id="Vdg-mc-cOr"/>
<constraint firstItem="pQu-4s-zw3" firstAttribute="trailing" secondItem="0fq-Sl-zPE" secondAttribute="trailing" id="dJk-mo-fA7"/>
<constraint firstItem="pQu-4s-zw3" firstAttribute="top" secondItem="AnO-nA-r5S" secondAttribute="top" id="vwQ-pe-Acz"/>
</constraints>
<viewLayoutGuide key="safeArea" id="0fq-Sl-zPE"/>
</view>
<connections>
<outlet property="mapView" destination="pQu-4s-zw3" id="UeR-em-FoJ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dOU-bk-RCL" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-16" y="146"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright 2020 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 ShowPopupViewController: UIViewController, AGSGeoViewTouchDelegate, AGSPopupsViewControllerDelegate {
@IBOutlet weak var mapView: AGSMapView! {
didSet {
mapView.map = makeMap()
}
}

var featureLayer: AGSFeatureLayer?

func makeMap() -> AGSMap {
// Create a map using a URL.
let mapURL = URL(string: "https://runtime.maps.arcgis.com/home/webmap/viewer.html?webmap=e4c6eb667e6c43b896691f10cc2f1580")!
let map = AGSMap(url: mapURL)!
// Load the map.
map.load { [weak self] (error) in
guard let self = self else { return }
if let error = error {
self.presentAlert(error: error)
} else {
// Set touch delegate.
self.mapView.touchDelegate = self
// Get the feature layer.
self.featureLayer = map.operationalLayers.firstObject as? AGSFeatureLayer
}
}
return map
}

// MARK: - AGSGeoViewTouchDelegate
func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
guard let featureLayer = self.featureLayer else { return }
// Identify the specified feature layer.
mapView.identifyLayer(featureLayer, screenPoint: screenPoint, tolerance: 12, returnPopupsOnly: false) { [weak self] (result: AGSIdentifyLayerResult) in
guard let self = self else { return }
if let error = result.error {
self.presentAlert(error: error)
} else if !result.popups.isEmpty {
// Unselect the previous feature.
featureLayer.clearSelection()
// Select the new feature.
let features = result.geoElements as? [AGSFeature]
let selectedFeature = features?.first
featureLayer.select(selectedFeature!)
// Display a popup only if it exists.
let popupsViewController = AGSPopupsViewController(popups: result.popups)
// Display the popup as a formsheet -- specified for iPads.
popupsViewController.modalPresentationStyle = .formSheet
// Present the popup.
popupsViewController.delegate = self
self.present(popupsViewController, animated: true)
}
}
}

// MARK: - AGSPopupsViewControllerDelegate methods
func popupsViewControllerDidFinishViewingPopups(_ popupsViewController: AGSPopupsViewController) {
// Dismiss the popups view controller.
dismiss(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 = ["ShowPopupViewController"]
}
}
Loading

0 comments on commit 80be91b

Please sign in to comment.