Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UtilityNetworkTrace - Example/tutorial revisions #684

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Examples/Examples/UtilityNetworkTraceExampleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,23 @@ import SwiftUI
/// A demonstration of the utility network trace tool which runs traces on a web map published with
/// a utility network and trace configurations.
struct UtilityNetworkTraceExampleView: View {
@Environment(\.isPortraitOrientation)
private var isPortraitOrientation

/// The map with the utility networks.
@State private var map = makeMap()
@Environment(\.isPortraitOrientation) private var isPortraitOrientation

/// The current detent of the floating panel presenting the trace tool.
@State private var activeDetent: FloatingPanelDetent = .half

/// The map with the utility networks.
@State private var map = makeMap()

/// Provides the ability to detect tap locations in the context of the map view.
@State private var mapPoint: Point?

/// Provides the ability to detect tap locations in the context of the screen.
@State private var screenPoint: CGPoint?

/// A container for graphical trace results.
@State private var resultGraphicsOverlay = GraphicsOverlay()

/// Provides the ability to detect tap locations in the context of the screen.
@State private var screenPoint: CGPoint?

/// The map viewpoint used by the `UtilityNetworkTrace` to pan/zoom the map to selected features.
@State private var viewpoint: Viewpoint?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View {

@State private var mapPoint: Point?

@State private var screenPoint: CGPoint?

@State private var resultGraphicsOverlay = GraphicsOverlay()

@State private var screenPoint: CGPoint?

@State private var viewpoint: Viewpoint?

static func makeMap() -> Map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View {

@State private var mapPoint: Point?

@State private var screenPoint: CGPoint?

@State private var resultGraphicsOverlay = GraphicsOverlay()

@State private var screenPoint: CGPoint?

@State private var viewpoint: Viewpoint?

var body: some View {
Expand All @@ -35,3 +35,15 @@ struct UtilityNetworkTraceExampleView: View {
return Map(item: portalItem)
}
}

private extension ArcGISCredential {
static var publicSample: ArcGISCredential {
get async throws {
try await TokenCredential.credential(
for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!,
username: "viewer01",
password: "I68VGU^nMurF"
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View {

@State private var mapPoint: Point?

@State private var screenPoint: CGPoint?

@State private var resultGraphicsOverlay = GraphicsOverlay()

@State private var screenPoint: CGPoint?

@State private var viewpoint: Viewpoint?

var body: some View {
Expand Down Expand Up @@ -38,3 +38,15 @@ struct UtilityNetworkTraceExampleView: View {
return Map(item: portalItem)
}
}

private extension ArcGISCredential {
static var publicSample: ArcGISCredential {
get async throws {
try await TokenCredential.credential(
for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!,
username: "viewer01",
password: "I68VGU^nMurF"
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ struct UtilityNetworkTraceExampleView: View {

@State private var mapPoint: Point?

@State private var screenPoint: CGPoint?

@State private var resultGraphicsOverlay = GraphicsOverlay()

@State private var screenPoint: CGPoint?

@State private var viewpoint: Viewpoint?

var body: some View {
Expand Down Expand Up @@ -42,3 +42,15 @@ struct UtilityNetworkTraceExampleView: View {
return Map(item: portalItem)
}
}

private extension ArcGISCredential {
static var publicSample: ArcGISCredential {
get async throws {
try await TokenCredential.credential(
for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!,
username: "viewer01",
password: "I68VGU^nMurF"
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import ArcGISToolkit
import SwiftUI

struct UtilityNetworkTraceExampleView: View {
@State private var map = makeMap()

@State private var activeDetent: FloatingPanelDetent = .half

@State private var mapPoint: Point?
@State private var map = makeMap()

@State private var screenPoint: CGPoint?
@State private var mapPoint: Point?

@State private var resultGraphicsOverlay = GraphicsOverlay()

@State private var screenPoint: CGPoint?

@State private var viewpoint: Viewpoint?

var body: some View {
Expand Down Expand Up @@ -60,3 +60,15 @@ struct UtilityNetworkTraceExampleView: View {
return Map(item: portalItem)
}
}

private extension ArcGISCredential {
static var publicSample: ArcGISCredential {
get async throws {
try await TokenCredential.credential(
for: URL(string: "https://sampleserver7.arcgisonline.com/portal/sharing/rest")!,
username: "viewer01",
password: "I68VGU^nMurF"
)
}
}
}