Skip to content

Commit 0798aff

Browse files
committed
Add initial files.
1 parent f36e0ab commit 0798aff

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@
367367
D77D9C012BB2439400B38A6C /* AugmentRealityToShowHiddenInfrastructureView.ARSceneView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D77D9BFF2BB2438200B38A6C /* AugmentRealityToShowHiddenInfrastructureView.ARSceneView.swift */; };
368368
D78666AD2A2161F100C60110 /* FindNearestVertexView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */; };
369369
D78666AE2A21629200C60110 /* FindNearestVertexView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */; };
370+
D79482D42C35D872006521CD /* CreateDynamicBasemapGalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79482D02C35D872006521CD /* CreateDynamicBasemapGalleryView.swift */; };
371+
D79482D72C35D8A3006521CD /* CreateDynamicBasemapGalleryView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D79482D02C35D872006521CD /* CreateDynamicBasemapGalleryView.swift */; };
370372
D79EE76E2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */; };
371373
D79EE76F2A4CEA7F005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */; };
372374
D7A737E02BABB9FE00B7C7FC /* AugmentRealityToShowHiddenInfrastructureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7A737DC2BABB9FE00B7C7FC /* AugmentRealityToShowHiddenInfrastructureView.swift */; };
@@ -516,6 +518,7 @@
516518
dstPath = "";
517519
dstSubfolderSpec = 7;
518520
files = (
521+
D79482D72C35D8A3006521CD /* CreateDynamicBasemapGalleryView.swift in Copy Source Code Files */,
519522
95E980742C26189E00CB8912 /* BrowseOGCAPIFeatureServiceView.swift in Copy Source Code Files */,
520523
955AFAC62C110B8A009C8FE5 /* ApplyMosaicRuleToRastersView.swift in Copy Source Code Files */,
521524
95DEB9B82C127B5E009BEC35 /* ShowViewshedFromPointOnMapView.swift in Copy Source Code Files */,
@@ -918,6 +921,7 @@
918921
D77BC5362B59A2D3007B49B6 /* StylePointWithDistanceCompositeSceneSymbolView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StylePointWithDistanceCompositeSceneSymbolView.swift; sourceTree = "<group>"; };
919922
D77D9BFF2BB2438200B38A6C /* AugmentRealityToShowHiddenInfrastructureView.ARSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AugmentRealityToShowHiddenInfrastructureView.ARSceneView.swift; sourceTree = "<group>"; };
920923
D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindNearestVertexView.swift; sourceTree = "<group>"; };
924+
D79482D02C35D872006521CD /* CreateDynamicBasemapGalleryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateDynamicBasemapGalleryView.swift; sourceTree = "<group>"; };
921925
D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetUpLocationDrivenGeotriggersView.Model.swift; sourceTree = "<group>"; };
922926
D7A737DC2BABB9FE00B7C7FC /* AugmentRealityToShowHiddenInfrastructureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AugmentRealityToShowHiddenInfrastructureView.swift; sourceTree = "<group>"; };
923927
D7ABA2F82A32579C0021822B /* MeasureDistanceInSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasureDistanceInSceneView.swift; sourceTree = "<group>"; };
@@ -1138,6 +1142,7 @@
11381142
D7E440D12A1ECBC2005D74DE /* Create buffers around points */,
11391143
D7B3C5C02A43B71E001DA4D8 /* Create convex hull around geometries */,
11401144
D744FD132A2112360084A66C /* Create convex hull around points */,
1145+
D79482D32C35D872006521CD /* Create dynamic basemap gallery */,
11411146
1C19B4EA2A578E46001D2506 /* Create load report */,
11421147
D73FABE82AD4A0370048EC70 /* Create mobile geodatabase */,
11431148
E004A6EB28495538002A1FE6 /* Create planar and geodetic buffers */,
@@ -2308,6 +2313,14 @@
23082313
path = "Find nearest vertex";
23092314
sourceTree = "<group>";
23102315
};
2316+
D79482D32C35D872006521CD /* Create dynamic basemap gallery */ = {
2317+
isa = PBXGroup;
2318+
children = (
2319+
D79482D02C35D872006521CD /* CreateDynamicBasemapGalleryView.swift */,
2320+
);
2321+
path = "Create dynamic basemap gallery";
2322+
sourceTree = "<group>";
2323+
};
23112324
D7A737DF2BABB9FE00B7C7FC /* Augment reality to show hidden infrastructure */ = {
23122325
isa = PBXGroup;
23132326
children = (
@@ -3042,6 +3055,7 @@
30423055
004A2BA22BED456500C297CE /* ApplyScheduledUpdatesToPreplannedMapAreaView.swift in Sources */,
30433056
1CAB8D4B2A3CEAB0002AA649 /* RunValveIsolationTraceView.Model.swift in Sources */,
30443057
E070A0A3286F3B6000F2B606 /* DownloadPreplannedMapAreaView.swift in Sources */,
3058+
D79482D42C35D872006521CD /* CreateDynamicBasemapGalleryView.swift in Sources */,
30453059
D77570C02A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift in Sources */,
30463060
D7054AE92ACCCB6C007235BA /* Animate3DGraphicView.SettingsView.swift in Sources */,
30473061
D7BA8C442B2A4DAA00018633 /* Array+RawRepresentable.swift in Sources */,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2024 Esri
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import ArcGIS
16+
import SwiftUI
17+
18+
struct CreateDynamicBasemapGalleryView: View {
19+
/// A map with a topographic basemap.
20+
@State private var map = Map(basemapStyle: .arcGISTopographic)
21+
22+
var body: some View {
23+
MapView(map: map)
24+
}
25+
}
26+
27+
#Preview {
28+
CreateDynamicBasemapGalleryView()
29+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Create dynamic basemap gallery
2+
3+
Implement a basemap gallery that automatically retrieves the latest customization options from the basemap styles service.
4+
5+
![screenshot](screenshot.png)
6+
7+
## Use case
8+
9+
Multi-use and/or international applications benefit from the ability to change a basemap's style or localize the basemap. For example, an application used for ecological surveys might include navigation functionality to guide an ecologist to a location and functionality for inputting data. When traveling, a user is likely to benefit from a map with a style that emphasizes the transport infrastructure (e.g. `ArcGIS Navigation`). However, during surveys a user is likely to benefit from a map with a style that highlights features in the terrain (e.g. `ArcGIS Terrain`). Implementing a basemap gallery with customization options in an application gives a user the freedom to select a basemap with a style and features (e.g. language of labels) suitable for the task they are undertaking. Making the basemap gallery dynamic ensures the latest customization options are automatically included.
10+
11+
## How to use the sample
12+
13+
When launched, this sample displays a map containing a button that, when pressed, displays a gallery of all styles available in the basemap styles service. Selecting a style results in the drop-down menus at the base of the gallery becoming enabled or disabled. A disabled menu indicates that the customization cannot be applied to the selected style. Once a style and any desired customizations have been selected, pressing `Load` will update the basemap in the map view.
14+
15+
## How it works
16+
17+
* Instantiate and load a `BasemapStylesService` object.
18+
* Get the `BasemapStylesServiceInfo` object from `BasemapStylesService.info()`.
19+
* Access the list of `BasemapStyleInfo` objects using `BasemapStylesServiceInfo.stylesInfo()`. These `BasemapStyleInfo` objects contain up-to-date information about each of the styles supported by the Maps SDK, including:
20+
* `styleName`: The human-readable name of the style.
21+
* `style`: The `BasemapStyle` enumeration value representing this style in the Maps SDK.
22+
* `thumbnail`: An image that can be used to display a preview of the style.
23+
* `languages`: A list of `BasemapStyleLanguageInfo` objects, which provide information about each of the specific languages that can be used to customize labels on the style.
24+
* `worldview`: A list of `Worldview` objects, which provide information about each representation of a disputed boundary that can be used to customize boundaries on the style.
25+
* The information contained in the list of `BasemapStyleInfo` objects can be used as the data model for a basemap gallery UI component.
26+
27+
## Relevant API
28+
29+
* BasemapStyleInfo
30+
* BasemapStyleLanguageInfo
31+
* BasemapStyleParameters
32+
* BasemapStylesService
33+
* BasemapStylesServiceInfo
34+
* Worldview
35+
36+
## Additional information
37+
38+
This sample demonstrates how to implement a basemap gallery using the Maps SDK. The styles and associated customization options used for the gallery are retrieved from the [basemap styles service](https://developers.arcgis.com/rest/basemap-styles/). A ready-made basemap gallery component is also available in the toolkit's provided with each SDK. To see how the ready-made basemap gallery toolkit component can be integrated into a Maps SDK application refer to the `Set Basemap` sample.
39+
40+
## Tags
41+
42+
basemap, languages, service, style
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"category": "Maps",
3+
"description": "Implement a basemap gallery that automatically retrieves the latest customization options from the basemap styles service.",
4+
"ignore": false,
5+
"images": [],
6+
"keywords": [
7+
"basemap",
8+
"languages",
9+
"service",
10+
"style",
11+
"BasemapStyleInfo",
12+
"BasemapStyleLanguageInfo",
13+
"BasemapStyleParameters",
14+
"BasemapStylesService",
15+
"BasemapStylesServiceInfo",
16+
"Worldview"
17+
],
18+
"redirect_from": [],
19+
"relevant_apis": [
20+
"BasemapStyleInfo",
21+
"BasemapStyleLanguageInfo",
22+
"BasemapStyleParameters",
23+
"BasemapStylesService",
24+
"BasemapStylesServiceInfo",
25+
"Worldview"
26+
],
27+
"snippets": [
28+
"CreateDynamicBasemapGalleryView.swift"
29+
],
30+
"title": "Create dynamic basemap gallery"
31+
}

0 commit comments

Comments
 (0)