Exemplo n.º 1
0
        private void VerifyPoints(PointF[] expectedPoints, IPath path)
        {
            ISimplePath simplePath = Assert.Single(path.Flatten());

            Assert.True(simplePath.IsClosed);
            Assert.Equal(expectedPoints, simplePath.Points.ToArray());
        }
        private void VerifyPoints(PointF[] expectedPoints, IPath path)
        {
            Path                   innerPath     = Assert.IsType <Path>(path);
            ILineSegment           segment       = Assert.Single(innerPath.LineSegments);
            CubicBezierLineSegment bezierSegment = Assert.IsType <CubicBezierLineSegment>(segment);

            Assert.Equal(expectedPoints, bezierSegment.ControlPoints.ToArray());

            ISimplePath simplePath = Assert.Single(path.Flatten());

            Assert.False(simplePath.IsClosed);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="clippingType">Type of the poly.</param>
        /// <exception cref="ClipperException">AddPath: Open paths have been disabled.</exception>
        internal void AddPath(ISimplePath path, ClippingType clippingType)
        {
            var             vectors = path.Points;
            List <IntPoint> points  = new List <ClipperLib.IntPoint>(vectors.Length);

            foreach (var v in vectors)
            {
                points.Add(new IntPoint(v.X * ScalingFactor, v.Y * ScalingFactor));
            }

            PolyType type = clippingType == ClippingType.Clip ? PolyType.ptClip : PolyType.ptSubject;

            lock (this.syncRoot)
            {
                this.innerClipper.AddPath(points, type, path.IsClosed, path);
            }
        }
        /// <summary>
        /// Adds the path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="clippingType">Type of the poly.</param>
        /// <exception cref="ClipperException">AddPath: Open paths have been disabled.</exception>
        internal void AddPath(ISimplePath path, ClippingType clippingType)
        {
            IReadOnlyList <PointF> vectors = path.Points;

            var points = new List <IntPoint>(vectors.Count);

            for (int i = 0; i < vectors.Count; i++)
            {
                var v = vectors[i];
                points.Add(new IntPoint(v.X * ScalingFactor, v.Y * ScalingFactor));
            }

            var type = clippingType == ClippingType.Clip ? PolyType.ptClip : PolyType.ptSubject;

            lock (this.syncRoot)
                this.innerClipper.AddPath(points, type, path.IsClosed);
        }