Stop() public method

public Stop ( ) : void
return void
Esempio n. 1
0
        public static List <VertexStore> CombinePaths(VertexStoreSnap a, VertexStoreSnap b, VxsClipperType vxsClipType, bool separateIntoSmallSubPaths)
        {
            ClipType clipType = (ClipType)vxsClipType;
            List <List <IntPoint> > aPolys = CreatePolygons(a);
            List <List <IntPoint> > bPolys = CreatePolygons(b);
            Clipper clipper = new Clipper();

            clipper.AddPaths(aPolys, PolyType.ptSubject, true);
            clipper.AddPaths(bPolys, PolyType.ptClip, true);
            List <List <IntPoint> > intersectedPolys = new List <List <IntPoint> >();

            clipper.Execute(clipType, intersectedPolys);
            List <VertexStore> resultList = new List <VertexStore>();
            PathWriter         output     = new PathWriter();

            if (separateIntoSmallSubPaths)
            {
                foreach (List <IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        output.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                output.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }

                        output.CloseFigure();
                        resultList.Add(output.Vxs);
                        //---
                        //clear
                        output.ClearAndStartNewVxs();
                    }
                }
            }
            else
            {
                foreach (List <IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        output.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                output.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }
                        output.CloseFigure();
                    }

                    //bool first = true;
                    //foreach (IntPoint point in polygon)
                    //{
                    //    if (first)
                    //    {
                    //        output.AddVertex(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandMoveTo);
                    //        first = false;
                    //    }
                    //    else
                    //    {
                    //        output.AddVertex(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandLineTo);
                    //    }
                    //}
                }

                output.Stop();
                resultList.Add(output.Vxs);
            }

            return(resultList);
        }
Esempio n. 2
0
        public static List <VertexStore> CombinePaths(VertexStoreSnap a, VertexStoreSnap b, VxsClipperType vxsClipType, bool separateIntoSmallSubPaths)
        {
            //TODO: optimize here

            ClipType clipType = (ClipType)vxsClipType;
            List <List <IntPoint> > aPolys = CreatePolygons(a);
            List <List <IntPoint> > bPolys = CreatePolygons(b);
            Clipper clipper = new Clipper();

            clipper.AddPaths(aPolys, PolyType.ptSubject, true);
            clipper.AddPaths(bPolys, PolyType.ptClip, true);
            List <List <IntPoint> > intersectedPolys = new List <List <IntPoint> >();

            clipper.Execute(clipType, intersectedPolys);
            List <VertexStore> resultList = new List <VertexStore>();

            PathWriter outputPathWriter = new PathWriter();

            if (separateIntoSmallSubPaths)
            {
                foreach (List <IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        outputPathWriter.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                outputPathWriter.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }

                        outputPathWriter.CloseFigure();
                        resultList.Add(outputPathWriter.Vxs);
                        //---
                        //clear
                        outputPathWriter.ClearAndStartNewVxs(new VertexStore());
                    }
                }
            }
            else
            {
                foreach (List <IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        outputPathWriter.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                outputPathWriter.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }
                        outputPathWriter.CloseFigure();
                    }
                }

                //TODO: review here
                outputPathWriter.Stop();
                resultList.Add(outputPathWriter.Vxs);
            }

            return(resultList);
        }
Esempio n. 3
0
        public static List<VertexStore> CombinePaths(VertexStoreSnap a, VertexStoreSnap b, VxsClipperType vxsClipType, bool separateIntoSmallSubPaths)
        {
            ClipType clipType = (ClipType)vxsClipType;
            List<List<IntPoint>> aPolys = CreatePolygons(a);
            List<List<IntPoint>> bPolys = CreatePolygons(b);
            Clipper clipper = new Clipper();
            clipper.AddPaths(aPolys, PolyType.ptSubject, true);
            clipper.AddPaths(bPolys, PolyType.ptClip, true);
            List<List<IntPoint>> intersectedPolys = new List<List<IntPoint>>();
            clipper.Execute(clipType, intersectedPolys);
            List<VertexStore> resultList = new List<VertexStore>();

            PathWriter output = new PathWriter();
            if (separateIntoSmallSubPaths)
            {
                foreach (List<IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        output.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                output.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }

                        output.CloseFigure();
                        resultList.Add(output.Vxs);
                        //---
                        //clear 
                        output.ClearAndStartNewVxs(new VertexStore());
                    }
                }
            }
            else
            {
                foreach (List<IntPoint> polygon in intersectedPolys)
                {
                    int j = polygon.Count;
                    if (j > 0)
                    {
                        //first one
                        IntPoint point = polygon[0];
                        output.MoveTo(point.X / 1000.0, point.Y / 1000.0);
                        //next others ...
                        if (j > 1)
                        {
                            for (int i = 1; i < j; ++i)
                            {
                                point = polygon[i];
                                output.LineTo(point.X / 1000.0, point.Y / 1000.0);
                            }
                        }
                        output.CloseFigure();
                    }

                    //bool first = true;
                    //foreach (IntPoint point in polygon)
                    //{
                    //    if (first)
                    //    {
                    //        output.AddVertex(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandMoveTo);
                    //        first = false;
                    //    }
                    //    else
                    //    {
                    //        output.AddVertex(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandLineTo);
                    //    }
                    //} 
                }

                output.Stop();
                resultList.Add(output.Vxs);
            }

            return resultList;
        }