Exemple #1
0
        private void Append(PolygonGraphicsPath poly, Coordinate[] coords)
        {
            GraphicsPath ring = null;

            for (var i = 0; i < coords.Length; i++)
            {
                _transPoint = TransformPoint(coords[i], _transPoint);
                poly.AddToRing(_transPoint, ref ring);
            }
            poly.EndRing(ring);
        }
Exemple #2
0
        private void AppendRing(PolygonGraphicsPath poly, Coordinate[] coords)
        {
            GraphicsPath ring = null;

            var prevX = Single.NaN;
            var prevY = Single.NaN;

            Coordinate prev = null;

            var n = coords.Length - 1;

            /**
             * Don't include closing point.
             * Ring path will be closed explicitly, which provides a
             * more accurate path representation.
             */
            for (var i = 0; i <= n; i++)
            {
                if (Decimation > 0.0)
                {
                    var isDecimated = prev != null &&
                                      Math.Abs(coords[i].X - prev.X) < Decimation &&
                                      Math.Abs(coords[i].Y - prev.Y) < Decimation;
                    if (isDecimated)
                    {
                        continue;
                    }
                    prev = coords[i];
                }

                var transPoint = TransformPoint(coords[i]);

                if (RemoveDuplicatePoints)
                {
                    // skip duplicate points (except the last point)
                    var isDup = transPoint.X == prevX && transPoint.Y == prevY;
                    if (isDup)
                    {
                        continue;
                    }
                    prevX = transPoint.X;
                    prevY = transPoint.Y;
                }
                poly.AddToRing(transPoint, ref ring);
            }
            // handle closing point
            poly.EndRing(ring);
        }
 private void Append(PolygonGraphicsPath poly, Coordinate[] coords)
 {
     GraphicsPath ring = null;
     for (var i = 0; i < coords.Length; i++)
     {
         _transPoint = TransformPoint(coords[i], _transPoint);
         poly.AddToRing(_transPoint, ref ring);
     }
     poly.EndRing(ring);
 }
        private void AppendRing(PolygonGraphicsPath poly, Coordinate[] coords)
        {
            GraphicsPath ring = null;

            var prevX = Single.NaN;
            var prevY = Single.NaN;
            
            Coordinate prev = null;
    
            var n = coords.Length - 1;
            /**
             * Don't include closing point.
             * Ring path will be closed explicitly, which provides a 
             * more accurate path representation.
             */
            for (var i = 0; i <= n; i++) 
            {
                if (Decimation > 0.0)
                {
                    var isDecimated = prev != null 
                        && Math.Abs(coords[i].X - prev.X) < Decimation
                        && Math.Abs(coords[i].Y - prev.Y) < Decimation;
                    if (isDecimated) 
                        continue;
                    prev = coords[i];
                }
		  
                var transPoint = TransformPoint(coords[i]);
			
                if (RemoveDuplicatePoints)
                {
                    // skip duplicate points (except the last point)
                    var isDup = transPoint.X == prevX && transPoint.Y == prevY;
                    if (isDup)
                    {
                        continue;
                    }
                    prevX = transPoint.X;
                    prevY = transPoint.Y;
                }
                poly.AddToRing(transPoint, ref ring);
            }
            // handle closing point
            poly.EndRing(ring);
        }