Exemplo n.º 1
0
        public Collection <MenuItem> GetLayerListItemContextMenuItems(GetLayerListItemContextMenuParameters parameters)
        {
            Collection <MenuItem> menuItems = new Collection <MenuItem>();

            menuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.Up));
            menuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.Down));
            menuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.ToTop));
            menuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.ToBottom));

            //menuItems.Add(new MenuItem() { Header = "--" });
            menuItems.Add(LayerListMenuItemHelper.GetZoomToExtentMenuItem());
            menuItems.Add(LayerListMenuItemHelper.GetRenameMenuItem());
            menuItems.Add(LayerListMenuItemHelper.GetRemoveLayerMenuItem());

            //menuItems.Add(new MenuItem() { Header = "--" });

            float       transparency = 255;
            RasterLayer rasterLayer  = parameters.LayerListItem.ConcreteObject as RasterLayer;

            if (rasterLayer != null)
            {
                transparency = rasterLayer.Transparency;
            }
            else
            {
                transparency = ((Layer)parameters.LayerListItem.ConcreteObject).Transparency;
            }

            menuItems.Add(LayerListMenuItemHelper.GetTransparencyMenuItem(
                              transparency));
            Collection <MenuItem> newMenuItems = GetLayerListItemContextMenuItemsCore(parameters);

            foreach (MenuItem menuItem in newMenuItems)
            {
                menuItems.Add(menuItem);
            }

            return(menuItems);
        }
 private static void AddMenuItems(StyleLayerListItem styleItem, bool isMovementEnabled = true)
 {
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.Up, isMovementEnabled));
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.Down, isMovementEnabled));
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.ToTop, isMovementEnabled));
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetMovementMenuItem(MovementAction.ToBottom, isMovementEnabled));
     styleItem.ContextMenuItems.Add(new MenuItem()
     {
         Header = "--"
     });
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetInsertFromLibraryMenuItem());
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetReplaceFromLibraryMenuItem());
     styleItem.ContextMenuItems.Add(new MenuItem()
     {
         Header = "--"
     });
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetDuplicateMenuItem());
     if (styleItem.CanRename)
     {
         styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetRenameMenuItem());
     }
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetEditStyleMenuItem());
     styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetRemoveStyleMenuItem());
 }