예제 #1
0
 private void DrawMultiLineString(MultiLineString mLine, DrawingStyle style, ViewInfo viewInfo, Graphics g)
 {
     foreach (var line in mLine.Geometries)
     {
         DrawLineString(line, style, viewInfo, g);
     }
 }
예제 #2
0
 private void DrawMultiPolygon(MultiPolygon mPolygon, DrawingStyle style, ViewInfo viewInfo, Graphics g)
 {
     foreach (var polygon in mPolygon.Geometries)
     {
         DrawPolygon(polygon, style, viewInfo, g);
     }
 }
예제 #3
0
        private void DrawPolygon(Polygon polygon, DrawingStyle style, ViewInfo viewInfo, Graphics g)
        {
            if (style.StrokePen != null || style.FillBrush != null)
            {
                var p = viewInfo.RingToPointFList(polygon.ExteriorRing);

                var path = new GraphicsPath(FillMode.Winding);

                //Draw external ring
                path.AddPolygon(p);

                //Cut out inner polygons
                int numRings = polygon.InteriorRings.Count;
                for (int i = 0; i < numRings; i++)
                {
                    p = viewInfo.RingToPointFList(polygon.InteriorRings[i]);
                    path.AddPolygon(p);
                }

                if (style.FillBrush != null)
                {
                    g.FillPath(style.FillBrush, path);
                }

                if (style.StrokePen != null)
                {
                    g.DrawPath(style.StrokePen, path);
                }
            }
        }
예제 #4
0
 private void DrawLineString(LineString line, DrawingStyle style, ViewInfo viewInfo, Graphics g)
 {
     if (style.StrokePen != null)
     {
         g.DrawLines(style.StrokePen, viewInfo.RingToPointFList(line.Vertices));
     }
 }
예제 #5
0
 private void DrawMutiPoint(MultiPoint mPoint, DrawingStyle style, ViewInfo viewInfo, Graphics g)
 {
     foreach (var point in mPoint.Geometries)
     {
         var p = viewInfo.LatLongToPointF(point.Coordinate);
         DrawPoint(p, style, g);
     }
 }
예제 #6
0
        private void DrawGeometery(Geometry geom, Dictionary <string, DrawingStyle> styles, ViewInfo viewInfo, Graphics g)
        {
            DrawingStyle s = null;

            if (styles != null && !string.IsNullOrEmpty(geom.StyleKey) && styles.ContainsKey(geom.StyleKey))
            {
                s = styles[geom.StyleKey];
            }
            else if (_defaultStyle != null)
            {
                s = _defaultStyle;
            }

            DrawGeometery(geom, s, viewInfo, g);
        }
        private void DrawGeometery(Geometry geom, DrawingStyle style, ViewInfo viewInfo, Graphics g)
        {
            if (style != null)
            {
                switch (geom.STGeometryType())
                {
                case GeometryType.Point:
                    DrawPoint(geom as Point, style, viewInfo, g);
                    break;

                case GeometryType.LineString:
                    DrawLineString(geom as LineString, style, viewInfo, g);
                    break;

                case GeometryType.Polygon:
                    DrawPolygon(geom as Polygon, style, viewInfo, g);
                    break;

                case GeometryType.MultiPoint:
                    DrawMutiPoint(geom as MultiPoint, style, viewInfo, g);
                    break;

                case GeometryType.MultiLineString:
                    DrawMultiLineString(geom as MultiLineString, style, viewInfo, g);
                    break;

                case GeometryType.MultiPolygon:
                    DrawMultiPolygon(geom as MultiPolygon, style, viewInfo, g);
                    break;

                case GeometryType.GeometryCollection:
                    int numGeoms = geom.STNumGeometries();
                    var gc       = geom as GeometryCollection;
                    for (int i = 1; i <= numGeoms; i++)
                    {
                        DrawGeometery(gc.Geometries[i], style, viewInfo, g);
                    }
                    break;

                default:
                    break;
                }
            }
        }
예제 #8
0
        private void DrawPoint(PointF point, DrawingStyle style, Graphics g)
        {
            if (style != null && point != null)
            {
                if (style.Icon != null)
                {
                    var x = (float)(point.X - style.Icon.Width / 2);
                    var y = (float)(point.Y - style.Icon.Height / 2);

                    g.DrawImage(style.Icon, x, y);
                }
                else if (style.IconBrush != null)
                {
                    g.FillEllipse(style.IconBrush, point.X - 15, point.Y - 15, 30, 30);

                    if (style.StrokePen != null)
                    {
                        g.DrawEllipse(style.StrokePen, point.X - 15, point.Y - 15, 30, 30);
                    }
                }
            }
        }
예제 #9
0
 public SpatialDataRenderEngine(DrawingStyle defaultStyle, bool isHighSpeed)
 {
     _defaultStyle = defaultStyle;
     _isHighSpeed  = isHighSpeed;
 }
예제 #10
0
 public SpatialDataRenderEngine(DrawingStyle defaultStyle)
 {
     _defaultStyle = defaultStyle;
 }
예제 #11
0
 public SpatialDataRenderEngine(ShapeStyle defaultStyle, bool isHighSpeed)
 {
     _defaultStyle = new DrawingStyle(defaultStyle);
     _isHighSpeed  = isHighSpeed;
 }
예제 #12
0
 public SpatialDataRenderEngine(ShapeStyle defaultStyle)
 {
     _defaultStyle = new DrawingStyle(defaultStyle);
 }
예제 #13
0
 private void DrawPoint(Point point, DrawingStyle style, ViewInfo viewInfo, Graphics g)
 {
     DrawPoint(viewInfo.LatLongToPointF(point.Coordinate), style, g);
 }