Skip to content

[New] Add integrated mesh layer #578

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

Merged
merged 4 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 14 additions & 0 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
004FE87129DF5D8700075217 /* Bristol in Resources */ = {isa = PBXBuildFile; fileRef = 004FE87029DF5D8700075217 /* Bristol */; settings = {ASSET_TAGS = (Animate3DGraphic, ChangeCameraController, OrbitCameraAroundObject, StylePointWithDistanceCompositeSceneSymbol, ); }; };
006C835528B40682004AEB7F /* BrowseBuildingFloorsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = E0FE32E628747778002C6ACA /* BrowseBuildingFloorsView.swift */; };
006C835628B40682004AEB7F /* DisplayMapFromMobileMapPackageView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = F111CCC0288B5D5600205358 /* DisplayMapFromMobileMapPackageView.swift */; };
0072C7FA2DBABEAC001502CA /* AddIntegratedMeshLayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0072C7F92DBABEA9001502CA /* AddIntegratedMeshLayerView.swift */; };
0072C7FB2DBAC1A0001502CA /* AddIntegratedMeshLayerView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 0072C7F92DBABEA9001502CA /* AddIntegratedMeshLayerView.swift */; };
0074ABBF28174BCF0037244A /* DisplayMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0074ABBE28174BCF0037244A /* DisplayMapView.swift */; };
0074ABC428174F430037244A /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0074ABC128174F430037244A /* Sample.swift */; };
0074ABCD2817BCC30037244A /* SamplesApp+Samples.swift.tache in Sources */ = {isa = PBXBuildFile; fileRef = 0074ABCA2817B8DB0037244A /* SamplesApp+Samples.swift.tache */; };
Expand Down Expand Up @@ -600,6 +602,7 @@
dstPath = "";
dstSubfolderSpec = 7;
files = (
0072C7FB2DBAC1A0001502CA /* AddIntegratedMeshLayerView.swift in Copy Source Code Files */,
004421912DB96A7800249FEE /* AddFeatureCollectionLayerFromQueryView.swift in Copy Source Code Files */,
0044218B2DB9575600249FEE /* AddFeatureCollectionLayerFromPortalItemView.swift in Copy Source Code Files */,
D703F04E2D9334BD0077E3A8 /* SnapGeometryEditsWithUtilityNetworkRulesView.Model.swift in Copy Source Code Files */,
Expand Down Expand Up @@ -860,6 +863,7 @@
004A2B9C2BED455B00C297CE /* canyonlands */ = {isa = PBXFileReference; lastKnownFileType = folder; path = canyonlands; sourceTree = "<group>"; };
004A2B9E2BED456500C297CE /* ApplyScheduledUpdatesToPreplannedMapAreaView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplyScheduledUpdatesToPreplannedMapAreaView.swift; sourceTree = "<group>"; };
004FE87029DF5D8700075217 /* Bristol */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Bristol; sourceTree = "<group>"; };
0072C7F92DBABEA9001502CA /* AddIntegratedMeshLayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddIntegratedMeshLayerView.swift; sourceTree = "<group>"; };
0074ABBE28174BCF0037244A /* DisplayMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayMapView.swift; sourceTree = "<group>"; };
0074ABC128174F430037244A /* Sample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sample.swift; sourceTree = "<group>"; };
0074ABCA2817B8DB0037244A /* SamplesApp+Samples.swift.tache */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SamplesApp+Samples.swift.tache"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1274,6 +1278,14 @@
path = "Apply scheduled updates to preplanned map area";
sourceTree = "<group>";
};
0072C7F72DBABE9A001502CA /* Add integrated mesh layer */ = {
isa = PBXGroup;
children = (
0072C7F92DBABEA9001502CA /* AddIntegratedMeshLayerView.swift */,
);
path = "Add integrated mesh layer";
sourceTree = "<group>";
};
0074ABAF281742420037244A /* Supporting Files */ = {
isa = PBXGroup;
children = (
Expand All @@ -1297,6 +1309,7 @@
0044218D2DB961F500249FEE /* Add feature collection layer from query */,
00D4EF7E2863840D00B9CC30 /* Add feature layers */,
D7F8C0342B60564D0072BFA7 /* Add features with contingent values */,
0072C7F72DBABE9A001502CA /* Add integrated mesh layer */,
D713C6D42CB990600073AA72 /* Add KML layer */,
D751B4C72CD3E572005CE750 /* Add KML layer with network links */,
D7DFA0E92CBA0242007C31F2 /* Add map image layer */,
Expand Down Expand Up @@ -3566,6 +3579,7 @@
7573E81C29D6134C00BEED9C /* TraceUtilityNetworkView.Enums.swift in Sources */,
7573E81A29D6134C00BEED9C /* TraceUtilityNetworkView.Model.swift in Sources */,
1C3B7DC82A5F64FC00907443 /* AnalyzeNetworkWithSubnetworkTraceView.Model.swift in Sources */,
0072C7FA2DBABEAC001502CA /* AddIntegratedMeshLayerView.swift in Sources */,
D752D9402A39154C003EB25E /* ManageOperationalLayersView.swift in Sources */,
D7ABA2F92A32579C0021822B /* MeasureDistanceInSceneView.swift in Sources */,
D7CDD38B2CB86F0A00DE9766 /* AddPointCloudLayerFromFileView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2025 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 AddIntegratedMeshLayerView: View {
/// A scene with an imagery basemap style and an integrated mesh layer.
@State private var scene: ArcGIS.Scene = {
let scene = Scene(basemapStyle: .arcGISImagery)
// Creates the elevation source.
let elevationSource = ArcGISTiledElevationSource(
url: URL(string: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")!
)
// Creates the surface and adds it to the scene.
let surface = Surface()
surface.addElevationSource(elevationSource)
scene.baseSurface = surface

// Creates the integrated mesh layer that depicts Girona, Spain from
// a scene service and adds it to the scene.
let integratedMeshLayer = IntegratedMeshLayer(
url: URL(string: "https://tiles.arcgis.com/tiles/z2tnIkrLQ2BRzr6P/arcgis/rest/services/Girona_Spain/SceneServer")!
)
scene.addOperationalLayer(integratedMeshLayer)
return scene
}()

/// A Boolean value indicating when the draw status becomes completed
/// for the first time.
@State private var initialDrawCompleted = false

/// The camera for zooming the scene view to the location.
@State private var camera: Camera? = Camera(
latitude: 41.9906,
longitude: 2.8259,
altitude: 200,
heading: 190,
pitch: 65,
roll: 0
)

var body: some View {
SceneView(scene: scene, camera: $camera)
.onDrawStatusChanged { drawStatus in
// Updates the the Boolean when the scene view's draw status
// becomes completed for the first time.
withAnimation {
if !initialDrawCompleted && drawStatus == .completed {
initialDrawCompleted = true
}
}
}
.overlay(alignment: .center) {
if !initialDrawCompleted {
ProgressView("Loading...")
.padding()
.background(.ultraThickMaterial)
.clipShape(.rect(cornerRadius: 10))
.shadow(radius: 50)
}
}
}
}

#Preview {
AddIntegratedMeshLayerView()
}
35 changes: 35 additions & 0 deletions Shared/Samples/Add integrated mesh layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Add integrated mesh layer

View an integrated mesh layer from a scene service.

![Image of Add integrated mesh layer sample](add-integrated-mesh-layer.png)

## Use case

An integrated mesh is used to generate a mesh over a point dataset. They are most often used on high-density point datasets to create a high-resolution seamless surface.

## How to use the sample

After launching the sample, watch the integrated mesh layer load in place. Navigate around the scene to visualize the high level of detail on the buildings.

## How it works

1. Create a `Scene`.
2. Create an `IntegratedMeshLayer` with the URL to an integrated mesh layer scene service.
3. Add the layer to the scene's operational layers.

## Relevant API

* IntegratedMeshLayer

## About the data

This integrated mesh depicts the city of Girona, Spain and is attributed to the Institut Cartogràfic i Geològic de Catalunya (ICGC). The data was produced from [photogrammetrically correct imagery](https://pro.arcgis.com/en/pro-app/latest/help/data/imagery/ortho-mapping-in-arcgis-pro.htm). Areas of white space within the integrated mesh are areas that had poor overlapping coverage from photos.

## Additional information

An integrated mesh layer can also be added to a scene from a local data source - either from a scene layer package (.slpk) or a mobile scene package (.mspk).

## Tags

3D, integrated mesh, layers
22 changes: 22 additions & 0 deletions Shared/Samples/Add integrated mesh layer/README.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"category": "Layers",
"description": "View an integrated mesh layer from a scene service.",
"ignore": false,
"images": [
"add-integrated-mesh-layer.png"
],
"keywords": [
"3D",
"integrated mesh",
"layers",
"IntegratedMeshLayer"
],
"redirect_from": [],
"relevant_apis": [
"IntegratedMeshLayer"
],
"snippets": [
"AddIntegratedMeshLayerView.swift"
],
"title": "Add integrated mesh layer"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading