Example #1
0
        private void SetDatabaseLayerContextMenu(IDatabaseLayerItem layer)
        {
            mnuAddToMap.Text = layer.AddedToMap ? "Remove from the Map" : "Add to the Map";

            contextMenuStripEx1.Items.AddRange(new ToolStripItem[]
                                               { mnuAddToMap, new ToolStripSeparator(), mnuRemoveLayer });
        }
Example #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());
        }
        private static string GetDescription(IDatabaseLayerItem item)
        {
            if (item == null)
            {
                return(string.Empty);
            }

            var s = "Geometry type: " + item.GeometryType.EnumToString() + Environment.NewLine;

            s += "Number of features: " + item.NumFeatures + Environment.NewLine;
            s += "Projection: " + item.Projection.ExportToProj4();
            return(s);
        }