Skip to content

Commit

Permalink
Merge branch 'v.next' into chriswebb/New-ShowDeviceLocationUsingIndoo…
Browse files Browse the repository at this point in the history
…rPositioning
  • Loading branch information
chriswebb09 authored Aug 10, 2024
2 parents 3d1623b + 644b413 commit cbeaae8
Show file tree
Hide file tree
Showing 40 changed files with 579 additions and 346 deletions.
28 changes: 28 additions & 0 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
218F35B829C28F4A00502022 /* AuthenticateWithOAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218F35B329C28F4A00502022 /* AuthenticateWithOAuthView.swift */; };
218F35C229C290BF00502022 /* AuthenticateWithOAuthView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 218F35B329C28F4A00502022 /* AuthenticateWithOAuthView.swift */; };
3E30884A2C5D789A00ECEAC5 /* SetSpatialReferenceView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 3EEDE7CD2C5D73F700510104 /* SetSpatialReferenceView.swift */; };
3E54CF222C66AFBE00DD2F18 /* AddWebTiledLayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E54CF212C66AFBE00DD2F18 /* AddWebTiledLayerView.swift */; };
3E54CF232C66B00500DD2F18 /* AddWebTiledLayerView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 3E54CF212C66AFBE00DD2F18 /* AddWebTiledLayerView.swift */; };
3E720F9D2C619B1700E22A9E /* SetInitialViewpointView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E720F9C2C619B1700E22A9E /* SetInitialViewpointView.swift */; };
3E720F9E2C61A0B700E22A9E /* SetInitialViewpointView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 3E720F9C2C619B1700E22A9E /* SetInitialViewpointView.swift */; };
3EEDE7CE2C5D73F700510104 /* SetSpatialReferenceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEDE7CD2C5D73F700510104 /* SetSpatialReferenceView.swift */; };
4D126D6D29CA1B6000CFB7A7 /* ShowDeviceLocationWithNMEADataSourcesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D126D6929CA1B6000CFB7A7 /* ShowDeviceLocationWithNMEADataSourcesView.swift */; };
4D126D7229CA1E1800CFB7A7 /* FileNMEASentenceReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D126D7129CA1E1800CFB7A7 /* FileNMEASentenceReader.swift */; };
Expand Down Expand Up @@ -535,7 +539,9 @@
files = (
95E0DBCA2C503E2500224A82 /* ShowDeviceLocationUsingIndoorPositioningView.swift in Copy Source Code Files */,
95E0DBCB2C503E2500224A82 /* ShowDeviceLocationUsingIndoorPositioningView.Model.swift in Copy Source Code Files */,
3E54CF232C66B00500DD2F18 /* AddWebTiledLayerView.swift in Copy Source Code Files */,
3E30884A2C5D789A00ECEAC5 /* SetSpatialReferenceView.swift in Copy Source Code Files */,
3E720F9E2C61A0B700E22A9E /* SetInitialViewpointView.swift in Copy Source Code Files */,
D78FA4952C3C8E8A0079313E /* CreateDynamicBasemapGalleryView.Views.swift in Copy Source Code Files */,
D79482D72C35D8A3006521CD /* CreateDynamicBasemapGalleryView.swift in Copy Source Code Files */,
003B36F92C5042BA00A75F66 /* ShowServiceAreaView.swift in Copy Source Code Files */,
Expand Down Expand Up @@ -820,6 +826,8 @@
1CAB8D472A3CEAB0002AA649 /* RunValveIsolationTraceView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunValveIsolationTraceView.swift; sourceTree = "<group>"; };
1CAF831B2A20305F000E1E60 /* ShowUtilityAssociationsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowUtilityAssociationsView.swift; sourceTree = "<group>"; };
218F35B329C28F4A00502022 /* AuthenticateWithOAuthView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticateWithOAuthView.swift; sourceTree = "<group>"; };
3E54CF212C66AFBE00DD2F18 /* AddWebTiledLayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebTiledLayerView.swift; sourceTree = "<group>"; };
3E720F9C2C619B1700E22A9E /* SetInitialViewpointView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetInitialViewpointView.swift; sourceTree = "<group>"; };
3EEDE7CD2C5D73F700510104 /* SetSpatialReferenceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetSpatialReferenceView.swift; sourceTree = "<group>"; };
4D126D6929CA1B6000CFB7A7 /* ShowDeviceLocationWithNMEADataSourcesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowDeviceLocationWithNMEADataSourcesView.swift; sourceTree = "<group>"; };
4D126D7129CA1E1800CFB7A7 /* FileNMEASentenceReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileNMEASentenceReader.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1146,6 +1154,7 @@
F19A316128906F0D003B7EF9 /* Add raster from file */,
955271622C0E6750009B1ED4 /* Add raster from service */,
E066DD3E28610F3F004D3D5B /* Add scene layer from service */,
3E54CF202C66AFA400DD2F18 /* Add web tiled layer */,
D7E557602A1D743100B9FB09 /* Add WMS layer */,
1C3B7DC22A5F64FC00907443 /* Analyze network with subnetwork trace */,
D7C16D172AC5F6C100689E89 /* Animate 3D graphic */,
Expand Down Expand Up @@ -1242,6 +1251,7 @@
954AEDEF2C01332F00265114 /* Select features in scene layer */,
00B042E3282EDC690072E1B4 /* Set basemap */,
D7C3AB462B683291008909B9 /* Set feature request mode */,
3E720F9B2C619ACD00E22A9E /* Set initial viewpoint */,
D734FA072A183A5A00246D7E /* Set max extent */,
D7EAF34F2A1C011000D822C4 /* Set min and max scale */,
D76CE8D62BFD7047009A8686 /* Set reference scale */,
Expand Down Expand Up @@ -1648,6 +1658,22 @@
path = "Authenticate with OAuth";
sourceTree = "<group>";
};
3E54CF202C66AFA400DD2F18 /* Add web tiled layer */ = {
isa = PBXGroup;
children = (
3E54CF212C66AFBE00DD2F18 /* AddWebTiledLayerView.swift */,
);
path = "Add web tiled layer";
sourceTree = "<group>";
};
3E720F9B2C619ACD00E22A9E /* Set initial viewpoint */ = {
isa = PBXGroup;
children = (
3E720F9C2C619B1700E22A9E /* SetInitialViewpointView.swift */,
);
path = "Set initial viewpoint";
sourceTree = "<group>";
};
3EEDE7CC2C5D735E00510104 /* Set spatial reference */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3256,12 +3282,14 @@
D7EAF35A2A1C023800D822C4 /* SetMinAndMaxScaleView.swift in Sources */,
1C19B4F52A578E46001D2506 /* CreateLoadReportView.Model.swift in Sources */,
9547085C2C3C719800CA8579 /* EditFeatureAttachmentsView.Model.swift in Sources */,
3E54CF222C66AFBE00DD2F18 /* AddWebTiledLayerView.swift in Sources */,
0042E24528E4F82C001F33D6 /* ShowViewshedFromPointInSceneView.ViewshedSettingsView.swift in Sources */,
D7DDF8532AF47C6C004352D9 /* FindRouteAroundBarriersView.swift in Sources */,
1C9B74D929DB54560038B06F /* ChangeCameraControllerView.swift in Sources */,
D76000AE2AF19C2300B3084D /* FindRouteInMobileMapPackageView.swift in Sources */,
00273CF42A82AB5900A7A77D /* SamplesSearchView.swift in Sources */,
D78666AD2A2161F100C60110 /* FindNearestVertexView.swift in Sources */,
3E720F9D2C619B1700E22A9E /* SetInitialViewpointView.swift in Sources */,
D76CE8D92BFD7047009A8686 /* SetReferenceScaleView.swift in Sources */,
D7C16D1B2AC5F95300689E89 /* Animate3DGraphicView.swift in Sources */,
D744FD172A2112D90084A66C /* CreateConvexHullAroundPointsView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct AddCustomDynamicEntityDataSourceView: View {
}

/// Makes a map with a dynamic entity layer.
static func makeMap() -> Map {
private static func makeMap() -> Map {
let map = Map(basemapStyle: .arcGISOceans)
map.initialViewpoint = Viewpoint(
latitude: 47.984,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ private extension URL {
)!
}

extension ConnectionStatus: CustomStringConvertible {
extension ConnectionStatus {
/// A user-friendly string for `ConnectionStatus`.
public var description: String {
var description: String {
switch self {
case .connecting:
return "Connecting"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct AddDynamicEntityLayerView: View {
@State private var placement: CalloutPlacement?

/// A Boolean value indicating if the stream service is connected.
var isConnected: Bool {
private var isConnected: Bool {
model.streamService.connectionStatus == .connected
}

Expand Down
50 changes: 50 additions & 0 deletions Shared/Samples/Add web tiled layer/AddWebTiledLayerView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2024 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
//
// https://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 ArcGIS
import SwiftUI

struct AddWebTiledLayerView: View {
/// A map with web tiled layer.
@State private var map: Map = {
// Build the web tiled layer from ArcGIS Living Atlas of the World tile service url.
let webTiledLayer = WebTiledLayer(urlTemplate: .worldTileServiceStringURL)
webTiledLayer.setAttribution(.attributionString)

let basemap = Basemap(baseLayer: webTiledLayer)
let map = Map(basemap: basemap)
map.initialViewpoint = Viewpoint(
center: Point(x: -1e6, y: 1e6),
scale: 15e7
)
return map
}()

var body: some View {
MapView(map: map)
}
}

private extension String {
/// The attribution string for the ArcGIS Living Atlas of the World.
static let attributionString = """
Map tiles by <a href="https://livingatlas.arcgis.com">ArcGIS Living Atlas of the World</a>, under <a href="https://www.esri.com/en-us/legal/terms/full-master-agreement">Esri Master License Agreement</a>. Data by Esri, Garmin, GEBCO, NOAA NGDC, and other contributors.
"""
/// The web tile service url from ArcGIS Living Atlas of the World.
static let worldTileServiceStringURL = "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{level}/{row}/{col}.jpg"
}

#Preview {
AddWebTiledLayerView()
}
45 changes: 45 additions & 0 deletions Shared/Samples/Add web tiled layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Add web tiled layer

Display a tiled web layer.

![Image of Add web tiled layer sample](add-web-tiled-layer.png)

## Use case

Tiled map services are a set of pre-generated images (e.g., "tiles") arranged in folders for each row, column, and zoom level. As you navigate the map, map tiles are requested for the current extent. `ArcGISTiledLayer` and `WMTSLayer` are types of tiled map services used for specific data types. `WebTiledLayer` is useful for displaying other data sources that contain tiles arranged in a row/column/level directory structure, such as OpenStreetMap.

## How to use the sample

Run the sample and a map will appear. As you navigate the map, map tiles will be fetched automatically and displayed on the map.

## How it works

Web tiled services use a uniform addressing scheme with pre-rendered tiles. Image tiles are accessed via a URL template string, with parameters for subdomain, level, column, and row.

* Subdomain is optional and allows the Maps SDK to balance requests among multiple servers for enhanced performance.
* Level, row, and column select the tiles to load based on the visible extent of the map.

To display the web tiled layer, this sample:

1. Creates a `WebTiledLayer` from a URL.
2. Creates a new `Basemap` from the layer.
3. Updates the attribution on the layer. Note: this is a necessary step because web tiled services don't have associated service metadata.
4. Displays the basemap.

For more information about web tiled layers, see the following resources:

* [Wikipedia: tiled web maps](https://en.wikipedia.org/wiki/Tiled_web_map)
* [ArcGIS Pro: Share a web tile layer](https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/web-tile-layer.htm)

## Relevant API

* Basemap
* WebTiledLayer

## About the data

The basemap in this sample is provided by [ArcGIS Living Atlas of the World](https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500). ArcGIS Living Atlas of the World provides tiled services with several unique styles.

## Tags

layer, OGC, tiled, tiles
25 changes: 25 additions & 0 deletions Shared/Samples/Add web tiled layer/README.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"category": "Layers",
"description": "Display a tiled web layer.",
"ignore": false,
"images": [
"add-web-tiled-layer.png"
],
"keywords": [
"OGC",
"layer",
"tiled",
"tiles",
"Basemap",
"WebTiledLayer"
],
"redirect_from": [],
"relevant_apis": [
"Basemap",
"WebTiledLayer"
],
"snippets": [
"AddWebTiledLayerView.swift"
],
"title": "Add web tiled layer"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private extension ArcGISCredential {
}
}

extension AnalyzeNetworkWithSubnetworkTraceView.Model {
private extension AnalyzeNetworkWithSubnetworkTraceView.Model {
/// An error returned when data required to setup the sample cannot be found.
struct SetupError: LocalizedError {
var errorDescription: String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
/// A Boolean value indicating if the add condition menu is presented.
@State private var isConditionMenuPresented = false

/// A Boolean value indicating whether the input box is showing.
@State private var inputBoxIsPresented = false

/// The value input by the user.
@State private var inputValue: Double?

Expand Down Expand Up @@ -97,7 +94,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
}
}

@ViewBuilder var toolbarItems: some View {
@ViewBuilder private var toolbarItems: some View {
Button("Reset") {
model.reset()
}
Expand All @@ -124,7 +121,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
.disabled(!model.traceEnabled)
}

@ViewBuilder var loadingView: some View {
@ViewBuilder private var loadingView: some View {
ZStack {
if !model.statusText.isEmpty {
Color.clear.background(.ultraThinMaterial)
Expand All @@ -142,7 +139,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
.errorAlert(presentingError: $error)
}

@ViewBuilder var conditionMenu: some View {
@ViewBuilder private var conditionMenu: some View {
List {
NavigationLink {
attributesView
Expand Down Expand Up @@ -239,7 +236,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
}
}

@ViewBuilder var attributesView: some View {
@ViewBuilder private var attributesView: some View {
List(model.possibleAttributes, id: \.name) { attribute in
HStack {
Text(attribute.name)
Expand All @@ -257,7 +254,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
.navigationTitle("Attributes")
}

@ViewBuilder var operatorsView: some View {
@ViewBuilder private var operatorsView: some View {
Section {
List(UtilityNetworkAttributeComparison.Operator.allCases, id: \.self) { comparison in
HStack {
Expand All @@ -277,7 +274,7 @@ struct AnalyzeNetworkWithSubnetworkTraceView: View {
.navigationTitle("Operators")
}

@ViewBuilder var valuesView: some View {
@ViewBuilder private var valuesView: some View {
if let domain = selectedAttribute?.domain as? CodedValueDomain {
Section {
List(domain.codedValues, id: \.name) { value in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct Animate3DGraphicView: View {
}
}

extension Animate3DGraphicView {
private extension Animate3DGraphicView {
/// Creates a binding to a camera controller property based on a given property.
/// - Parameter property: The property associated with a corresponding camera controller property.
/// - Returns: A binding to a camera controller property on the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ private extension AugmentRealityToCollectDataView {
graphicsOverlay.sceneProperties.surfacePlacement = .absolute
return graphicsOverlay
}()
/// The selected tree health for the new feature.
@State private var treeHealth: TreeHealth?

init() {
let featureLayer = FeatureLayer(featureTable: featureTable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ struct AuthenticateWithOAuthView: View {
}

/// Signs out from the portal by revoking OAuth tokens and clearing credential stores.
func signOut() {
private func signOut() {
Task {
await ArcGISEnvironment.authenticationManager.revokeOAuthTokens()
await ArcGISEnvironment.authenticationManager.clearCredentialStores()
}
}

// Sets up new ArcGIS and Network credential stores that will be persisted in the keychain.
func setupPersistentCredentialStorage() {
private func setupPersistentCredentialStorage() {
Task {
try await ArcGISEnvironment.authenticationManager.setupPersistentCredentialStorage(
access: .whenUnlockedThisDeviceOnly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,10 @@ struct ChangeCameraControllerView: View {
return graphicsOverlay
}()

/// A Boolean value indicating whether the settings view should be presented.
@State private var isShowingSettings = false

/// The camera controller kind of the scene view.
@State private var cameraControllerKind: CameraControllerKind = .globe

enum CameraControllerKind: CaseIterable {
private enum CameraControllerKind: CaseIterable {
case globe
case plane
case crater
Expand Down Expand Up @@ -113,7 +110,7 @@ struct ChangeCameraControllerView: View {
/// Creates a camera controller with the given kind of camera controller.
/// - Parameter kind: The camera controller kind.
/// - Returns: A camera controller.
func makeCameraController(kind: CameraControllerKind) -> CameraController {
private func makeCameraController(kind: CameraControllerKind) -> CameraController {
switch kind {
case .crater:
let targetLocation = Point(
Expand Down
4 changes: 2 additions & 2 deletions Shared/Samples/Change viewpoint/ChangeViewpointView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ChangeViewpointView: View {
/// The current viewpoint type.
@State private var viewpointType: ViewpointType = .centerAndScale

enum ViewpointType: CaseIterable {
private enum ViewpointType: CaseIterable {
case geometry, centerAndScale, animate

/// A human-readable label for the viewpoint type.
Expand Down Expand Up @@ -90,7 +90,7 @@ struct ChangeViewpointView: View {
}
}

extension ChangeViewpointView {
private extension ChangeViewpointView {
/// The model used to store the geo model and other expensive objects
/// used in this view.
class Model: ObservableObject {
Expand Down
Loading

0 comments on commit cbeaae8

Please sign in to comment.