public static SharpDXVectorStyle FromVectorStyle(RenderTarget rt, Factory f, VectorStyle vs) { var res = new SharpDXVectorStyle { // Global Enabled = vs.Enabled, MinVisible = vs.MinVisible, MaxVisible = vs.MaxVisible, }; // Point if (vs.PointColor != null) { res.PointColor = Converter.ToSharpDXBrush(rt, vs.PointColor); res.PointSize = vs.PointSize; } if (vs.Symbol != null) { res.Symbol = Converter.ToSharpDXBitmap(rt, vs.Symbol as System.Drawing.Bitmap, vs.SymbolScale); res.SymbolOffset = Converter.ToSharpDXPoint(vs.SymbolOffset); //res.SymbolScale = vs.SymbolScale; res.SymbolRotation = vs.SymbolRotation; } // Line if (vs.Line != null) { res.Line = Converter.ToSharpDXBrush(rt, vs.Line.Brush); res.LineWidth = vs.Line.Width; res.LineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line); res.LineOffset = vs.LineOffset; } if (vs.Outline != null) { res.EnableOutline = vs.EnableOutline; res.Outline = Converter.ToSharpDXBrush(rt, vs.Outline.Brush); res.OutlineWidth = vs.Outline.Width; res.OutlineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line); } // Fill if (vs.Fill != null) { res.Fill = Converter.ToSharpDXBrush(rt, vs.Fill); } return res; }
public static SharpDXVectorStyle FromVectorStyle(RenderTarget rt, Factory f, VectorStyle vs) { var res = new SharpDXVectorStyle { // Global Enabled = vs.Enabled, MinVisible = vs.MinVisible, MaxVisible = vs.MaxVisible, }; // Point if (vs.PointColor != null) { res.PointColor = Converter.ToSharpDXBrush(rt, vs.PointColor); res.PointSize = vs.PointSize; } if (vs.Symbol != null) { res.Symbol = Converter.ToSharpDXBitmap(rt, vs.Symbol as System.Drawing.Bitmap, vs.SymbolScale); res.SymbolOffset = Converter.ToSharpDXPoint(vs.SymbolOffset); //res.SymbolScale = vs.SymbolScale; res.SymbolRotation = vs.SymbolRotation; } // Line if (vs.Line != null) { res.Line = Converter.ToSharpDXBrush(rt, vs.Line.Brush); res.LineWidth = vs.Line.Width; res.LineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line); res.LineOffset = vs.LineOffset; } if (vs.Outline != null) { res.EnableOutline = vs.EnableOutline; res.Outline = Converter.ToSharpDXBrush(rt, vs.Outline.Brush); res.OutlineWidth = vs.Outline.Width; res.OutlineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line); } // Fill if (vs.Fill != null) { res.Fill = Converter.ToSharpDXBrush(rt, vs.Fill); } return(res); }
private void RenderGeometry(D2D1.Factory factory, D2D1.RenderTarget g, Map map, IGeometry feature, SharpDXVectorStyle style) { if (feature == null) return; var geometryType = feature.OgcGeometryType; switch (geometryType) { case OgcGeometryType.Polygon: if (style.EnableOutline) SharpDXVectorRenderer.DrawPolygon(g, factory, (IPolygon)feature, style.Fill, style.Outline, style.OutlineWidth, style.OutlineStrokeStyle, ClippingEnabled, map); else SharpDXVectorRenderer.DrawPolygon(g, factory, (IPolygon)feature, style.Fill, null, 0f, null, ClippingEnabled, map); break; case OgcGeometryType.MultiPolygon: if (style.EnableOutline) SharpDXVectorRenderer.DrawMultiPolygon(g, factory, (IMultiPolygon)feature, style.Fill, style.Outline, style.OutlineWidth, style.OutlineStrokeStyle, ClippingEnabled, map); else SharpDXVectorRenderer.DrawMultiPolygon(g, factory, (IMultiPolygon)feature, style.Fill, null, 0f, null, ClippingEnabled, map); break; case OgcGeometryType.LineString: SharpDXVectorRenderer.DrawLineString(g, factory, (ILineString)feature, style.Line, style.LineWidth, style.LineStrokeStyle, map, style.LineOffset); return; case OgcGeometryType.MultiLineString: SharpDXVectorRenderer.DrawMultiLineString(g, factory, (IMultiLineString)feature, style.Line, style.LineWidth, style.LineStrokeStyle, map, style.LineOffset); break; case OgcGeometryType.Point: if (style.Symbol != null || style.PointColor == null) { SharpDXVectorRenderer.DrawPoint(g, factory, (IPoint)feature, style.Symbol, style.SymbolOffset, style.SymbolRotation, map); return; } SharpDXVectorRenderer.DrawPoint(g, factory, (IPoint)feature, style.PointColor, style.PointSize, style.SymbolOffset, map); break; case OgcGeometryType.MultiPoint: if (style.Symbol != null || style.PointColor == null) { SharpDXVectorRenderer.DrawMultiPoint(g, factory, (IMultiPoint)feature, style.Symbol, style.SymbolOffset, style.SymbolRotation, map); } else { SharpDXVectorRenderer.DrawMultiPoint(g, factory, (IMultiPoint)feature, style.PointColor, style.PointSize, style.SymbolOffset, map); } break; case OgcGeometryType.GeometryCollection: var coll = (IGeometryCollection)feature; for (var i = 0; i < coll.NumGeometries; i++) { IGeometry geom = coll[i]; RenderGeometry(factory, g, map, geom, style); } break; default: lock (_syncRoot) _logger.Debug( fmh => fmh("Unhandled geometry: {0}", feature.OgcGeometryType)); break; } }