This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
285 changed files
with
359 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
arcgis-ios-sdk-samples/Display information/Show a popup/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
 | ||
|
||
## 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 |
27 changes: 27 additions & 0 deletions
27
arcgis-ios-sdk-samples/Display information/Show a popup/README.metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
42 changes: 42 additions & 0 deletions
42
arcgis-ios-sdk-samples/Display information/Show a popup/ShowPopup.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
84 changes: 84 additions & 0 deletions
84
arcgis-ios-sdk-samples/Display information/Show a popup/ShowPopupViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} | ||
} |
Binary file added
BIN
+40.5 KB
arcgis-ios-sdk-samples/Display information/Show a popup/show-popup.png
Oops, something went wrong.
Oops, something went wrong.