private static void AddComplicatedStyleInnerStyles(StyleLayerListItem item) { bool isValueStyle = item.ConcreteObject is ValueStyle; foreach (var innerStyleItem in item.Children.OfType <StyleLayerListItem>()) { innerStyleItem.DoubleClicked = () => { GisEditor.LayerListManager.SelectedLayerListItem = innerStyleItem; EditStyle(innerStyleItem); }; innerStyleItem.PreviewImage = new Image { Source = innerStyleItem.GetPreviewSource(23, 23) }; if (isValueStyle) { innerStyleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetZoomToExtentMenuItem()); } AddMenuItems(innerStyleItem, false); foreach (var subItem in innerStyleItem.Children.OfType <StyleLayerListItem>()) { AddSubEntitiesToComponentStyleEntity(subItem); } } }
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 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()); }
private static void CreateComponentStyleEntity(StyleLayerListItem styleItem) { var bitmapSource = styleItem.GetPreviewSource(23, 23); styleItem.PreviewImage = new Image { Source = bitmapSource }; styleItem.IsExpanded = false; styleItem.DoubleClicked = () => { GisEditor.LayerListManager.SelectedLayerListItem = styleItem; GisEditor.ActiveMap.ActiveLayer = GisEditor.LayerListManager.SelectedLayerListItem.Parent.ConcreteObject as Layer; EditStyle(styleItem); }; AddMenuItems(styleItem); styleItem.ContextMenuItems.Add(LayerListMenuItemHelper.GetSaveStyleMenuItem()); foreach (var item in styleItem.Children.OfType <StyleLayerListItem>()) { AddSubEntitiesToComponentStyleEntity(item); } }
private static void AddSubMenuItems(AddStyleTypes addStyleType, MenuItem menuItem) { if ((addStyleType & AddStyleTypes.AddAreaStyle) == AddStyleTypes.AddAreaStyle) { bool hasItems = false; foreach (StylePlugin stylePlugin in GisEditor.StyleManager .GetStylePlugins(StyleCategories.Area | StyleCategories.Composite)) { hasItems = true; menuItem.Items.Add(LayerListMenuItemHelper.GetAddSpecifiedStyleByPluginMenuItem(stylePlugin)); } if (hasItems) { menuItem.Items.Add(new Separator()); } } if ((addStyleType & AddStyleTypes.AddLineStyle) == AddStyleTypes.AddLineStyle) { bool hasItems = false; foreach (StylePlugin stylePlugin in GisEditor.StyleManager .GetStylePlugins(StyleCategories.Line | StyleCategories.Composite)) { hasItems = true; menuItem.Items.Add(LayerListMenuItemHelper.GetAddSpecifiedStyleByPluginMenuItem(stylePlugin)); } if (hasItems) { menuItem.Items.Add(new Separator()); } } if ((addStyleType & AddStyleTypes.AddPointStyle) == AddStyleTypes.AddPointStyle) { bool hasItems = false; foreach (StylePlugin stylePlugin in GisEditor.StyleManager .GetStylePlugins(StyleCategories.Point | StyleCategories.Composite)) { hasItems = true; menuItem.Items.Add(LayerListMenuItemHelper.GetAddSpecifiedStyleByPluginMenuItem(stylePlugin)); } if (hasItems) { menuItem.Items.Add(new Separator()); } } if ((addStyleType & AddStyleTypes.AddTextStyle) == AddStyleTypes.AddTextStyle) { foreach (StylePlugin stylePlugin in GisEditor.StyleManager .GetStylePlugins(StyleCategories.Label)) { menuItem.Items.Add(LayerListMenuItemHelper.GetAddSpecifiedStyleByPluginMenuItem(stylePlugin)); } } var lastItem = menuItem.Items[menuItem.Items.Count - 1] as Separator; if (lastItem != null) { menuItem.Items.Remove(lastItem); } }