Click or drag to resize

Camera Class

Used for defining the perspective of a scene. It is a visual snapshot of an observation of the Earth with various layers displayed in a SceneView.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.MappingCamera

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.6.0.0
Syntax
public class Camera

The Camera type exposes the following members.

Constructors
  NameDescription
Public methodCamera(TransformationMatrix)
Initializes a new instance of the Camera class using a transformation matrix.
Public methodCode exampleCamera(MapPoint, Double, Double, Double)
Initializes a new instance of the Camera class.
Public methodCode exampleCamera(MapPoint, Double, Double, Double, Double)
Initializes a new instance of the Camera class.
Public methodCode exampleCamera(Double, Double, Double, Double, Double, Double)
Initializes a new instance of the Camera class.
Top
Properties
  NameDescription
Public propertyHeading
Gets the heading property which represents the angle from north in an ENU (East, North, Up Ground reference frames). Value ranges from 0 to 360 degrees. To set the heading use the
Public propertyCode exampleLocation
Gets the point in space where the camera is located. To set the point use the Camera.MoveTo Method or establish the location as part of one of the Camera Constructors.
Public propertyPitch
Gets the pitch property which represents the angle of pitch applied to the camera with rotation around Y-axis in an ENU (East, North, Up Ground reference frames). Value ranges from 0 to 180 degrees, where 0 is looking straight down (center of the earth) and 180 looking straight up (towards outer space).
Public propertyRoll
Gets the roll property which represents the angle of roll applied to the camera with rotation around X-axis in an ENU (East, North, Up Ground reference frames). Value ranges from 0 to 360 degrees, where 0 is horizontal.
Public propertyTransformation
Gets the camera's Transformation Matrix.
Top
Methods
  NameDescription
Public methodCode exampleElevate
Returns a new Camera with applied elevation.
Public methodIsEqual
Compares two cameras for equality.
Public methodMoveForward
Returns a new Camera with updated position.
Public methodMoveTo
Returns a new Camera with the a new center position. Location is the point in space where the camera is located. Setting the location can be done using this Method or establish the location as part of one of the Camera Constructors.
Public methodMoveToward
Returns a new Camera centered at calculated location.
Public methodRotateAround
Returns a new Camera with changes centered at specified location.
Public methodRotateTo
Returns a new Camera with applied rotation.
Public methodZoomToward
Returns a new Camera centered at calculated location.
Top
Remarks

A Camera object can literally be thought of as a camera that one would look through to see a viewable extent and perspective of the Earth. Depending on how you hold the camera and how far away from the ground will determine what you can see. These positions of holding the camera represent the various Properties that you can set on the Camera object.

The Camera Class is immutable which means that you can not change its parameters once it is created. There are methods in the Camera class that would give you a new Camera with the adjusted parameters.

Examples

UWP

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 Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using System;
using System.Drawing;

namespace ArcGISRuntime.UWP.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
    {
        private readonly string _elevationServiceUrl = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

        public SceneSymbols()
        {
            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
<UserControl 
    x:Class="ArcGISRuntime.UWP.Samples.SceneSymbols.SceneSymbols"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="using:Esri.ArcGISRuntime"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
    </Grid>
</UserControl>
Examples

Xamarin Forms UWP

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.
ChangeAtmosphereEffectChanges the appearance of the atmosphere 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.
FeatureLayerRenderingModeSceneRender features in a scene statically or dynamically by setting the feature layer rendering mode.
GetElevationAtPointGet the elevation for a given point on a surface in a scene.
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.
SceneLayerSelectionIdentify GeoElements in a scene layer.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
ScenePropertiesExpressionsUpdate the orientation of a graphic using scene property rotation expressions.
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.
ViewshedCameraAnalyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point.
ViewshedLocationPerform a viewshed analysis from a defined vantage point. Viewshed analyses have several configuration options that are demonstrated in this sample.