private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Wait until all layers are initialized await MySceneView.LayersLoadedAsync(); // Set viewpoint and navigate to it var viewpoint = new Camera( new MapPoint( -122.406025330049, 37.7890934457207, 209.54040953517, SpatialReferences.Wgs84), 338.125939203603, 72.7452621261101); await MySceneView.SetViewAsync(viewpoint, new TimeSpan(0, 0, 3), false); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
private async void MySceneView_SpatialReferenceChanged(object sender, EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; List <string> fileNames = new List <string>(); fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n18_w156_3arc_v2.dt1"); fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w155_3arc_v2.dt1"); fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w156_3arc_v2.dt1"); fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w157_3arc_v2.dt1"); fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n20_w156_3arc_v2.dt1"); foreach (var item in fileNames) { if (!File.Exists(item)) { MessageBox.Show("Sample data not found"); return; } } _fileElevationSource = new FileElevationSource(fileNames); MySceneView.Scene.Surface.Add(_fileElevationSource); MySceneView.SetViewAsync(new Camera(new MapPoint(-156.277, 18.356, 58877.626), 20.091, 70.160), new TimeSpan(0, 0, 5)); await MySceneView.LayersLoadedAsync(); _isSceneReady = true; MySceneView.MouseMove += MySceneView_MouseMove; }
private void MySceneView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e) { if (e.LoadError == null && e.Layer.ID == "AGOLayer") { MySceneView.SetViewAsync(new Camera(new MapPoint(-106.57, 39.01, 14614.24), 281.66, 74.47), new TimeSpan(0, 0, 3), true); AddGraphics(); } }
public GraphicsOverlay3d() { InitializeComponent(); MySceneView.SetViewAsync(new Viewpoint(new Envelope(-150, -40, 60, 64, SpatialReferences.Wgs84))); _graphicsOverlay = MySceneView.GraphicsOverlays["MyGraphicsOverlay"]; MySceneView.SpatialReferenceChanged += MySceneView_SpatialReferenceChanged; }
public async void Initialize() { await MySceneView.SetViewAsync(new Camera(52.4970586495449, 13.3387481843594, 739.703398887999, 320.56288091543763, 54.529512824712647)); // Get the current time in Berlin utcBerlin = DateTime.UtcNow.AddHours(2); AnimateSunTimeLabel.Content = utcBerlin; // Set the AmbientLight and IsShadowsEnabled and then set the Sun Time MySceneView.AmbientLight = Colors.Gray; MySceneView.IsShadowsEnabled = true; MySceneView.SetSunTime(utcBerlin); }
private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set first one to starting point MySceneView.SetView(_animationViewpoints[0]); await MySceneView.LayersLoadedAsync(); // Set navigation in the order we want to animate the camera await MySceneView.SetViewAsync(_animationViewpoints[1], 0.2, true); await MySceneView.SetViewAsync(_animationViewpoints[2], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[3], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[4], 0.4, false); await MySceneView.SetViewAsync(_animationViewpoints[5], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[6], 0.3, false); await MySceneView.SetViewAsync(_animationViewpoints[7], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[8], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[9], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[10], 0.3, false); await MySceneView.SetViewAsync(_animationViewpoints[11], 0.3, false); await MySceneView.SetViewAsync(_animationViewpoints[12], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[13], 0.2, false); await MySceneView.SetViewAsync(_animationViewpoints[14], 0.2, false); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
private async void MySceneView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e) { if (e.LoadError == null && e.Layer.ID == "AGOLayer") { var camera = new Esri.ArcGISRuntime.Controls.Camera(new MapPoint(2.2950, 48.8738, 3000000), 0, 0); MySceneView.SetViewAsync(camera); // Find the overlay element from the MapView using its name var triompheTip = this.MySceneView.FindName("triompheOverlay") as FrameworkElement; // If the overlay element is found, set its position and make it visible if (triompheTip != null) { var overlayLocation = new MapPoint(2.2950, 48.8738, SpatialReferences.Wgs84); MapView.SetViewOverlayAnchor(triompheTip, overlayLocation); triompheTip.Visibility = Visibility.Visible; } } }
private async void Initialize() { try { CreateExtrusionInfos(); // Set initial viewpoint var viewpoint = new ViewpointCenter(new MapPoint(-96, 39), 15000000); await MySceneView.SetViewAsync(viewpoint); // Query states with statistical attributes var queryTask = new QueryTask( new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5")); Query query = new Query("1=1"); query.OutFields.Add("STATE_NAME"); query.OutFields.Add("AGE_5_17"); query.OutFields.Add("AGE_18_21"); query.OutFields.Add("AGE_22_29"); query.OutFields.Add("AGE_30_39"); query.OutFields.Add("AGE_40_49"); query.OutFields.Add("AGE_50_64"); query.OutFields.Add("AGE_65_UP"); var result = await queryTask.ExecuteAsync(query); var states = new GraphicCollection(); foreach (var state in result.FeatureSet.Features) { states.Add(new Graphic(state.Geometry, state.Attributes)); } // Make sure that all layers are loaded await MySceneView.LayersLoadedAsync(); // Set graphics to the overlay var statesOverlay = MySceneView.GraphicsOverlays["statesOverlay"]; statesOverlay.GraphicsSource = states; } catch (Exception ex) { MessageBox.Show(ex.Message, "Graphics Extrusion Sample"); } }
private async void FollowGraphic(MapPoint point, double heading, double pitch, double distance) { try { // Create a new Camera with the specified point and distance values var cam = new Camera(new MapPoint(point.X, point.Y, point.Z + distance), 0, 0); // Set the camera to RotateAround the specified point with the user-specified values. // RotateAround returns a new Camera with changes centered at the specified location. cam = cam.RotateAround(point, heading, pitch); // Set the SceneView to center the view on the camera's perspective await MySceneView.SetViewAsync(cam, TimeSpan.FromMilliseconds(1), false); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sample Error"); } }
private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set camera and navigate to it var viewpoint = new Camera( location: new MapPoint(x: -99, y: 34, z: 3500000), heading: 0, pitch: 5); await MySceneView.SetViewAsync(camera : viewpoint, velocity : 10, liftOff : true); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
private async Task AddModelMarkerSymbol() { // Instantiate a new ModelMarkerSymbol ModelMarkerSymbol modelMarkerSymbol = new ModelMarkerSymbol(); // Set the SourceUri property modelMarkerSymbol.SourceUri = Path.Combine(AssemblyDirectory, @"Samples\Scene\PT-Boat-Model\PTBoat.obj"); // Increase the scale to achieve the desired visual size modelMarkerSymbol.Scale = 50; // Create a new MapPoint for the location MapPoint mapPoint = new MapPoint(-155, 19, -100); // Create a new Graphic to display the model symbol Graphic graphic = new Graphic(mapPoint); // Set the Graphic Symbol property graphic.Symbol = modelMarkerSymbol; // Create a GraphicsOverlay to contain the symbolized Graphic GraphicsOverlay graphicsoverlay = new GraphicsOverlay() { RenderingMode = GraphicsRenderingMode.Dynamic, SceneProperties = new LayerSceneProperties() { SurfacePlacement = SurfacePlacement.Relative } }; // Add the Graphic to the GraphicsOverlay graphicsoverlay.Graphics.Add(graphic); // Add the GraphicsOverlay to the MapView's GraphicsOverlays collection MySceneView.GraphicsOverlays.Add(graphicsoverlay); // Set the Viewpoint await MySceneView.SetViewAsync(new Camera(mapPoint.Y - 0.5, mapPoint.X + 0.5, 25000, 315, 70)); }
private async void CreateFeatureLayers() { try { var geodatabase = await Geodatabase.OpenAsync(GeodatabasePath); Envelope extent = null; foreach (var table in geodatabase.FeatureTables) { var featureLayer = new FeatureLayer() { ID = table.Name, DisplayName = table.Name, FeatureTable = table }; if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent)) { if (Geometry.IsNullOrEmpty(extent)) { extent = table.ServiceInfo.Extent; } else { extent = extent.Union(table.ServiceInfo.Extent); } } MySceneView.Scene.Layers.Add(featureLayer); } await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); } catch (Exception ex) { MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples"); } }
private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set camera and navigate to it var viewpoint = new Camera( new MapPoint( -122.41213238640989, 37.78073901800655, 80.497554714791477), 53.719780233659428, 73.16171159612496); await MySceneView.SetViewAsync(viewpoint, 1, true); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
public async void Initialize() { await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); }
public async void Initialize() { await MySceneView.SetViewAsync(new Camera(new MapPoint(-116.799471, 34.039555, 12819.401), 0, 40.49)); }