Ejemplo n.º 1
0
        public static IBaseCommand GetRedoCommand(this ICommandFactory commandFactory, IMap map)
        {
            IBaseCommand command = null;

            if (commandFactory != null && map != null)
            {
                string name = "redo";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "重做",
                        Name           = name,
                        ExecuteCommand = (obj) => Redo(map),
                        Icon           = ResourcesHelper.GetBitmapImage("Redo16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Redo32.png"),
                        ToolTip        = "重做"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加图层组工具
        /// </summary>
        /// <param name="commandFactory"></param>
        /// <param name="layers"></param>
        /// <returns></returns>
        public static IBaseCommand GetAddGroupCommand(this ICommandFactory commandFactory, ILayerCollection layers)
        {
            IBaseCommand command = null;

            if (commandFactory != null && layers != null)
            {
                string name = "addGroup";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "添加分组",
                        Name           = name,
                        ExecuteCommand = (obj) => layers.AddGroup(),
                        Icon           = ResourcesHelper.GetBitmapImage("Group16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Group32.png"),
                        ToolTip        = "添加分组"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 3
0
        public static IBaseCommand GetZoomToNextViewCommand(this ICommandFactory commandFactory, IMap map)
        {
            IBaseCommand command = null;

            if (commandFactory != null && map != null)
            {
                string name = "zoomToNextView";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "前进",
                        Name           = name,
                        ExecuteCommand = (obj) => ZoomToNextView(map),
                        Icon           = ResourcesHelper.GetBitmapImage("Next16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Next32.png"),
                        ToolTip        = "前进至后一视图"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 4
0
        public static IBaseCommand GetActiveZoomOutToolCommand(this ICommandFactory commandFactory, IMap map)
        {
            IBaseCommand command = null;

            if (commandFactory != null && map != null)
            {
                string name = "activeZoomOutTool";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "缩小",
                        Name           = name,
                        ExecuteCommand = (obj) => ActiveZoomOutTool(map),
                        Icon           = ResourcesHelper.GetBitmapImage("ZoomOut16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("ZoomOut32.png"),
                        ToolTip        = "缩小工具"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加图层工具
        /// </summary>
        /// <param name="commandFactory"></param>
        /// <param name="map"></param>
        /// <param name="layerCollection"></param>
        /// <returns></returns>
        public static IBaseCommand GetAddLayersCommand(this ICommandFactory commandFactory, IMap map, ILayerCollection layerCollection)
        {
            IBaseCommand command = null;

            if (commandFactory != null && map != null)
            {
                string name = "addLayers";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "添加",
                        Name           = name,
                        ExecuteCommand = (obj) => AddLayers(map, layerCollection),
                        Icon           = ResourcesHelper.GetBitmapImage("Add16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Add32.png"),
                        ToolTip        = "添加图层"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 6
0
        public static IBaseCommand GetZoomToMaxExtentCommand(this ICommandFactory commandFactory, IMap map)
        {
            IBaseCommand command = null;

            if (commandFactory != null && map != null)
            {
                string name = "zoomToMaxExtent";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "全图",
                        Name           = name,
                        ExecuteCommand = (obj) => map?.ZoomToMaxExtent(),
                        Icon           = ResourcesHelper.GetBitmapImage("Global16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Global32.png"),
                        ToolTip        = "缩放至全图"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }
Ejemplo n.º 7
0
        public static IBaseCommand GetRemoveLayerCommand(this ICommandFactory commandFactory, ILayer layer)
        {
            IBaseCommand command = null;

            if (commandFactory != null && layer != null)
            {
                string name = "removeLayer";
                command = commandFactory.Commands?.FirstOrDefault(x => x.Name == name);
                if (command == null)
                {
                    command = new BaseCommand()
                    {
                        Header         = "移除",
                        Name           = name,
                        ExecuteCommand = (obj) => RemoveLayer(layer),
                        Icon           = ResourcesHelper.GetBitmapImage("Remove16.png"),
                        LargeIcon      = ResourcesHelper.GetBitmapImage("Remove32.png"),
                        ToolTip        = "移除图层"
                    };
                    commandFactory.Commands.Add(command);
                }
            }
            return(command);
        }