Click or drag to resize

Surface Class

Surface contains elevation sources and defines a surface upon which layers and overlays can be draped.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.MappingSurface

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
C#
public class Surface : ILoadable

The Surface type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleSurface
Initializes a new instance of the Surface class.
Top
Properties
  NameDescription
Public propertyBackgroundGrid
Gets or sets the settings applied to rendering the surface's background when no data is draped on top of it.
Public propertyCode exampleElevationExaggeration
Gets or sets the elevation exaggeration for the surface.
Public propertyCode exampleElevationSources
Gets the collection of elevation sources in the surface.
Public propertyIsEnabled
Gets or sets a value indicating whether this surface is enabled and should be rendered.
Public propertyLoadError
Gets the load error of the surface (null if loading was successful).
Public propertyLoadStatus
Gets the load status of the surface.
Public propertyName
Gets or sets the name for the surface.
Public propertyCode exampleNavigationConstraint
Gets or sets the type of navigation constraint from the surface.
Public propertyCode exampleOpacity
Gets or sets the opacity applied to the Surface.
Top
Methods
  NameDescription
Public methodCancelLoad
Cancels an ongoing load.
Public methodCode exampleGetElevationAsync
Gets the best available elevation from the elevation surface
Public methodLoadAsync
Initiates loading of the surface.
Public methodRetryLoadAsync
Retry loading the surface.
Top
Events
  NameDescription
Public eventLoaded
Occurs when the surface is loaded.
Public eventLoadStatusChanged
Occurs when the surface LoadStatus property is changed.
Public eventPropertyChanged
Occurs when a property value changes.
Top
Examples

Android

Example Name: ViewContentBeneathSurface

See through terrain in a scene and move the camera underground.

Code example screen shot.

C#
// Copyright 2019 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.

using Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Portal;
using Esri.ArcGISRuntime.UI.Controls;

namespace ArcGISRuntimeXamarin.Samples.ViewContentBeneathSurface
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "View content beneath terrain surface",
        "Map",
        "See through terrain in a scene and move the camera underground.",
        "")]
    public class ViewContentBeneathSurface : Activity
    {
        // Hold references to the UI controls.
        private SceneView _mySceneView;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "View content beneath terrain surface";

            CreateLayout();
            Initialize();
        }

        private async void Initialize()
        {
            // Load the item from ArcGIS Online.
            PortalItem webSceneItem = await PortalItem.CreateAsync(await ArcGISPortal.CreateAsync(), "91a4fafd747a47c7bab7797066cb9272");

            // Load the web scene from the item.
            Scene webScene = new Scene(webSceneItem);

            // Show the web scene in the view.
            _mySceneView.Scene = webScene;

            // Set the view properties to enable underground navigation.
            // Note: the scene in this sample sets these properties automatically.
            // Scenes authored in this way will be enabled for underground navigation without
            // changing the navigation constraint manually.
            _mySceneView.Scene.BaseSurface.NavigationConstraint = NavigationConstraint.None;
            _mySceneView.Scene.BaseSurface.Opacity = .6;
        }

        private void CreateLayout()
        {
            // Create a new vertical layout for the app.
            var layout = new LinearLayout(this) {Orientation = Orientation.Vertical};

            // Add the map view to the layout.
            _mySceneView = new SceneView(this);
            layout.AddView(_mySceneView);

            // Show the layout in the app.
            SetContentView(layout);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: SceneSymbols

Show various kinds of 3D symbols in a scene.

Code example screen shot.

C#
// Copyright 2019 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.

using System;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Xamarin.Forms;
using Color = System.Drawing.Color;

namespace ArcGISRuntimeXamarin.Samples.SceneSymbols
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Scene symbols",
        "Symbology",
        "Show various kinds of 3D symbols in a scene.",
        "",
        "Scenes", "Symbols", "Graphics", "graphics overlay", "3D", "cone", "cylinder", "tube", "sphere", "diamond", "tetrahedron")]
    public partial class SceneSymbols : ContentPage
    {
        private readonly string _elevationServiceUrl = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

        public SceneSymbols()
        {
            Title = "Scene symbols";
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Configure the scene with an imagery basemap.
            MySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Add a surface to the scene for elevation.
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl));
            Surface elevationSurface = new Surface();
            elevationSurface.ElevationSources.Add(elevationSource);
            MySceneView.Scene.BaseSurface = elevationSurface;

            // Create the graphics overlay.
            GraphicsOverlay overlay = new GraphicsOverlay();

            // Set the surface placement mode for the overlay.
            overlay.SceneProperties.SurfacePlacement = SurfacePlacement.Absolute;

            // Create a graphic for each symbol type and add it to the scene.
            int index = 0;
            Color[] colors = {Color.Red, Color.Green, Color.Blue, Color.Purple, Color.Turquoise, Color.White};
            Array symbolStyles = Enum.GetValues(typeof(SimpleMarkerSceneSymbolStyle));
            foreach (SimpleMarkerSceneSymbolStyle symbolStyle in symbolStyles)
            {
                // Create the symbol.
                SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(symbolStyle, colors[index], 200, 200, 200, SceneSymbolAnchorPosition.Center);

                // Offset each symbol so that they aren't in the same spot.
                double positionOffset = 0.01 * index;
                MapPoint point = new MapPoint(44.975 + positionOffset, 29, 500, SpatialReferences.Wgs84);

                // Create the graphic from the geometry and the symbol.
                Graphic item = new Graphic(point, symbol);

                // Add the graphic to the overlay.
                overlay.Graphics.Add(item);

                // Increment the index.
                index++;
            }

            // Show the graphics overlay in the scene.
            MySceneView.GraphicsOverlays.Add(overlay);

            // Set the initial viewpoint.
            Camera initalViewpoint = new Camera(28.9672, 44.9858, 2495, 12, 53, 0);
            MySceneView.SetViewpointCamera(initalViewpoint);
        }
    }
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             x:Class="ArcGISRuntimeXamarin.Samples.SceneSymbols.SceneSymbols">
  <Grid>
    <esriUI:SceneView x:Name="MySceneView"/>
  </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddAnIntegratedMeshLayerView an integrated mesh layer from a scene service.
Animate3DGraphicAn `OrbitGeoElementCameraController` follows a graphic while the graphic's position and rotation are animated.
ChangeAtmosphereEffectChanges the appearance of the atmosphere in a scene.
ChooseCameraControllerControl the behavior of the camera in a scene.
CreateTerrainSurfaceFromRasterUse a terrain surface with elevation described by a raster file.
CreateTerrainSurfaceFromTilePackageSet the terrain surface with elevation described by a local tile package.
DisplaySceneDisplay a scene with a terrain surface and some imagery.
DistanceMeasurementMeasure distances between two points in 3D.
GetElevationAtPointGet the elevation for a given point on a surface in a scene.
LineOfSightGeoElementShow a line of sight between two moving objects.
LineOfSightLocationPerform a line of sight analysis between two points in real time.
ListKmlContentsList the contents of a KML file. KML files can contain a hierarchy of features, including network links to other KML content.
PlayKmlToursPlay tours in KML files.
SceneLayerSelectionIdentify GeoElements in a scene layer.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
SceneSymbolsShow various kinds of 3D symbols in a scene.
SurfacePlacementsPosition graphics relative to a surface using different surface placement modes.
TerrainExaggerationConfigure the vertical exaggeration of terrain (the ground surface) in a scene.
ViewContentBeneathSurfaceSee through terrain in a scene and move the camera underground.
ViewPointCloudDataOfflineDisplay local 3D point cloud data.
ViewshedCameraAnalyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point.
ViewshedGeoElementAnalyze the viewshed for an object (GeoElement) in a scene.
ViewshedLocationPerform a viewshed analysis from a defined vantage point. Viewshed analyses have several configuration options that are demonstrated in this sample.