コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 private void AddLayerToMap(VectorLayer layer)
 {
     _syncContext.Post(o => _layerService.AddDatasource(layer), layer);
 }
コード例 #6
0
ファイル: OutputManager.cs プロジェクト: zylimit/MapWindow5
 public bool AddToMap(ILayerSource source)
 {
     return(_layerService.AddDatasource(source));
 }