private async void mapView1_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer.ID == "MyGraphicsLayer") { await DoGeodesicLength(); } }
private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError == null) return; Debug.WriteLine(string.Format("Error while loading layer : {0} - {1}", e.Layer.ID, e.LoadError.Message)); }
// Show error if loading layers fail private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError == null) return; var _x = new MessageDialog( string.Format("Error when loading layer. {0}", e.LoadError.ToString()), "S57 Cell Info Sample").ShowAsync(); }
// Zoom to the image service extent private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer is ArcGISImageServiceLayer) { if (e.Layer.FullExtent != null) await MyMapView.SetViewAsync(e.Layer.FullExtent); } }
// Populate layer legend with north america traffic sublayer names private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer == _trafficLayer) { var legendLayer = _trafficLayer as ILegendSupport; var layerLegendInfo = await legendLayer.GetLegendInfosAsync(); legendTree.ItemsSource = layerLegendInfo.LayerLegendInfos.First().LayerLegendInfos; } }
// Show error if loading layers fail private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError == null) return; MessageBox.Show( string.Format("Error when loading layer. {0}", e.LoadError.ToString()), "Error loading layer"); }
// Zooms to the image layer and starts accepting user points private async void mapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer is ArcGISImageServiceLayer) { if (e.Layer.FullExtent != null) await mapView.SetViewAsync(e.Layer.FullExtent); await AcceptClassPoints(); } }
// Show error if loading layers fail private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError == null) { return; } var _x = new MessageDialog( string.Format("Error when loading layer. {0}", e.LoadError.ToString()), "S57 Cell Info Sample").ShowAsync(); }
// Show error if loading layers fail private void MapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError == null) { return; } MessageBox.Show( string.Format("Error when loading layer. {0}", e.LoadError.ToString()), "Error loading layer"); }
// Zooms to the image layer and starts accepting user points private async void mapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer is ArcGISImageServiceLayer) { if (e.Layer.FullExtent != null) { await mapView.SetViewAsync(e.Layer.FullExtent); } await AcceptClassPoints(); } }
/// <summary> /// Updates login information based on credential. /// </summary> private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null || !(e.Layer is FeatureLayer)) { return; } var layer = (FeatureLayer)e.Layer; var table = (ServiceFeatureTable)layer.FeatureTable; var credential = IdentityManager.Current.FindCredential(table.ServiceUri); LoginInfo.Text = string.Format("Login '{0}' service as: {1}", table.ServiceInfo.Name, ((TokenCredential)credential).UserName); }
private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (_parcelOverlay != null && _parcelOverlay.Graphics.Count == 0) { try { ControlsContainer.Visibility = Visibility.Collapsed; LoadingParcelsContainer.Visibility = Visibility.Visible; QueryTask queryTask = new QueryTask( new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1")); // Get current viewpoints extent from the MapView var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry); var viewpointExtent = currentViewpoint.TargetGeometry.Extent; //Create a geometry to use as the extent within which parcels will be returned var contractRatio = viewpointExtent.Width / 6; var extentGeometry = new Envelope( -83.3188395774275, 42.61428312652851, -83.31295664068958, 42.61670913269855, SpatialReferences.Wgs84); Query query = new Query(extentGeometry); query.ReturnGeometry = true; query.OutSpatialReference = SpatialReferences.WebMercator; var results = await queryTask.ExecuteAsync(query, CancellationToken.None); foreach (Graphic g in results.FeatureSet.Features) { _parcelOverlay.Graphics.Add(g); } ControlsContainer.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show("Error loading parcel data: " + ex.Message, "Sample Error"); } finally { LoadingParcelsContainer.Visibility = Visibility.Collapsed; } } await SelectParcelForOffsetAsync(); }
/// <summary> /// Updates login information based on credential. /// </summary> private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null || !(e.Layer is FeatureLayer)) return; var layer = (FeatureLayer)e.Layer; var table = (ServiceFeatureTable)layer.FeatureTable; if (table.ServiceInfo != null) { AddButton.IsEnabled = true; var credential = IdentityManager.Current.FindCredential(table.ServiceUri); if (credential is TokenCredential) LoginInfo.Text = string.Format("Login '{0}' service as: {1}", table.ServiceInfo.Name, ((TokenCredential)credential).UserName); } }
private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { var _x = new MessageDialog(e.LoadError.Message, "Layer Error").ShowAsync(); return; } if (e.Layer == _usaLayer) { _usaLayer.VisibleLayers = new ObservableCollection<int>() { 0, 1, 2, 3 }; visibleLayers.ItemsSource = _usaLayer.ServiceInfo.Layers .Select((info, idx) => new Tuple<string, int, bool>(info.Name, idx, info.DefaultVisibility)); } }
private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { var _x = new MessageDialog(e.LoadError.Message, "Layer Error").ShowAsync(); return; } if (e.Layer == _usaLayer) { _usaLayer.VisibleLayers = new ObservableCollection <int>() { 0, 1, 2, 3 }; visibleLayers.ItemsSource = _usaLayer.ServiceInfo.Layers .Select((info, idx) => new Tuple <string, int, bool>(info.Name, idx, info.DefaultVisibility)); } }
private void MyMapView_OnLayerLoaded(object sender, LayerLoadedEventArgs e) { // Zoom to water network var layer = e.Layer as ArcGISDynamicMapServiceLayer; if (layer != null) { var extent = layer.ServiceInfo.InitialExtent ?? layer.ServiceInfo.InitialExtent; if (extent != null) { // If extent is not in the same spatial reference than map, reproject it if (!SpatialReference.Equals(extent.SpatialReference, MyMapView.SpatialReference)) extent = GeometryEngine.Project(extent, MyMapView.SpatialReference) as Envelope; if (extent != null) { extent = extent.Expand(0.5); MyMapView.SetView(extent); } } } }
private async void mapView1_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer.ID == "ParcelsGraphicsLayer") { if (parcelGraphicsLayer != null && parcelGraphicsLayer.Graphics.Count == 0) { QueryTask queryTask = new QueryTask(new Uri("http://services.arcgis.com/8DAUcrpQcpyLMznu/arcgis/rest/services/Manzanas/FeatureServer/0")); /* * //Create a geometry to use as the extent within which parcels will be returned * var contractRatio = mapView1.Extent.Width;// / 6; * var extentGeometry = new Envelope(mapView1.Extent.GetCenter().X - contractRatio, * mapView1.Extent.GetCenter().Y - contractRatio, * mapView1.Extent.GetCenter().X + contractRatio, * mapView1.Extent.GetCenter().Y + contractRatio, * mapView1.SpatialReference); * Query query = new Query(extentGeometry); * query.ReturnGeometry = true; * query.OutSpatialReference = mapView1.SpatialReference; * * * var results = await queryTask.ExecuteAsync(query, CancellationToken.None); * foreach (Graphic g in results.FeatureSet.Features) * { * parcelGraphicsLayer.Graphics.Add(g); * }*/ var query = new Query(mapView1.Extent) { ReturnGeometry = true, OutSpatialReference = mapView1.SpatialReference, Where = "1=1" }; try { var result = await queryTask.ExecuteAsync(query); parcelGraphicsLayer.Graphics.AddRange(result.FeatureSet.Features.OfType <Graphic>()); } catch { } } await DoIntersection(); } }
private void mapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { var _ = new MessageDialog(e.LoadError.Message, "Layer Error").ShowAsync(); return; } if (e.Layer == _usaLayer) { if (_usaLayer.DynamicLayerInfos == null) _usaLayer.DynamicLayerInfos = _usaLayer.CreateDynamicLayerInfosFromLayerInfos(); _usaLayer.VisibleLayers = new ObservableCollection<int>(_usaLayer.DynamicLayerInfos .Where(info => info.DefaultVisibility == true) .Select((info, idx) => idx)); visibleLayers.ItemsSource = _usaLayer.DynamicLayerInfos .Select((info, idx) => new Tuple<string, int, bool>(info.Name, idx, info.DefaultVisibility)); } }
private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (_parcelOverlay != null && _parcelOverlay.Graphics.Count == 0) { QueryTask queryTask = new QueryTask( new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1")); //Create a geometry to use as the extent within which parcels will be returned var contractRatio = MyMapView.Extent.Width / 6; var extentGeometry = new Envelope( -83.3188395774275, 42.61428312652851, -83.31295664068958, 42.61670913269855, SpatialReferences.Wgs84); Query query = new Query(extentGeometry); query.ReturnGeometry = true; query.OutSpatialReference = SpatialReferences.WebMercator; try { var results = await queryTask.ExecuteAsync(query, CancellationToken.None); foreach (Graphic g in results.FeatureSet.Features) { _parcelOverlay.Graphics.Add(g); } LoadingParcelsIndicator.IsActive = false; LoadingParcelsContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed; ControlsContainer.Visibility = Visibility.Visible; } catch (Exception ex) { var _x = new MessageDialog(ex.Message).ShowAsync(); } } await SelectParcelForOffsetAsync(); }
private void FocusMapViewLayerLoaded(object sender, LayerLoadedEventArgs e) { if (null == e.LoadError) { return; } if (string.IsNullOrEmpty(e.Layer.ID)) { return; } if (0 == string.CompareOrdinal(@"basemap", e.Layer.ID.ToLowerInvariant())) { // Loading the online basemap failed // Replace the map FocusMapView.Map = new Map(); // Try to load the local tile package LoadLocalTiledLayerAsync(); } }
private void mapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { MessageBox.Show(e.LoadError.Message, "Layer Error"); return; } if (e.Layer == _usaLayer) { if (_usaLayer.DynamicLayerInfos == null) { _usaLayer.DynamicLayerInfos = _usaLayer.CreateDynamicLayerInfosFromLayerInfos(); } _usaLayer.VisibleLayers = new ObservableCollection <int>(_usaLayer.DynamicLayerInfos .Where(info => info.DefaultVisibility == true) .Select((info, idx) => idx)); visibleLayers.ItemsSource = _usaLayer.DynamicLayerInfos .Select((info, idx) => new Tuple <string, int, bool>(info.Name, idx, info.DefaultVisibility)); } }
private void MyMapView_OnLayerLoaded(object sender, LayerLoadedEventArgs e) { // Zoom to water network var layer = e.Layer as ArcGISDynamicMapServiceLayer; if (layer != null) { var extent = layer.ServiceInfo.InitialExtent ?? layer.ServiceInfo.InitialExtent; if (extent != null) { // If extent is not in the same spatial reference than map, reproject it if (!SpatialReference.Equals(extent.SpatialReference, MyMapView.SpatialReference)) { extent = GeometryEngine.Project(extent, MyMapView.SpatialReference) as Envelope; } if (extent != null) { extent = extent.Expand(0.5); MyMapView.SetView(extent); } } } }
private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (_parcelOverlay != null && _parcelOverlay.Graphics.Count == 0) { try { ControlsContainer.Visibility = Visibility.Collapsed; LoadingParcelsContainer.Visibility = Visibility.Visible; QueryTask queryTask = new QueryTask( new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1")); // Get current viewpoints extent from the MapView var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry); var viewpointExtent = currentViewpoint.TargetGeometry.Extent; //Create a geometry to use as the extent within which parcels will be returned var contractRatio = viewpointExtent.Width / 6; var extentGeometry = new Envelope( -83.3188395774275, 42.61428312652851, -83.31295664068958, 42.61670913269855, SpatialReferences.Wgs84); Query query = new Query(extentGeometry); query.ReturnGeometry = true; query.OutSpatialReference = SpatialReferences.WebMercator; var results = await queryTask.ExecuteAsync(query, CancellationToken.None); foreach (Graphic g in results.FeatureSet.Features) { _parcelOverlay.Graphics.Add(g); } ControlsContainer.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show("Error loading parcel data: " + ex.Message, "Sample Error"); } finally { LoadingParcelsContainer.Visibility = Visibility.Collapsed; } } await SelectParcelForOffsetAsync(); }
private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer.ID == "ParcelsGraphicsLayer") { if (parcelGraphicsLayer != null && parcelGraphicsLayer.Graphics.Count == 0) { QueryTask queryTask = new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1")); //Create a geometry to use as the extent within which parcels will be returned var contractRatio = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry).TargetGeometry.Extent.Width / 6; var extentGeometry = new Envelope(-83.3188395774275, 42.61428312652851, -83.31295664068958, 42.61670913269855, SpatialReferences.Wgs84); Query query = new Query(extentGeometry); query.ReturnGeometry = true; query.OutSpatialReference = MyMapView.SpatialReference; try { var results = await queryTask.ExecuteAsync(query, CancellationToken.None); foreach (Graphic g in results.FeatureSet.Features) { parcelGraphicsLayer.Graphics.Add(g); } LoadingParcelsIndicator.IsActive = false; LoadingParcelsContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed; ControlsContainer.Visibility = Visibility.Visible; } catch (Exception ex) { var dlg = new Windows.UI.Popups.MessageDialog(ex.Message); var _x = dlg.ShowAsync(); } } await SelectParcelForOffset(); } }
public async void OverviewMap_LayerLoaded(object sender, LayerLoadedEventArgs e) { await AddSingleGraphicAsync(); }
private void overviewMap_LayerLoaded_1(object sender, LayerLoadedEventArgs e) { }
/// <summary> /// The event that is triggered when the MapView has a new layer that is loaded. /// </summary> /// <param name="sender">MapView object</param> /// <param name="e">Layer Loaded event args</param> private void BaseMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { Debug.WriteLine(string.Format("(MainWindows{BaseMapView_LayerLoaded}) Error while loading layer : {0} - {1}", e.Layer.ID, e.LoadError.Message)); return; } if (mainViewModel.IdToZoomOn != "" && e.Layer.ID == mainViewModel.IdToZoomOn) { mainViewModel.IdToZoomOn = ""; centerPoint = ((KmlLayer)e.Layer).RootFeature.Viewpoint; ((MapView)sender).SetViewAsync(centerPoint, TimeSpan.FromSeconds(kmzZoomDelaySec)); } AddLayerToTree(e.Layer); }
private async void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.Layer.ID == "ParcelsGraphicsLayer") { if (parcelGraphicsLayer != null && parcelGraphicsLayer.Graphics.Count == 0) { QueryTask queryTask = new QueryTask(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsParcelCharacteristics/MapServer/1")); //Create a geometry to use as the extent within which parcels will be returned var contractRatio = MyMapView.Extent.Width / 6; var extentGeometry = new Envelope(MyMapView.Extent.GetCenter().X - contractRatio, MyMapView.Extent.GetCenter().Y - contractRatio, MyMapView.Extent.GetCenter().X + contractRatio, MyMapView.Extent.GetCenter().Y + contractRatio, MyMapView.SpatialReference); Query query = new Query(extentGeometry); query.ReturnGeometry = true; query.OutSpatialReference = MyMapView.SpatialReference; var results = await queryTask.ExecuteAsync(query, CancellationToken.None); foreach (Graphic g in results.FeatureSet.Features) { parcelGraphicsLayer.Graphics.Add(g); } } await DoIntersection(); } }