public static BitmapImage GetImageSource(GeoBrush geoBrush) { BitmapImage result = null; System.Drawing.Bitmap nativeImage = new System.Drawing.Bitmap(16, 16); PlatformGeoCanvas geoCanvas = new PlatformGeoCanvas(); RectangleShape area = new RectangleShape(-90, 90, 90, -90); geoCanvas.BeginDrawing(nativeImage, area, GeographyUnit.DecimalDegree); try { geoCanvas.DrawArea(area, geoBrush, DrawingLevel.LevelOne); geoCanvas.EndDrawing(); MemoryStream streamSource = new MemoryStream(); nativeImage.Save(streamSource, System.Drawing.Imaging.ImageFormat.Png); result = new BitmapImage(); result.BeginInit(); result.StreamSource = streamSource; result.EndInit(); result.Freeze(); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } finally { nativeImage.Dispose(); } return(result); }
public ProjectPathPrinterLayer(string text, GeoFont font, GeoBrush textBrush) : base() { this.projectPath = text; this.font = font; this.textBrush = textBrush; }
private void SetHighlightFeatureLayerStyle(GeoBrush fillColor, GeoBrush outlineColor, float?outlineThickness) { this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; if (fillColor != null) { this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.Advanced.FillCustomBrush = fillColor; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.InnerPen.Brush = fillColor; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Advanced.CustomBrush = fillColor; } if (outlineColor != null) { this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Brush = outlineColor; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.Brush = outlineColor; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen.Brush = outlineColor; } if (outlineThickness != null) { this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Width = (float)outlineThickness; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.Width = (float)outlineThickness; this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen.Width = (float)outlineThickness; } }
public DatePrinterLayer(string text, GeoFont font, GeoBrush textBrush) : base() { this.dateString = text; this.font = font; this.textBrush = textBrush; }
public SquareTextPointStyle() { SymbolType = PointSymbolType.Square; SymbolSize = 30; PointType = PointType.Symbol; font = new GeoFont("Verdana", 14); textBrush = new GeoSolidBrush(GeoColor.StandardColors.White); SymbolPen = new GeoPen(GeoColor.StandardColors.White, 1); }
public ProjectPathElementViewModel(string projectPath) { fontName = new System.Windows.Media.FontFamily("Arial"); fontSize = 12; fontColor = new GeoSolidBrush(GeoColor.StandardColors.Black); dragMode = PrinterDragMode.Draggable; resizeMode = PrinterResizeMode.Resizable; this.projectPath = projectPath; PropertyChanged += ProjectPathElementEntity_PropertyChanged; RefreshPreview(""); }
public TextElementViewModel(bool withPreview = true) { text = string.Empty; fontName = new System.Windows.Media.FontFamily("Arial"); fontSize = 24; fontColor = new GeoSolidBrush(GeoColor.StandardColors.Black); dragMode = PrinterDragMode.Draggable; resizeMode = PrinterResizeMode.Resizable; this.withPreview = withPreview; PropertyChanged += TextElementEntity_PropertyChanged; }
public DataGridViewModel() { addingColumnName = string.Empty; fontName = new System.Windows.Media.FontFamily("Arial"); fontColor = new GeoSolidBrush(GeoColor.StandardColors.Black); resizeMode = PrinterResizeMode.Resizable; dragMode = PrinterDragMode.Draggable; currentDataTable = new DataTable(); currentDataTable.Columns.CollectionChanged += Columns_CollectionChanged; PropertyChanged += DataGridViewModelPropertyChanged; FontSize = 9; }
private static void OnSelectedBrushPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { TabColorPicker currentInstance = (TabColorPicker)sender; if (!currentInstance.isTemplateApplied) { return; } GeoBrush geoBrush = (GeoBrush)e.NewValue; currentInstance.SetSelectedBrush(geoBrush); }
public ScaleBarElementViewModel(MapPrinterLayer mapPrinterLayer) { this.mapPrinterLayer = mapPrinterLayer; background = new AreaStyle(); background.CustomAreaStyles.Add(new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Transparent))); selectedUnitSystem = UnitSystem.Metric; color = new GeoSolidBrush(GeoColor.StandardColors.Black); alternatingColor = new GeoSolidBrush(GeoColor.StandardColors.White); resizeMode = PrinterResizeMode.Resizable; dragMode = PrinterDragMode.Draggable; PropertyChanged += ScaleBarViewModelPropertyChanged; SelectedNumericFormatType = ScaleNumericFormatType.None; }
public DateElementViewModel() { formatPairs = new Dictionary <string, string>(); fontName = new System.Windows.Media.FontFamily("Arial"); fontSize = 12; fontColor = new GeoSolidBrush(GeoColor.StandardColors.Black); dragMode = PrinterDragMode.Draggable; resizeMode = PrinterResizeMode.Resizable; formats = GetDefaultDateFormats(); selectedFormat = formats.FirstOrDefault(); PropertyChanged += DateElementEntity_PropertyChanged; RefreshPreview(""); }
protected override void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable <ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle) { List <ScreenPointF> screenPoints = new List <ScreenPointF>(); foreach (ScreenPointF screenPointF in textPathInScreen) { screenPoints.Add(GetScreenPoint(screenPointF)); } GeoFont scaledFont = GetScaledFont(font); canvas.DrawText(text, scaledFont, fillBrush, haloPen, screenPoints, drawingLevel, xOffset, yOffset, rotateAngle); }
public ClassBreakViewModel() { minimum = 0; classesCount = 5; baseBrush = new GeoSolidBrush(GeoColor.FromHtml("#9ACD32")); endBrush = new GeoSolidBrush(GeoColor.StandardColors.Red); colorFields = new String[] { "Hue", "Saturation", "Lightness" }; selectedColorField = ClassBreakBy.Hue; startColorName = "Start Color"; endColorName = "End Color"; colorPickerVisibility = Visibility.Visible; sliderVisibility = Visibility.Collapsed; }
protected override void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable <ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle, DrawingTextAlignment drawingTextAlignment) { int id = 0; if (fillBrush != null) { id = fillBrush.GetHashCode(); } if (!styleUrlDictionary.ContainsKey(id)) { string kmlStyle = GetTextStyleKml(id, ((GeoSolidBrush)fillBrush).Color, font.Size); kmlBuilder.Append(kmlStyle); styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(styleUrlDictionary[id]); text = text.Replace("<", "<"); text = text.Replace(">", ">"); text = text.Replace("`", "'"); text = text.Replace("\"", """); text = text.Replace("&", "&"); contentStringBuilder.AppendLine(@"<name>" + text + @"</name>"); if (textPathInScreen.Count() > 1) { contentStringBuilder.AppendLine(@"<LineString>"); contentStringBuilder.AppendLine(extrudeString); contentStringBuilder.AppendLine(tessellateString); contentStringBuilder.AppendLine(altitudeModeString); AppendCoordinates(textPathInScreen, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</LineString>"); } else { contentStringBuilder.AppendLine(@"<Point>"); contentStringBuilder.AppendLine(extrudeString); contentStringBuilder.AppendLine(tessellateString); contentStringBuilder.AppendLine(altitudeModeString); AppendCoordinates(textPathInScreen, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</Point>"); } contentStringBuilder.AppendLine(@"</Placemark>"); }
public WindPointStyle(string textColumn, string levelColumn, string angleColumn, GeoColor fillColor) { this.directionLineLength1 = 40; this.directionLineLength2 = 10; this.blackBrush = new GeoSolidBrush(GeoColor.SimpleColors.Black); this.font = new GeoFont("Verdana", 10); this.textBrush = new GeoSolidBrush(GeoColor.StandardColors.Black); this.fillBrush = new GeoSolidBrush(fillColor); this.outlinePen = new GeoPen(GeoColor.StandardColors.Black, 4); this.innerlinePen = new GeoPen(fillBrush, 2); this.textColumn = textColumn; this.windLevelColumn = levelColumn; this.angleColumn = angleColumn; }
protected override void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable <ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle) { //StringBuilder rnSB = new StringBuilder(); //rnSB.AppendLine("<Placemark>"); //rnSB.AppendFormat("<description>{0}</description>", text); //rnSB.AppendFormat("<name>{0}</name>", text); //rnSB.AppendLine("<visibility>1</visibility>"); //rnSB.AppendLine("<Point>"); //AppendCoordinates(textPathInScreen,xOffset,yOffset,rnSB); ////rnSB.AppendFormat("<coordinates>{0},{1},20000</coordinates>", //// ((ScreenPointF[])(textPathInScreen))[0].X, //// ((ScreenPointF[])(textPathInScreen))[0].Y); //rnSB.AppendLine("</Point>"); //rnSB.AppendLine("<Style><IconStyle><Icon><href></href></Icon></IconStyle></Style>"); //rnSB.AppendLine("</Placemark>"); //StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); //contentStringBuilder.Append(rnSB.ToString()); }
protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { return; }
public CustomTextStyle(string textColumnName, GeoFont textFont, GeoBrush textBrush) : base(textColumnName, textFont, textBrush) { }
private void SetSelectedBrush(GeoBrush geoBrush) { if (!isTemplateApplied) { return; } if (geoBrush is GeoSolidBrush) { SelectTabItem(solidColorBrushTabItem); Color selectedMediaColor = GeoColor2MediaColorConverter.Convert(((GeoSolidBrush)geoBrush).Color); if (solidColorPicker.SelectedColor != selectedMediaColor) { solidColorPicker.SelectedColor = selectedMediaColor; } } else if (geoBrush is GeoLinearGradientBrush) { SelectTabItem(gradientTabItem); GeoLinearGradientBrush geoGradientBrush = (GeoLinearGradientBrush)geoBrush; System.Drawing.Color drawingStartColor = GeoColor2DrawingColorConverter.Convert(geoGradientBrush.StartColor); System.Drawing.Color drawingEndColor = GeoColor2DrawingColorConverter.Convert(geoGradientBrush.EndColor); if (gradientPicker.SelectedBrush.StartColor != drawingStartColor || gradientPicker.SelectedBrush.EndColor != drawingEndColor || gradientPicker.SelectedBrush.Angle - geoGradientBrush.DirectionAngle > 1) { gradientPicker.SelectedBrush = new LinearGradientBrushEntity { StartColor = drawingStartColor, EndColor = drawingEndColor, Angle = (int)geoGradientBrush.DirectionAngle } } ; } else if (geoBrush is GeoHatchBrush) { GeoHatchBrush geoHatchBrush = (GeoHatchBrush)geoBrush; SelectTabItem(hatchBrushTabItem); System.Drawing.Drawing2D.HatchStyle drawingHatchStyle = GeoHatchStyle2DrawingHatchStyle.Convert(geoHatchBrush.HatchStyle); System.Drawing.Color drawingBackgroundColor = GeoColor2DrawingColorConverter.Convert(geoHatchBrush.BackgroundColor); System.Drawing.Color drawingForegroundColor = GeoColor2DrawingColorConverter.Convert(geoHatchBrush.ForegroundColor); if (hatchColorPicker.SelectedHatchStyle != drawingHatchStyle || drawingBackgroundColor != hatchColorPicker.BackgroundColor || drawingForegroundColor != hatchColorPicker.ForegroundColor) { hatchColorPicker.BackgroundColor = drawingBackgroundColor; hatchColorPicker.ForegroundColor = drawingForegroundColor; hatchColorPicker.SelectedHatchStyle = drawingHatchStyle; } } else if (geoBrush is GeoTextureBrush) { SelectTabItem(textureTabItem); textureTabItem.IsSelected = true; GeoTextureBrush geoTextureBrush = (GeoTextureBrush)geoBrush; if (textureColorPicker.SelectedBrush == null || !textureColorPicker.SelectedBrush.GetValue(Canvas.TagProperty).Equals(geoTextureBrush.GeoImage.GetPathFilename())) { textureColorPicker.SelectedBrush = GeoTextureBrushToImageBrushConverter.Convert(geoTextureBrush); } } }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { if (fillBrush == null) { fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); } int id = 0; if (outlinePen != null) { id = outlinePen.GetHashCode(); } else if (fillBrush != null) { id = id ^ fillBrush.GetHashCode(); } if (!styleUrlDictionary.ContainsKey(id)) { GeoSolidBrush brush = fillBrush as GeoSolidBrush; GeoLinearGradientBrush gradientBrush = fillBrush as GeoLinearGradientBrush; GeoHatchBrush hatchBrush = fillBrush as GeoHatchBrush; string kmlStyle = string.Empty; if (gradientBrush != null) { kmlStyle = GetPolygonStyleKml(id, outlinePen, gradientBrush.StartColor); } else if (hatchBrush != null) { kmlStyle = GetPolygonStyleKml(id, outlinePen, hatchBrush.BackgroundColor); } else { kmlStyle = GetPolygonStyleKml(id, outlinePen, brush.Color); } kmlBuilder.Append(kmlStyle); styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(styleUrlDictionary[id]); contentStringBuilder.AppendLine(@"<Polygon>"); contentStringBuilder.AppendLine(extrudeString); contentStringBuilder.AppendLine(tessellateString); contentStringBuilder.AppendLine(altitudeModeString); bool firstCoordinates = true; foreach (ScreenPointF[] screenPoint in screenPoints) { if (firstCoordinates) { contentStringBuilder.AppendLine(@"<outerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</outerBoundaryIs>"); firstCoordinates = false; } else { contentStringBuilder.AppendLine(@"<innerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</innerBoundaryIs>"); } } contentStringBuilder.AppendLine(@"</Polygon>"); contentStringBuilder.AppendLine(@"</Placemark>"); foreach (ScreenPointF[] screenPoint in screenPoints) { switch (Mode) { case AltitudeMode.Absolute: case AltitudeMode.RelativeToGround: contentStringBuilder.AppendLine(@"<Placemark>"); AppendLinearRing(screenPoint, xOffset, yOffset, ZHeight, contentStringBuilder); contentStringBuilder.AppendLine(@"</Placemark>"); break; default: break; } } }
protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { //throw new NotImplementedException(); return; }
protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { screenPoint = GetScreenPoint(screenPoint); GeoPen scaledPen = GetScaledPen(outlinePen);; canvas.DrawEllipse(new ScreenPointF(screenPoint.X, screenPoint.Y), width, height, scaledPen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder); }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { foreach (ScreenPointF[] screenPointFs in screenPoints) { for (int i = 0; i < screenPointFs.Length; i++) { screenPointFs[i] = GetScreenPoint(screenPointFs[i]); } } GeoPen scaledPen = GetScaledPen(outlinePen); canvas.DrawArea(screenPoints, scaledPen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder); }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { var outline = screenPoints.FirstOrDefault(); if (outline != null) { switch (outlineDrawMode) { case OutlineDrawMode.Open: DrawLineCore(outline.Take(outline.Length - 1), outlinePen, drawingLevel, xOffset, yOffset); break; case OutlineDrawMode.Dynamic: DrawLineCore(outline.Skip(outline.Length - 3).Take(3), outlinePen, drawingLevel, xOffset, yOffset); break; case OutlineDrawMode.Sealed: DrawLineCore(outline, outlinePen, drawingLevel, xOffset, yOffset); break; case OutlineDrawMode.LineWithFill: default: base.DrawAreaCore(screenPoints, outlinePen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder); break; } } }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { //if (fillBrush == null) //{ // fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); //} int id = 0; if (fillBrush != null) { id = fillBrush.GetHashCode(); } else { id = outlinePen.GetHashCode(); fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); } if (!_styleUrlDictionary.ContainsKey(id)) { string kmlStyle = GetPolygonStyleKml(id, outlinePen, ((GeoSolidBrush)fillBrush).Color); _kmlBuilder.Append(kmlStyle); _styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(_styleUrlDictionary[id]); contentStringBuilder.AppendLine(@"<Polygon>"); contentStringBuilder.AppendLine(_extrudeString); contentStringBuilder.AppendLine(_tessellateString); contentStringBuilder.AppendLine(_altitudeModeString); bool firstCoordinates = true; foreach (ScreenPointF[] screenPoint in screenPoints) { if (firstCoordinates) { contentStringBuilder.AppendLine(@"<outerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</outerBoundaryIs>"); firstCoordinates = false; } else { contentStringBuilder.AppendLine(@"<innerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</innerBoundaryIs>"); } } contentStringBuilder.AppendLine(@"</Polygon>"); contentStringBuilder.AppendLine(@"</Placemark>"); }