private void UpdateStyleSelectionPreview(Styles.Style style) { Task.Factory.StartNew(obj => { var targetStyle = (Styles.Style)obj; var imageBuffer = StyleHelper.GetImageBufferFromStyle(targetStyle); if (Application.Current != null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var imageSource = ThinkGeo.MapSuite.GisEditor.Plugins.StyleHelper.ConvertToImageSource(imageBuffer); SelectionStylePreview = imageSource; }), DispatcherPriority.Background, null); } }, style); }
private ClassBreakItem GetClassBreakItem(ClassBreak classBreak) { var classBreakItem = new ClassBreakItem { Image = StyleHelper.GetImageFromStyle(classBreak.CustomStyles.LastOrDefault()), StartingValue = classBreak.Value.ToString(), ClassBreak = classBreak }; classBreakItem.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("StartingValue")) { RaisePropertyChanged(e.PropertyName); } }; return(classBreakItem); }
public void UpdateEditStylePreviewASync() { var editOverlay = SharedViewModel.Instance.EditOverlay; if (editOverlay != null) { editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = null; editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = null; editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = null; editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = null; if (EditCompositeStyle != null) { foreach (var tempStyle in EditCompositeStyle?.Styles) { editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(tempStyle); } } } if (Application.Current != null) { Task.Factory.StartNew(obj => { var targetStyle = (Style)obj; var imageBuffer = StyleHelper.GetImageBufferFromStyle(targetStyle); if (Application.Current != null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var imageSource = StyleHelper.ConvertToImageSource(imageBuffer); EditStylePreview = imageSource; }), DispatcherPriority.Background, null); } }, EditCompositeStyle); } }
protected override void UpdateUICore(UserControl styleItemUI) { base.UpdateUICore(styleItemUI); var viewModel = styleItemUI.DataContext as ClassBreakStyleViewModel; if (viewModel != null) { viewModel.ClassBreakItems.Clear(); foreach (var classBreak in Children.Select(i => i.ConcreteObject).OfType <ClassBreak>()) { ClassBreakItem classBreakItem = new ClassBreakItem(); classBreakItem.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("StartingValue")) { UpdateStyleItem(); } }; classBreakItem.ClassBreak = classBreak; classBreakItem.StartingValue = classBreak.Value.ToString(CultureInfo.InvariantCulture); classBreakItem.Image = StyleHelper.GetImageFromStyle(classBreak.CustomStyles); viewModel.ClassBreakItems.Add(classBreakItem); } } }
public void Update(ValueItem newValueItem) { Image = StyleHelper.GetImageFromStyle(newValueItem.CustomStyles.LastOrDefault()); MatchedValue = newValueItem.Value; ValueItem = newValueItem; }
private void InitValueItem <T>(StyleCategories styleProviderType, DistinctColumnValue columnValueGroup, string columnName) where T : Style { Collection <Style> styles = new Collection <Style>(); if (styleProviderType == StyleCategories.Composite) { Collection <StylePlugin> plugins = new Collection <StylePlugin>(); var areaPlugin = GisEditor.StyleManager.GetDefaultStylePlugin(StyleCategories.Area); if (areaPlugin != null) { plugins.Add(areaPlugin); } var linePlugin = GisEditor.StyleManager.GetDefaultStylePlugin(StyleCategories.Line); if (linePlugin != null) { plugins.Add(linePlugin); } var pointPlugin = GisEditor.StyleManager.GetDefaultStylePlugin(StyleCategories.Point); if (pointPlugin != null) { plugins.Add(pointPlugin); } foreach (var item in plugins) { Style style = GetStyleByPlugin(item); if (style != null) { styles.Add(style); } } } else { var styleProvider = GisEditor.StyleManager.GetDefaultStylePlugin(styleProviderType); if (styleProvider != null) { Style style = GetStyleByPlugin(styleProvider); if (style != null) { styles.Add(style); } } } if (styles.Count > 0) { ValueItem valueItem = new ValueItem(); valueItem.Value = columnValueGroup.ColumnValue; styles.ForEach(s => valueItem.CustomStyles.Add(s)); ValueItemEntity valueItemEntity = ValueItems.FirstOrDefault(tmpItem => tmpItem.MatchedValue.Equals(columnValueGroup.ColumnValue, StringComparison.Ordinal)); if (valueItemEntity == null) { valueItem = new ValueItem(); valueItem.Value = columnValueGroup.ColumnValue; styles.ForEach(s => valueItem.CustomStyles.Add(s)); var image = StyleHelper.GetImageFromStyle(styles); var newValueItemEntity = GetValueItemEntity(image, columnValueGroup.ColumnValue, valueItem); newValueItemEntity.Count = columnValueGroup.ColumnValueCount; ValueItems.Add(newValueItemEntity); } else { //valueItemEntity.Update(valueItem); valueItemEntity.Count = columnValueGroup.ColumnValueCount; } } }