private void addGeoRssLayer(UrlChosenEventArgs e) { if (e.Url == null) { return; } Uri targetUri = null; if (!Uri.TryCreate(e.Url, UriKind.Absolute, out targetUri)) { return; } if (View.Instance != null) { CustomGeoRssLayer geoRssLayer = new CustomGeoRssLayer() { Source = targetUri, ID = Guid.NewGuid().ToString("N"), }; Core.LayerExtensions.SetDisplayUrl(geoRssLayer, e.Url); geoRssLayer.SetValue(ESRI.ArcGIS.Client.Extensibility.MapApplication.LayerNameProperty, targetUri.Host); geoRssLayer.MapSpatialReference = View.Instance.Map.SpatialReference; geoRssLayer.UpdateCompleted += new EventHandler(applyAutomaticClustering); View.Instance.Map.Layers.Add(geoRssLayer); } MapApplication.Current.HideWindow(enterUrlDialog); OnUrlChosen(e); }
void applyAutomaticClustering(object sender, EventArgs e) { CustomGeoRssLayer gLayer = sender as CustomGeoRssLayer; if (gLayer != null && gLayer.Graphics.Count >= Constants.AutoClusterFeaturesThresholdLimit) { if (ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetGeometryType(gLayer) == GeometryType.Point && gLayer.Clusterer == null) { gLayer.Clusterer = new FlareClusterer(); } } if (gLayer != null) { gLayer.UpdateCompleted -= applyAutomaticClustering; } }
private bool IsLayerInitialized(Layer layer) { CustomGeoRssLayer geoRssLayer = layer as CustomGeoRssLayer; if (geoRssLayer != null) // GeoRss layers use graphics layer member composition - hence we need a seperate init property { return(geoRssLayer.IsInitComplete); } GraphicsLayer gLayer = layer as GraphicsLayer; if (gLayer != null) { return(gLayer.IsInitialized && gLayer.Graphics != null); } else { return(layer.IsInitialized); } }