Camera Class |
Namespace: Esri.ArcGISRuntime.Mapping
public class Camera
The Camera type exposes the following members.
Name | Description | |
---|---|---|
![]() | Camera(TransformationMatrix) |
Initializes a new instance of the Camera class using a transformation matrix.
|
![]() ![]() | Camera(MapPoint, Double, Double, Double) |
Initializes a new instance of the Camera class.
|
![]() ![]() | Camera(MapPoint, Double, Double, Double, Double) |
Initializes a new instance of the Camera class.
|
![]() ![]() | Camera(Double, Double, Double, Double, Double, Double) |
Initializes a new instance of the Camera class.
|
Name | Description | |
---|---|---|
![]() | Heading |
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
|
![]() ![]() | Location |
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.
|
![]() | Pitch |
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).
|
![]() | Roll |
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.
|
![]() | Transformation |
Gets the camera's Transformation Matrix.
|
Name | Description | |
---|---|---|
![]() ![]() | Elevate |
Returns a new Camera with applied elevation.
|
![]() | IsEqual |
Compares two cameras for equality.
|
![]() | MoveForward |
Returns a new Camera with updated position.
|
![]() | MoveTo |
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.
|
![]() | MoveToward |
Returns a new Camera centered at calculated location.
|
![]() | RotateAround |
Returns a new Camera with changes centered at specified location.
|
![]() | RotateTo |
Returns a new Camera with applied rotation.
|
![]() | ZoomToward |
Returns a new Camera centered at calculated location.
|
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.
Android
Example Name: SceneLayerUrl
Display an ArcGIS scene layer from a URL.
// Copyright 2017 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.UI.Controls; using System; using Esri.ArcGISRuntime.Geometry; namespace ArcGISRuntime.Samples.SceneLayerUrl { [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)] [ArcGISRuntime.Samples.Shared.Attributes.Sample( name: "Scene layer (URL)", category: "Layers", description: "Display an ArcGIS scene layer from a URL.", instructions: "Pan and zoom to explore the scene.", tags: new[] { "3D", "Portland", "URL", "buildings", "model", "scene", "service" })] public class SceneLayerUrl : Activity { // Hold a reference to the scene view. private SceneView _mySceneView; // URL for a service to use as an elevation source. private readonly Uri _elevationSourceUrl = new Uri( "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"); // URL for the scene layer. private readonly Uri _serviceUri = new Uri( "https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Portland/SceneServer"); protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Title = "ArcGIS scene layer (URL)"; CreateLayout(); Initialize(); } private async void Initialize() { // Create new Scene. Scene myScene = new Scene {Basemap = Basemap.CreateImagery()}; // Create and add an elevation source for the Scene. ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(_elevationSourceUrl); myScene.BaseSurface.ElevationSources.Add(elevationSrc); // Create new scene layer from the URL. ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_serviceUri); // Add created layer to the operational layers collection. myScene.OperationalLayers.Add(sceneLayer); try { // Load the layer. await sceneLayer.LoadAsync(); // Get the center of the scene layer. MapPoint center = (MapPoint)GeometryEngine.Project(sceneLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84); // Create a camera with coordinates showing layer data. Camera camera = new Camera(center.Y, center.X, 225, 220, 80, 0); // Assign the Scene to the SceneView. _mySceneView.Scene = myScene; // Set view point of scene view using camera. await _mySceneView.SetViewpointCameraAsync(camera); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } } private void CreateLayout() { // Create a new vertical layout for the app. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Add the scene view to the layout. _mySceneView = new SceneView(this); layout.AddView(_mySceneView); // Show the layout in the app. SetContentView(layout); } } }
Xamarin Forms Android
Example Name: ScenePropertiesExpressions
Update the orientation of a graphic using expressions based on its attributes.
// 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 Xamarin.Forms; using Color = System.Drawing.Color; namespace ArcGISRuntimeXamarin.Samples.ScenePropertiesExpressions { [ArcGISRuntime.Samples.Shared.Attributes.Sample( name: "Scene properties expressions", category: "GraphicsOverlay", description: "Update the orientation of a graphic using expressions based on its attributes.", instructions: "Adjust the heading and pitch sliders to rotate the cone.", tags: new[] { "3D", "expression", "graphics", "heading", "pitch", "rotation", "scene", "symbology" })] public partial class ScenePropertiesExpressions : ContentPage { public ScenePropertiesExpressions() { InitializeComponent(); Initialize(); } private void Initialize() { // Set up the scene with an imagery basemap. MySceneView.Scene = new Scene(Basemap.CreateImagery()); // Set the initial viewpoint for the scene. MapPoint point = new MapPoint(83.9, 28.4, 1000, SpatialReferences.Wgs84); Camera initialCamera = new Camera(point, 1000, 0, 50, 0); MySceneView.SetViewpointCamera(initialCamera); // Create a graphics overlay. GraphicsOverlay overlay = new GraphicsOverlay(); overlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative; MySceneView.GraphicsOverlays.Add(overlay); // Add a renderer using rotation expressions. SimpleRenderer renderer = new SimpleRenderer(); renderer.SceneProperties.HeadingExpression = "[HEADING]"; renderer.SceneProperties.PitchExpression = "[PITCH]"; // Apply the renderer to the graphics overlay. overlay.Renderer = renderer; // Create a red cone graphic. SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.CreateCone(Color.Red, 100, 100); coneSymbol.Pitch = -90; MapPoint conePoint = new MapPoint(83.9, 28.41, 200, SpatialReferences.Wgs84); Graphic cone = new Graphic(conePoint, coneSymbol); // Add the cone graphic to the overlay. overlay.Graphics.Add(cone); // Listen for changes in slider values and update graphic properties. HeadingSlider.ValueChanged += (sender, e) => { cone.Attributes["HEADING"] = HeadingSlider.Value; }; PitchSlider.ValueChanged += (sender, e) => { cone.Attributes["PITCH"] = PitchSlider.Value; }; } } }
<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="ArcGISRuntimeXamarin.Samples.ScenePropertiesExpressions.ScenePropertiesExpressions" 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" xmlns:resources="clr-namespace:Forms.Resources;assembly=ArcGISRuntime"> <RelativeLayout> <esriUI:SceneView x:Name="MySceneView" Style="{StaticResource MapWithFormStyle}" ViewInsets="0" /> <resources:ResponsiveFormContainer x:Name="FormContainer"> <StackLayout> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="200" /> </Grid.ColumnDefinitions> <Label Grid.Column="0" Style="{StaticResource LabelStyle}" Text="Heading:" /> <Slider x:Name="HeadingSlider" Grid.Column="1" Maximum="360" MaximumTrackColor="CadetBlue" Minimum="0" MinimumTrackColor="CadetBlue" /> </Grid> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="200" /> </Grid.ColumnDefinitions> <Label Grid.Column="0" Style="{StaticResource LabelStyle}" Text="Pitch:" /> <Slider x:Name="PitchSlider" Grid.Column="1" Maximum="90" MaximumTrackColor="CadetBlue" Minimum="-90" MinimumTrackColor="CadetBlue" /> </Grid> </StackLayout> </resources:ResponsiveFormContainer> </RelativeLayout> </ContentPage>
Hyperlink to Example | Description |
---|---|
AddAnIntegratedMeshLayer | View an integrated mesh layer from a scene service. |
AnimateImageOverlay | Animate a series of images with an image overlay. |
ChangeAtmosphereEffect | Changes the appearance of the atmosphere in a scene. |
CreateTerrainSurfaceRaster | Set the terrain surface with elevation described by a raster file. |
CreateTerrainSurfaceTilePackage | Set the terrain surface with elevation described by a local tile package. |
DisplayScene | Display a scene with a terrain surface and some imagery. |
DistanceMeasurement | Measure distances between two points in 3D. |
EditKmlGroundOverlay | Edit the values of a KML ground overlay. |
FeatureLayerRenderingModeScene | Render features in a scene statically or dynamically by setting the feature layer rendering mode. |
GetElevationAtPoint | Get the elevation for a given point on a surface in a scene. |
LineOfSightLocation | Perform a line of sight analysis between two points in real time. |
ListKmlContents | List the contents of a KML file. |
SceneLayerSelection | Identify features in a scene to select. |
SceneLayerUrl | Display an ArcGIS scene layer from a URL. |
ScenePropertiesExpressions | Update the orientation of a graphic using expressions based on its attributes. |
SceneSymbols | Show various kinds of 3D symbols in a scene. |
SurfacePlacements | Position graphics relative to a surface using different surface placement modes. |
TerrainExaggeration | Vertically exaggerate terrain in a scene. |
ViewshedCamera | Analyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point. |
ViewshedLocation | Perform a viewshed analysis from a defined vantage point. |