/// <summary> /// Adds selected server to the map. /// </summary> private void AddProvider() { var server = SelectedServer; if (server == null) { return; } var layers = View.SelectedLayers.ToList(); if (layers.Count == 0) { MessageService.Current.Info("No layers are selected"); } var provider = Model.Capabilities.CreateWmsLayer(layers, server.Url, _context.Map.Projection); if (provider == null) { return; } provider.Name = provider.Layers; _layerService.AddDatasource(provider); AdjustLayerPosition(); _context.Legend.Redraw(LegendRedraw.LegendAndMap); }
private void AddLayerToMapAsync(IDatabaseLayerItem item) { item.ShowLoadingIndicator(); Task <IDatasource> .Factory.StartNew(() => { var timer = new Stopwatch(); timer.Start(); var ds = GeoSource.OpenFromIdentity(item.Identity) as IVectorLayer; if (ds != null) { var data = ds.Data; } return(ds); }).ContinueWith(t => { if (t.Result != null) { if (_layerService.AddDatasource(t.Result)) { int handle = _layerService.LastLayerHandle; _context.Map.ZoomToLayer(handle); } } item.HideLoadingIndicator(); }, TaskScheduler.FromCurrentSynchronizationContext()); }
public void CreateLayer() { var model = new CreateLayerModel(); if (_context.Container.Run <CreateLayerPresenter, CreateLayerModel>(model)) { var fs = new FeatureSet(model.GeometryType, model.ZValueType); fs.Projection.CopyFrom(_context.Map.Projection); if (!model.MemoryLayer) { fs.SaveAsEx(model.Filename, false); } fs.InteractiveEditing = true; _layerService.AddDatasource(fs, model.LayerName); } }
private static bool AddTempDataSource( IAppContext context, ILayerService layerService, string filename, OutputLayerInfo outputInfo) { var fs = FeatureSet.OpenAsInMemoryDatasource(filename); if (fs != null) { // output info name if (layerService.AddDatasource(fs)) { var layer = context.Layers.ItemByHandle(layerService.LastLayerHandle); layer.Name = outputInfo.Name; GeoSource.Remove(filename); return(true); } } return(false); }
private void AddLayerToMap(VectorLayer layer) { _syncContext.Post(o => _layerService.AddDatasource(layer), layer); }
public bool AddToMap(ILayerSource source) { return(_layerService.AddDatasource(source)); }