SuperMap.WindowsPhone.Core.FeatureElement.BuildGeoRegion C# (CSharp) Method

BuildGeoRegion() private method

private BuildGeoRegion ( SuperMap geoRegion ) : System.Windows.Media.PathGeometry
geoRegion SuperMap
return System.Windows.Media.PathGeometry
        private PathGeometry BuildGeoRegion(SuperMap.WindowsPhone.Core.GeoRegion geoRegion)
        {
            PathGeometry geometry = new System.Windows.Media.PathGeometry();
            PathFigure figure = null;
            Rectangle2D bounds = geoRegion.Bounds;
            if (!Rectangle2D.IsNullOrEmpty(bounds))
            {
                Point topLeft = this.MapPointToScreen(new Point2D(bounds.Left, bounds.Top));
                foreach (Point2DCollection points in geoRegion.Parts)
                {
                    if (points.Count >= 3)
                    {
                        figure = new PathFigure();
                        //是否要再加一次第一个点。
                        //figure.IsClosed = true;
                        Point point = this.MapPointToScreen(points[0]);
                        point.X -= topLeft.X;
                        point.Y -= topLeft.Y;
                        figure.StartPoint = point;
                        for (int i = 1; i < points.Count; i++)
                        {
                            point = this.MapPointToScreen(points[i]);
                            point.X -= topLeft.X;
                            point.Y -= topLeft.Y;
                            figure.Segments.Add(new LineSegment { Point = point });
                        }
                        geometry.Figures.Add(figure);
                    }
                }
            }
            geometry.Transform = new ScaleTransform();
            return geometry;
        }