Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        protected override Collection <MenuItem> GetMapContextMenuItemsCore(GetMapContextMenuParameters parameters)
        {
            cursorWorldPoint = parameters.WorldCoordinates;
            Collection <MenuItem>           menuItems   = new Collection <MenuItem>();
            GisEditorEditInteractiveOverlay editOverlay = GisEditor.ActiveMap.FeatureLayerEditOverlay;

            if (editOverlay != null && !editOverlay.IsEmpty)
            {
                var intersectingFeatures = editOverlay.GetEditingFeaturesInterseting();
                if (intersectingFeatures.Count > 0)
                {
                    selectedFeature = intersectingFeatures.OrderBy(f => f.GetShape().GetDistanceTo(editOverlay.CurrentWorldCoordinate, GeographyUnit.Meter, DistanceUnit.Meter)).FirstOrDefault();

                    foreach (var item in GetEditMenuItems(selectedFeature, editOverlay.CanReshape, intersectingFeatures.Count))
                    {
                        menuItems.Add(item);
                    }
                }
                else if (clickCopy)
                {
                    InitializeCopyPasteMenuItems();
                    menuItems.Add(copyFeatureMenuItem);
                    menuItems.Add(pasteFeatureMenuItem);
                }
                else
                {
                    selectedFeature = null;
                }
            }
            else
            {
                selectedFeature = null;
            }
            return(menuItems);
        }
Ejemplo n.º 3
0
        protected override Collection <MenuItem> GetMapContextMenuItemsCore(GetMapContextMenuParameters parameters)
        {
            Collection <MenuItem> menuitems = base.GetMapContextMenuItemsCore(parameters);

            MenuItem zoomToPreciseScaleItem = new MenuItem();

            zoomToPreciseScaleItem.Header = GisEditor.LanguageManager.GetStringResource("ScalePluginZoomToScaleText");
            zoomToPreciseScaleItem.Icon   = new Image {
                Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/zoomto.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            zoomToPreciseScaleItem.Click += ZoomToPreciseScaleItem_Click;
            zoomToPreciseScaleItem.Tag    = parameters.WorldCoordinates;
            menuitems.Add(zoomToPreciseScaleItem);

            return(menuitems);
        }
Ejemplo n.º 4
0
        protected override Collection <MenuItem> GetMapContextMenuItemsCore(GetMapContextMenuParameters parameters)
        {
            Collection <MenuItem> menuItems = base.GetMapContextMenuItemsCore(parameters);

            RectangleShape       rectangle = parameters.GetClickWorldArea(10);
            InMemoryFeatureLayer layer     = viewModel.CurrentAnnotationOverlay.TrackShapeLayer;

            layer.Open();
            feature = layer.QueryTools.GetFeaturesIntersecting(rectangle, ReturningColumnsType.AllColumns).FirstOrDefault();

            if (feature != null && feature.GetShape() is PointShape)
            {
                MenuItem addFileLinkItem = new MenuItem();
                addFileLinkItem.Header = "Set file link";
                addFileLinkItem.Icon   = new Image {
                    Source = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/linkFile.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
                };
                addFileLinkItem.Click += new System.Windows.RoutedEventHandler(AddFileLinkItem_Click);

                menuItems.Add(addFileLinkItem);

                if (feature.ColumnValues.ContainsKey("LinkFileName") && !string.IsNullOrEmpty(feature.ColumnValues["LinkFileName"]))
                {
                    MenuItem removeFileLinkItem = new MenuItem();
                    removeFileLinkItem.Header = "Remove file link";
                    removeFileLinkItem.Icon   = new Image {
                        Source = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/Delete.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
                    };
                    removeFileLinkItem.Click += new System.Windows.RoutedEventHandler(RemoveFileLinkItem_Click);

                    menuItems.Add(removeFileLinkItem);

                    MenuItem openFileLinkItem = new MenuItem();
                    openFileLinkItem.Header = "Open file link";
                    openFileLinkItem.Icon   = new Image {
                        Source = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/Open.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
                    };
                    openFileLinkItem.Click += new System.Windows.RoutedEventHandler(OpenFileLinkItem_Click);

                    menuItems.Add(openFileLinkItem);
                }
            }

            return(menuItems);
        }
 protected override Collection <MenuItem> GetMapContextMenuItemsCore(GetMapContextMenuParameters parameters)
 {
     return(new Collection <MenuItem> {
         GoogleEarthHelper.GetSaveAsKMLMenuItem()
     });
 }