Example #1
0
        // Vertex Source Interface
        void RewindZero()
        {
            if (m_status == StrokeMath.Status.Init)
            {
                vertexDistanceList.Close(true);
                if (m_auto_detect)
                {
                    if (m_orientation == EndVertexOrientation.Unknown)
                    {
                        m_orientation = (AggMath.CalculatePolygonArea(vertexDistanceList) > 0.0) ?
                                        EndVertexOrientation.CCW :
                                        EndVertexOrientation.CW;
                    }
                }
                switch (m_orientation)
                {
                case EndVertexOrientation.CCW:
                {
                    m_stroker.Width = m_width;
                }
                break;

                case EndVertexOrientation.CW:
                {
                    m_stroker.Width = -m_width;
                }
                break;
                }
            }
            m_status     = StrokeMath.Status.Ready;
            m_src_vertex = 0;
        }
        public void AddVertex(double x, double y, VertexCmd cmd)
        {
            m_status = StrokeMath.Status.Init;
            switch (cmd)
            {
            case VertexCmd.MoveTo:
                vertexDistanceList.ReplaceLast(new VertexDistance(x, y));
                break;

            case VertexCmd.Close:
            case VertexCmd.CloseAndEndFigure:
            {
                //end and close
                m_closed = true;
                if (m_orientation == EndVertexOrientation.Unknown)
                {
                    switch ((int)x)
                    {
                    case 1:
                    case 2:
                    {
                        m_orientation = (EndVertexOrientation)x;
                    }
                    break;
                    }
                }
            }
            break;

            default:

                vertexDistanceList.AddVertex(new VertexDistance(x, y));
                break;
            }
        }
Example #3
0
 public ContourGenerator()
 {
     m_stroker          = new StrokeMath();
     m_width            = 1;
     vertexDistanceList = new VertexDistanceList();
     m_out_vertices     = new VertexStore();
     m_status           = StrokeMath.Status.Init;
     m_src_vertex       = 0;
     m_closed           = false;
     m_orientation      = 0;
     m_auto_detect      = false;
 }
 public ContourGenerator()
 {
     m_stroker = new StrokeMath();
     m_width = 1;
     vertexDistanceList = new VertexDistanceList();
     m_out_vertices = new VertexStore();
     m_status = StrokeMath.Status.Init;
     m_src_vertex = 0;
     m_closed = false;
     m_orientation = 0;
     m_auto_detect = false;
 }
        public void AddVertex(double x, double y, VertexCmd cmd)
        {
            m_status = StrokeMath.Status.Init;
            switch (cmd)
            {
                case VertexCmd.MoveTo:
                    vertexDistanceList.ReplaceLast(new VertexDistance(x, y));
                    break;
                case VertexCmd.CloseAndEndFigure:
                    {
                        //end and close
                        m_closed = true;
                        if (m_orientation == EndVertexOrientation.Unknown)
                        {
                            switch ((int)x)
                            {
                                case 1:
                                case 2:
                                    {
                                        m_orientation = (EndVertexOrientation)x;
                                    }
                                    break;
                            }
                        }
                    }
                    break;
                case VertexCmd.EndFigure:

                    //end not close 
                    if (m_orientation == EndVertexOrientation.Unknown)
                    {
                        switch ((int)x)
                        {
                            case 1:
                            case 2:
                                {
                                    m_orientation = (EndVertexOrientation)x;
                                }
                                break;
                        }
                    }
                    break;
                default:

                    vertexDistanceList.AddVertex(new VertexDistance(x, y));
                    break;
            }
        }
 // Vertex Source Interface
 void RewindZero()
 {
     if (m_status == StrokeMath.Status.Init)
     {
         vertexDistanceList.Close(true);
         if (m_auto_detect)
         {
             if (m_orientation == EndVertexOrientation.Unknown)
             {
                 m_orientation = (AggMath.CalculatePolygonArea(vertexDistanceList) > 0.0) ?
                                 EndVertexOrientation.CCW :
                                 EndVertexOrientation.CW;
             }
         }
         switch (m_orientation)
         {
             case EndVertexOrientation.CCW:
                 {
                     m_stroker.Width = m_width;
                 }
                 break;
             case EndVertexOrientation.CW:
                 {
                     m_stroker.Width = -m_width;
                 }
                 break;
         }
     }
     m_status = StrokeMath.Status.Ready;
     m_src_vertex = 0;
 }