Esempio n. 1
0
        private void AddPolygonRing(WriteableBitmap context, SqlGeometry polygon, Func <Point, Point> transform, int border, int fill)
        {
            int numberOfPoints = polygon.STNumPoints().Value;

            int[] points = new int[2 * numberOfPoints];

            //STPointN(index): index is between 1 and number of points
            for (int i = 0; i < numberOfPoints; i++)
            {
                var point = transform(polygon.STPointN(i + 1).AsWpfPoint());

                points[2 * i] = (int)point.X;

                points[2 * i + 1] = (int)point.Y;
            }

            //if (border.HasValue)
            //{
            WriteableBitmapExtensions.DrawPolylineAa(context, points, border);
            //}

            //if (fill.HasValue)
            //{
            WriteableBitmapExtensions.FillPolygon(context, points, fill);
            //}
        }