Reset() 공개 메소드

public Reset ( ) : void
리턴 void
예제 #1
0
        public VertexStore MakeVxs(VertexStoreSnap vsnap)
        {
            VertexStore vxs = new VertexStore();

            m_curve3.Reset();
            m_curve4.Reset();
            var            snapIter = vsnap.GetVertexSnapIter();
            CurvePointMode latestCurveMode = CurvePointMode.NotCurve;
            double         x, y;
            VertexCmd      cmd;

            VectorMath.Vector2 c3p2      = new VectorMath.Vector2();
            VectorMath.Vector2 c4p2      = new VectorMath.Vector2();
            VectorMath.Vector2 c4p3      = new VectorMath.Vector2();
            double             lastX     = 0;
            double             lasty     = 0;
            double             lastMoveX = 0;
            double             lastMoveY = 0;

            do
            {
                //this vertex
                cmd = snapIter.GetNextVertex(out x, out y);
                switch (cmd)
                {
                case VertexCmd.P2c:
                {
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                    }
                    break;

                    case CurvePointMode.NotCurve:
                    {
                        c3p2.x = x;
                        c3p2.y = y;
                    }
                    break;

                    default:
                    {
                    }
                    break;
                    }
                    latestCurveMode = CurvePointMode.P2;
                }
                break;

                case VertexCmd.P3c:
                {
                    //this is p3c
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                        c3p2.x = x;
                        c3p2.y = y;
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                        // vxs.AddVertex(x, y, cmd);
                        c4p3.x = x;
                        c4p3.y = y;
                        //m_curve4.MakeLines(vxs,
                        //    lastX, lasty,
                        //    c3p2.X, c3p2.Y,
                        //    c4p2.x, c4p2.y,
                        //    x, y);

                        // vxs.AddVertex(x, y, cmd);
                    }
                    break;

                    case CurvePointMode.NotCurve:
                    {
                        c4p2.x = x;
                        c4p2.y = y;
                    }
                    break;
                    }
                    latestCurveMode = CurvePointMode.P3;
                }
                break;

                case VertexCmd.LineTo:
                {
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                        m_curve3.MakeLines(vxs,
                                           lastX,
                                           lasty,
                                           c3p2.X,
                                           c3p2.Y,
                                           x,
                                           y);
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                        //from curve4
                        // vxs.AddVertex(x, y, cmd);
                        m_curve4.MakeLines(vxs,
                                           lastX, lasty,
                                           c4p2.x, c4p2.y,
                                           c4p3.x, c4p3.y,
                                           x, y);
                    }
                    break;

                    default:
                    {
                        vxs.AddVertex(x, y, cmd);
                    }
                    break;
                    }
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastX           = x;
                    lasty           = y;
                    //-----------
                }
                break;

                case VertexCmd.MoveTo:
                {
                    //move to, and end command
                    vxs.AddVertex(x, y, cmd);
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastMoveX       = lastX = x;
                    lastMoveY       = lasty = y;
                    //-----------
                }
                break;

                case VertexCmd.CloseAndEndFigure:
                {
                    latestCurveMode = CurvePointMode.NotCurve;
                    vxs.AddVertex(x, y, cmd);
                    //move to begin
                    lastX = lastMoveX;
                    lasty = lastMoveY;
                }
                break;

                case VertexCmd.EndFigure:
                {
                    latestCurveMode = CurvePointMode.NotCurve;
                    vxs.AddVertex(x, y, cmd);
                }
                break;

                default:
                {
                    //move to, and end command
                    vxs.AddVertex(x, y, cmd);
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastX           = x;
                    lasty           = y;
                    //-----------
                }
                break;
                }
            } while (cmd != VertexCmd.Stop);
            return(vxs);
        }
예제 #2
0
        public void MakeVxs(VertexStoreSnap vsnap, VertexStore vxs)
        {
            m_curve3.Reset();
            m_curve4.Reset();
            var            snapIter = vsnap.GetVertexSnapIter();
            CurvePointMode latestCurveMode = CurvePointMode.NotCurve;
            double         x, y;
            VertexCmd      cmd;

            VectorMath.Vector2 c3p2      = new VectorMath.Vector2();
            VectorMath.Vector2 c4p2      = new VectorMath.Vector2();
            VectorMath.Vector2 c4p3      = new VectorMath.Vector2();
            double             lastX     = 0;
            double             lasty     = 0;
            double             lastMoveX = 0;
            double             lastMoveY = 0;


            do
            {
                //this vertex
                cmd = snapIter.GetNextVertex(out x, out y);
#if DEBUG
                if (VertexStore.dbugCheckNANs(x, y))
                {
                    int dbugIter = snapIter.dbugIterIndex;
                }

                //if (VertexStore.dbugCheckIfNAN(x, y))
                //{
                //
                //}
#endif
                switch (cmd)
                {
                case VertexCmd.P2c:
                {
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                    }
                    break;

                    case CurvePointMode.NotCurve:
                    {
                        c3p2.x = x;
                        c3p2.y = y;
                    }
                    break;

                    default:
                    {
                    }
                    break;
                    }
                    latestCurveMode = CurvePointMode.P2;
                }
                break;

                case VertexCmd.P3c:
                {
                    //this is p3c
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                        c3p2.x = x;
                        c3p2.y = y;
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                        c4p3.x = x;
                        c4p3.y = y;
                    }
                    break;

                    case CurvePointMode.NotCurve:
                    {
                        c4p2.x = x;
                        c4p2.y = y;
                    }
                    break;
                    }
                    latestCurveMode = CurvePointMode.P3;
                }
                break;

                case VertexCmd.LineTo:
                {
                    switch (latestCurveMode)
                    {
                    case CurvePointMode.P2:
                    {
                        m_curve3.MakeLines(vxs,
                                           lastX,
                                           lasty,
                                           c3p2.X,
                                           c3p2.Y,
                                           x,
                                           y);
                    }
                    break;

                    case CurvePointMode.P3:
                    {
                        m_curve4.MakeLines(vxs,
                                           lastX, lasty,
                                           c4p2.x, c4p2.y,
                                           c4p3.x, c4p3.y,
                                           x, y);
                    }
                    break;

                    default:
                    {
                        vxs.AddVertex(x, y, cmd);
                    }
                    break;
                    }
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastX           = x;
                    lasty           = y;
                    //-----------
                }
                break;

                case VertexCmd.MoveTo:
                {
                    //move to, and end command
                    vxs.AddVertex(x, y, cmd);
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastMoveX       = lastX = x;
                    lastMoveY       = lasty = y;
                    //-----------
                }
                break;

                case VertexCmd.Close:
                case VertexCmd.CloseAndEndFigure:
                {
                    latestCurveMode = CurvePointMode.NotCurve;
                    vxs.AddVertex(x, y, cmd);
                    //move to begin
                    lastX = lastMoveX;
                    lasty = lastMoveY;
                }
                break;

                default:
                {
                    //move to, and end command
                    vxs.AddVertex(x, y, cmd);
                    //-----------
                    latestCurveMode = CurvePointMode.NotCurve;
                    lastX           = x;
                    lasty           = y;
                    //-----------
                }
                break;
                }
            } while (cmd != VertexCmd.NoMore);
        }