public static MenuItem GetMovementMenuItem(MovementAction movementAction, bool isMovementEnabled = true)
        {
            var    command      = new ObservedCommand(() => { MoveItem(movementAction); }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0) && isMovementEnabled);
            string headerString = String.Empty;
            string imageName    = String.Empty;

            switch (movementAction)
            {
            case MovementAction.Up:
                headerString = "Move up";
                imageName    = "moveUp";
                break;

            case MovementAction.Down:
                headerString = "Move down";
                imageName    = "moveDown";
                break;

            case MovementAction.ToTop:
                headerString = "Move to top";
                imageName    = "toTop";
                break;

            case MovementAction.ToBottom:
                headerString = "Move to bottom";
                imageName    = "toBottom";
                break;

            default:
                break;
            }
            return(GetMenuItem(headerString, string.Format("/GisEditorInfrastructure;component/Images/{0}.png", imageName), command));
        }
Exemplo n.º 2
0
        public static MenuItem GetDuplicateMenuItem()
        {
            var command  = new ObservedCommand(Duplicate, CanExecute);
            var menuItem = GetMenuItem("Duplicate", "pack://application:,,,/GisEditorInfrastructure;component/Images/duplicate.png", command);

            return(menuItem);
        }
Exemplo n.º 3
0
        public static MenuItem GetDrawingMarginMenuItem(FeatureLayer featureLayer)
        {
            var command  = new ObservedCommand(() => { }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));
            var menuItem = GetMenuItem("Drawing Margin", "/GisEditorInfrastructure;component/Images/drawing_margin_32x32.png", command);

            menuItem.ToolTip = "Increase your drawing margin percentage if you are seeing cut off labels or symbols on your map.";

            var subMenuItems = marginValues.Select(marginValue =>
            {
                var subMenuItem = new MenuItem
                {
                    Header      = marginValue + "%",
                    IsChecked   = marginValue == featureLayer.DrawingMarginInPixel,
                    IsCheckable = true
                };
                subMenuItem.Click += (s, e) => { SetDrawingMargin((MenuItem)s, marginValue); };
                return(subMenuItem);
            });

            foreach (var item in subMenuItems)
            {
                menuItem.Items.Add(item);
            }
            return(menuItem);
        }
Exemplo n.º 4
0
        public static MenuItem GetRenameMenuItem()
        {
            var command = new ObservedCommand(() =>
            {
                GisEditor.LayerListManager.SelectedLayerListItem.IsRenaming = true;
            }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));

            return(GetMenuItem("Rename", "/GisEditorInfrastructure;component/Images/rename.png", command));
        }
        public static MenuItem GetStyleBuilderMenuItem()
        {
            var command = new ObservedCommand(() =>
            {
                LayerListHelper.AddStyle();
            }, () => true);

            return(GetMenuItem("Style Builder", "/GisEditorInfrastructure;component/Images/style_builder_16x16.png", command));
        }
Exemplo n.º 6
0
        public static MenuItem GetAddStyleWizardMenuItem(FeatureLayer featureLayer)
        {
            var command = new ObservedCommand(() =>
            {
                if (AddStyleToLayerWithStyleWizard(new Layer[] { featureLayer }))
                {
                    LayerListHelper.InvalidateTileOverlay();
                    GisEditor.UIManager.InvokeRefreshPlugins(new RefreshArgs(featureLayer, RefreshArgsDescriptions.GetAddStyleWizardMenuItemDescription));
                }
            }, () => true);

            return(GetMenuItem("Style Wizard", "/GisEditorInfrastructure;component/Images/addstyle.png", command));
        }
        public static MenuItem GetAddSpecifiedStyleByPluginMenuItem(StylePlugin styleProvider)
        {
            var image = new Image();

            image.BeginInit();
            image.Source = styleProvider.SmallIcon;
            image.EndInit();
            var command = new ObservedCommand(() => { AddStyle(styleProvider); },
                                              () =>
            {
                string stylePluginName = styleProvider.GetType().FullName;
                return(GisEditor.StyleManager.GetActiveStylePlugins().Any(p => p.GetType().FullName.Equals(stylePluginName, StringComparison.Ordinal)));
            });

            return(GetMenuItem(styleProvider.GetShortName(), image, command));
        }
Exemplo n.º 8
0
        public static MenuItem GetEditStyleMenuItem()
        {
            var command = new ObservedCommand(new Action(() =>
            {
                LayerListHelper.EditStyle(GisEditor.LayerListManager.SelectedLayerListItem);
            }), new Func <bool>(() =>
            {
                if (GisEditor.LayerListManager.SelectedLayerListItem == null)
                {
                    return(false);
                }
                return(GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject is Style);
            }));

            return(GetMenuItem("Edit", "/GisEditorInfrastructure;component/Images/editstyle.png", command));
        }
Exemplo n.º 9
0
        public static MenuItem GetMenuItem(string header, Image icon, ObservedCommand command)
        {
            if (icon != null)
            {
                icon.Width  = 16;
                icon.Height = 16;
            }
            MenuItem menuItem = new MenuItem();

            menuItem.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            menuItem.VerticalContentAlignment   = VerticalAlignment.Stretch;
            menuItem.Name    = header.Replace(" ", "").Replace(".", "");
            menuItem.Header  = header;
            menuItem.Icon    = icon;
            menuItem.Command = command;
            return(menuItem);
        }
Exemplo n.º 10
0
        public static MenuItem GetAddStyleMenuItem(AddStyleTypes addStyleType, FeatureLayer featureLayer)
        {
            var command = new ObservedCommand(() => { }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));

            var menuItem = GetMenuItem(GisEditor.LanguageManager.GetStringResource("StyleBuilderWindowAddStyleLabel"), "/GisEditorInfrastructure;component/Images/addstyle.png", null);

            menuItem.Items.Add(GetLoadFromLibraryMenuItem());
            menuItem.Items.Add(new Separator());
            AddSubMenuItems(addStyleType, menuItem);

            //ShapeFileFeatureLayer shpLayer = featureLayer as ShapeFileFeatureLayer;
            //if (shpLayer != null)
            {
                if (menuItem.Items.Count > 0)
                {
                    menuItem.Items.Add(new Separator());
                }
                menuItem.Items.Add(LayerListMenuItemHelper.GetAddStyleWizardMenuItem(featureLayer));
            }
            return(menuItem);
        }
        public static MenuItem GetViewDataMenuItem(FeatureLayerPlugin featureLayerPlugin)
        {
            var command = new ObservedCommand(() =>
            {
                UserControl userControl = null;
                if (featureLayerPlugin == null)
                {
                    FeatureLayer selectedLayer = null;
                    if (GisEditor.LayerListManager.SelectedLayerListItem != null)
                    {
                        selectedLayer = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as FeatureLayer;
                    }
                    userControl = new DataViewerUserControl(selectedLayer);
                }
                else
                {
                    userControl = featureLayerPlugin.GetViewDataUI();
                }
                ViewData(userControl);
            }, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));

            return(GetMenuItem("View data", "/GisEditorInfrastructure;component/Images/viewdata.png", command));
        }
        public InfrastructureSettingViewModel()
        {
            pluginDirectories   = new ObservableCollection <string>();
            addDirectoryCommand = new RelayCommand(() =>
            {
                if (dialog == null)
                {
                    dialog = new FolderBrowserDialog();
                }

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (PluginDirectories.Any(d => d.Equals(dialog.SelectedPath, StringComparison.OrdinalIgnoreCase)))
                    {
                        MessageBox.Show(GisEditor.LanguageManager.GetStringResource("DirectoryExistsSelectAnotherLabel"), GisEditor.LanguageManager.GetStringResource("DirectoryExistsLabel"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        PluginDirectories.Add(dialog.SelectedPath);
                    }
                }
            });

            removeDirectoryCommand = new ObservedCommand(() =>
            {
                if (!String.IsNullOrEmpty(SelectedDirectory) && PluginDirectories.Contains(SelectedDirectory))
                {
                    int selectedIndex = PluginDirectories.IndexOf(SelectedDirectory);
                    PluginDirectories.Remove(SelectedDirectory);
                    if (PluginDirectories.Count > selectedIndex)
                    {
                        SelectedDirectory = PluginDirectories[selectedIndex];
                    }
                }
            }, () => !String.IsNullOrEmpty(SelectedDirectory));
        }
Exemplo n.º 13
0
        public static MenuItem GetRemoveStyleMenuItem()
        {
            var command = new ObservedCommand(RemoveStyle, () => true);

            return(GetMenuItem("Remove", "/GisEditorInfrastructure;component/Images/unload.png", command));
        }
Exemplo n.º 14
0
        public static MenuItem GetSaveLayerMenuItem()
        {
            var command = new ObservedCommand(SaveLayer, () => true);

            return(GetMenuItem("Save Layer", "/GisEditorInfrastructure;component/Images/Export.png", command));
        }
        public static MenuItem GetSetUpperScaleMenuItem()
        {
            var command = new ObservedCommand(SetUpperScale, () => true);

            return(GetMenuItem("Set Upper ZoomLevel Limit", "/GisEditorInfrastructure;component/Images/Set Upper Scale.png", command));
        }
        public static MenuItem GetExportAsCodeMenuItem()
        {
            var command = new ObservedCommand(ExportAsCode, ExportAsCodeCanExecute);

            return(GetMenuItem("Export as Code", "/GisEditorInfrastructure;component/Images/export_as_code.png", command));
        }
Exemplo n.º 17
0
        public static MenuItem GetReplaceFromLibraryMenuItem()
        {
            var command = new ObservedCommand(ReplaceFromLibrary, () => true);

            return(GetMenuItem("Replace from Library...", "/GisEditorInfrastructure;component/Images/replace_from_library.png", command));
        }
        public static MenuItem GetZoomToExtentMenuItem()
        {
            var command = new ObservedCommand(ZoomToExtent, () => true);

            return(GetMenuItem(GisEditor.LanguageManager.GetStringResource("MapElementsListPluginZoomToExtent"), "/GisEditorInfrastructure;component/Images/zoomextent.png", command));
        }
Exemplo n.º 19
0
 private static MenuItem GetMenuItem(string header, string iconUri, ObservedCommand command)
 {
     return(GetMenuItem(header, new Image {
         Source = new BitmapImage(new Uri(iconUri, UriKind.RelativeOrAbsolute))
     }, command));
 }
        public static MenuItem GetLoadFromLibraryMenuItem()
        {
            var command = new ObservedCommand(LoadFromLibrary, () => true);

            return(GetMenuItem("Load from Library...", "/GisEditorInfrastructure;component/Images/load_from_library.png", command));
        }
Exemplo n.º 21
0
        //private Window propertiesDockWindow;

        public static MenuItem GetPropertiesMenuItem()
        {
            var command = new ObservedCommand(ShowProperties, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));

            return(GetMenuItem(GisEditor.LanguageManager.GetStringResource("MapElementsListPluginProperties"), "/GisEditorInfrastructure;component/Images/properties.png", command));
        }
Exemplo n.º 22
0
        public static MenuItem GetReprojectMenuItem()
        {
            var command = new ObservedCommand(Reproject, () => !(GisEditor.LayerListManager.SelectedLayerListItems.Count > 0));

            return(GetMenuItem("Layer Projection", "/GisEditorInfrastructure;component/Images/reprojection.png", command));
        }