Example #1
0
        protected override Collection <MenuItem> GetMapContextMenuItemsCore(GetMapContextMenuParameters parameters)
        {
            Collection <MenuItem> menuItems = new Collection <MenuItem>();

            if (GisEditor.SelectionManager.GetSelectedFeatures().Count > 0 && menuItems.Count(m => m.Header != null && m.Header.ToString() == "Selected features") == 0)
            {
                MenuItem highlightedFeatureMenuItem = HighlightedFeaturesHelper.GetHighlightedFeaturesMenuitem();
                menuItems.Add(highlightedFeatureMenuItem);
            }

            MenuItem exportPictureMenuItem = new MenuItem();

            exportPictureMenuItem.Header = "Export Map to Image";
            exportPictureMenuItem.Icon   = new Image()
            {
                Width = 16, Height = 16, Source = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/jpeg2000.png", UriKind.RelativeOrAbsolute))
            };

            MenuItem exportToImageMenuItem = new MenuItem();

            exportToImageMenuItem.Header = "Export Map to Image";
            exportToImageMenuItem.Click += exportToImageMenuItem_Click;
            exportPictureMenuItem.Items.Add(exportToImageMenuItem);


            MenuItem exportToClipboardMenuItem = new MenuItem();

            exportToClipboardMenuItem.Header = "Export Map Image to Clipboard";
            exportToClipboardMenuItem.Click += exportToClipboardMenuItem_Click;
            exportPictureMenuItem.Items.Add(exportToClipboardMenuItem);

            menuItems.Add(exportPictureMenuItem);

            return(menuItems);
        }
        private void CopyToExistingLayerRibbonMenuItem_Click(object sender, RoutedEventArgs e)
        {
            RibbonMenuItem ribbonMenuItem = sender as RibbonMenuItem;

            if (ribbonMenuItem != null)
            {
                InMemoryFeatureLayer inMemoryFeatureLayer = ribbonMenuItem.Tag as InMemoryFeatureLayer;
                if (inMemoryFeatureLayer != null)
                {
                    Collection <FeatureLayer> selectedFeatureLayers = new Collection <FeatureLayer>();
                    foreach (FeatureLayer layer in GisEditor.ActiveMap.GetFeatureLayers())
                    {
                        Collection <Feature> features = GisEditor.SelectionManager.GetSelectedFeatures(layer);
                        if (features.Count > 0)
                        {
                            selectedFeatureLayers.Add(layer);
                        }
                    }

                    HighlightedFeaturesHelper.CopyToExistingLayer(selectedFeatureLayers, inMemoryFeatureLayer);
                }
            }
        }