Click or drag to resize

OrbitLocationCameraController Class

Camera controller that supports orbital camera navigation around a stationary point in a SceneView.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.UICameraController
    Esri.ArcGISRuntime.UIOrbitLocationCameraController

Namespace:  Esri.ArcGISRuntime.UI
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.5.0.0
Syntax
C#
public sealed class OrbitLocationCameraController : CameraController

The OrbitLocationCameraController type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleOrbitLocationCameraController
Initializes a new instance of the OrbitLocationCameraController class from the given point.
Top
Properties
  NameDescription
Public propertyCameraDistance
Gets or sets the distance from the TargetLocation to the camera in meters.
Public propertyCameraHeadingOffset
Gets or sets the heading of the camera relative to the TargetLocation in degrees.
Public propertyCameraPitchOffset
Gets or sets the pitch of the camera relative to the TargetLocation in degrees.
Public propertyIsCameraDistanceInteractive
Gets or sets a flag indicating if user interactions are enabled supporting distance zoom interactions.
Public propertyIsCameraHeadingOffsetInteractive
Gets or sets a flag indicating if user interactions are enabled supporting horizontal pan interactions.
Public propertyIsCameraPitchOffsetInteractive
Gets or sets a flag indicating if user interactions are enabled supporting vertical pan interactions.
Public propertyMaxCameraDistance
Gets or sets the maximum distance from the camera to TargetLocation in meters.
Public propertyMaxCameraHeadingOffset
Gets or sets the maximum limit on CameraHeadingOffset in degrees.
Public propertyMaxCameraPitchOffset
Gets or sets the maximum limit on CameraPitchOffset in degrees.
Public propertyMinCameraDistance
Gets or sets the minimum distance from the camera to TargetLocation in meters.
Public propertyMinCameraHeadingOffset
Gets or sets the minimum limit on CameraHeadingOffset in degrees.
Public propertyMinCameraPitchOffset
Gets or sets the minimum limit on CameraPitchOffset in degrees.
Public propertyTargetLocation
Gets the target location for the camera to look at and rotate around.
Top
Methods
  NameDescription
Public methodMoveCameraAsync
Animates the camera to a new offset position relative to the target with the specified duration.
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from CameraController.)
Top
Remarks
With this CameraController, interactions will pivot the camera around a target Point so the camera is always looking at the target. To activate the controller, set it to the SceneView CameraController property. When active, setting the viewpoint on the SceneView will be disabled.
Examples

Android

Example Name: FeatureLayerExtrusion

This sample demonstrates how to apply extrusion to a renderer on a feature layer.

Code example screen shot.

C#
// Copyright 2018 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.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Drawing;

namespace ArcGISRuntime.Samples.FeatureLayerExtrusion
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Feature layer extrusion",
        "Symbology",
        "This sample demonstrates how to apply extrusion to a renderer on a feature layer.",
        "")]
    public class FeatureLayerExtrusion : Activity
    {
        // Create and hold reference to the used MapView
        private SceneView _mySceneView = new SceneView();

        private Button _button_ToggleExtrusionData;

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

            Title = "Feature layer extrusion";

            // Create the UI, setup the control references 
            CreateLayout();

            Initialize();
        }

        private void Initialize()
        {
            try
            {
                // Define the Uri for the service feature table (US state polygons)
                Uri myServiceFeatureTable_Uri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3");

                // Create a new service feature table from the Uri
                ServiceFeatureTable myServiceFeatureTable = new ServiceFeatureTable(myServiceFeatureTable_Uri);

                // Create a new feature layer from the service feature table
                FeatureLayer myFeatureLayer = new FeatureLayer(myServiceFeatureTable)
                {

                    // Set the rendering mode of the feature layer to be dynamic (needed for extrusion to work)
                    RenderingMode = FeatureRenderingMode.Dynamic
                };

                // Create a new simple line symbol for the feature layer
                SimpleLineSymbol mySimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Black, 1);

                // Create a new simple fill symbol for the feature layer 
                SimpleFillSymbol mysimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Color.Blue, mySimpleLineSymbol);

                // Create a new simple renderer for the feature layer
                SimpleRenderer mySimpleRenderer = new SimpleRenderer(mysimpleFillSymbol);

                // Get the scene properties from the simple renderer
                RendererSceneProperties myRendererSceneProperties = mySimpleRenderer.SceneProperties;

                // Set the extrusion mode for the scene properties
                myRendererSceneProperties.ExtrusionMode = ExtrusionMode.AbsoluteHeight;

                // Set the initial extrusion expression
                myRendererSceneProperties.ExtrusionExpression = "[POP2007] / 10";

                // Set the feature layer's renderer to the define simple renderer
                myFeatureLayer.Renderer = mySimpleRenderer;

                // Create a new scene with the topographic backdrop 
                Scene myScene = new Scene(BasemapType.Topographic);

                // Set the scene view's scene to the newly create one
                _mySceneView.Scene = myScene;

                // Add the feature layer to the scene's operational layer collection
                myScene.OperationalLayers.Add(myFeatureLayer);

                // Create a new map point to define where to look on the scene view
                MapPoint myMapPoint = new MapPoint(-10974490, 4814376, 0, SpatialReferences.WebMercator);

                // Create a new orbit location camera controller using the map point and defined distance
                OrbitLocationCameraController myOrbitLocationCameraController = new OrbitLocationCameraController(myMapPoint, 20000000);

                // Set the scene view's camera controller to the orbit location camera controller
                _mySceneView.CameraController = myOrbitLocationCameraController;
            }
            catch (Exception ex)
            {
                // Something went wrong, display the error
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Error");
                alert.SetMessage(ex.Message);
                alert.Show();
            }
        }

        private void ChangeExtrusionExpression()
        {
            // Get the first layer from the scene view's operation layers, it should be a feature layer
            FeatureLayer myFeatureLayer = (FeatureLayer)_mySceneView.Scene.OperationalLayers[0];

            // Get the renderer from the feature layer
            Renderer myRenderer = myFeatureLayer.Renderer;

            // Get the scene properties from the feature layer's renderer
            RendererSceneProperties myRendererSceneProperties = myRenderer.SceneProperties;

            // Toggle the feature layer's scene properties renderer extrusion expression and change the button text
            if (_button_ToggleExtrusionData.Text == "Show population density")
            {
                // An offset of 100000 is added to ensure that polygons for large areas (like Alaska)
                // with low populations will be extruded above the curvature of the Earth.
                myRendererSceneProperties.ExtrusionExpression = "[POP07_SQMI] * 5000 + 100000";
                _button_ToggleExtrusionData.Text = "Show total population";
            }
            else if (_button_ToggleExtrusionData.Text == "Show total population")
            {
                myRendererSceneProperties.ExtrusionExpression = "[POP2007] / 10";
                _button_ToggleExtrusionData.Text = "Show population density";
            }
        }

        private void Button_ToggleExtrusionData_Clicked(object sender, EventArgs e)
        {

            // Call the function to change the feature layer's renderer scene properties extrusion expression
            ChangeExtrusionExpression();
        }

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

            // Create Button
            _button_ToggleExtrusionData = new Button(this)
            {
                Text = "Show population density"
            };
            _button_ToggleExtrusionData.Click += Button_ToggleExtrusionData_Clicked;

            // Add Button to the layout  
            layout.AddView(_button_ToggleExtrusionData);

            // Add the scene view to the layout
            layout.AddView(_mySceneView);

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

Xamarin Forms Android

Example Name: FeatureLayerExtrusion

This sample demonstrates how to apply extrusion to a renderer on a feature layer.

Code example screen shot.

C#
// Copyright 2018 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 Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using System;
using Xamarin.Forms;
using Colors = System.Drawing.Color;

namespace ArcGISRuntime.Samples.FeatureLayerExtrusion
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Feature layer extrusion",
        "Symbology",
        "This sample demonstrates how to apply extrusion to a renderer on a feature layer.",
        "")]
    public partial class FeatureLayerExtrusion : ContentPage
    {
        public FeatureLayerExtrusion()
        {
            InitializeComponent ();

            Initialize();
        }

        private async void Initialize()
        {
            try
            {
                // Define the Uri for the service feature table (US state polygons)
                Uri myServiceFeatureTable_Uri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3");

                // Create a new service feature table from the Uri
                ServiceFeatureTable myServiceFeatureTable = new ServiceFeatureTable(myServiceFeatureTable_Uri);

                // Create a new feature layer from the service feature table
                FeatureLayer myFeatureLayer = new FeatureLayer(myServiceFeatureTable)
                {

                    // Set the rendering mode of the feature layer to be dynamic (needed for extrusion to work)
                    RenderingMode = FeatureRenderingMode.Dynamic
                };

                // Create a new simple line symbol for the feature layer
                SimpleLineSymbol mySimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Colors.Black, 1);

                // Create a new simple fill symbol for the feature layer 
                SimpleFillSymbol mysimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Colors.Blue, mySimpleLineSymbol);

                // Create a new simple renderer for the feature layer
                SimpleRenderer mySimpleRenderer = new SimpleRenderer(mysimpleFillSymbol);

                // Get the scene properties from the simple renderer
                RendererSceneProperties myRendererSceneProperties = mySimpleRenderer.SceneProperties;

                // Set the extrusion mode for the scene properties
                myRendererSceneProperties.ExtrusionMode = ExtrusionMode.AbsoluteHeight;

                // Set the initial extrusion expression
                myRendererSceneProperties.ExtrusionExpression = "[POP2007] / 10";

                // Set the feature layer's renderer to the define simple renderer
                myFeatureLayer.Renderer = mySimpleRenderer;

                // Create a new scene with the topographic backdrop 
                Scene myScene = new Scene(BasemapType.Topographic);

                // Set the scene view's scene to the newly create one
                MySceneView.Scene = myScene;

                // Add the feature layer to the scene's operational layer collection
                myScene.OperationalLayers.Add(myFeatureLayer);

                // Create a new map point to define where to look on the scene view
                MapPoint myMapPoint = new MapPoint(-10974490, 4814376, 0, SpatialReferences.WebMercator);

                // Create a new orbit location camera controller using the map point and defined distance
                OrbitLocationCameraController myOrbitLocationCameraController = new OrbitLocationCameraController(myMapPoint, 20000000);

                // Set the scene view's camera controller to the orbit location camera controller
                MySceneView.CameraController = myOrbitLocationCameraController;
            }
            catch (Exception ex)
            {
                // Something went wrong, display the error
                await ((Page)Parent).DisplayAlert("Error",ex.ToString(), "OK");
            }
        }

        private void ChangeExtrusionExpression()
        {
            // Get the first layer from the scene view's operation layers, it should be a feature layer
            FeatureLayer myFeatureLayer = (FeatureLayer)MySceneView.Scene.OperationalLayers[0];

            // Get the renderer from the feature layer
            Renderer myRenderer = myFeatureLayer.Renderer;

            // Get the scene properties from the feature layer's renderer
            RendererSceneProperties myRendererSceneProperties = myRenderer.SceneProperties;

            // Toggle the feature layer's scene properties renderer extrusion expression and change the button text
            if (ToggleExtrusionDataButton.Text == "Show population density")
            {
                // An offset of 100000 is added to ensure that polygons for large areas (like Alaska)
                // with low populations will be extruded above the curvature of the Earth.
                myRendererSceneProperties.ExtrusionExpression = "[POP07_SQMI] * 5000 + 100000";
                ToggleExtrusionDataButton.Text = "Show total population";
            }
            else if (ToggleExtrusionDataButton.Text == "Show total population")
            {
                myRendererSceneProperties.ExtrusionExpression = "[POP2007] / 10";
                ToggleExtrusionDataButton.Text = "Show population density";
            }
        }

        private void ToggleExtrusionData_Click(object sender, EventArgs e)
        {
            // Call the function to change the feature layer's renderer scene properties extrusion expression
            ChangeExtrusionExpression();
        }
    }
}
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="ArcGISRuntime.Samples.FeatureLayerExtrusion.FeatureLayerExtrusion">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button x:Name="ToggleExtrusionDataButton" Grid.Row="0"
                Text="Show population density"
                Clicked="ToggleExtrusionData_Click" />
        <esriUI:SceneView x:Name="MySceneView"
                          Grid.Row="1" />
    </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
FeatureLayerExtrusionThis sample demonstrates how to apply extrusion to a renderer on a feature layer.