private void Accumulate(ref uint cmd, ref double x, ref double y) { _generator.RemoveAll(); _generator.AddVertex(_startX, _startY, (uint)Path.EPathCommands.MoveTo); _markers.AddVertex(_startX, _startY, (uint)Path.EPathCommands.MoveTo); for (; ;) { cmd = _source.Vertex(out x, out y); if (Path.IsVertex(cmd)) { _lastCommand = cmd; if (Path.IsMoveTo(cmd)) { _startX = x; _startY = y; break; } _generator.AddVertex(x, y, cmd); _markers.AddVertex(x, y, (uint)Path.EPathCommands.LineTo); } else { if (Path.IsStop(cmd)) { _lastCommand = (uint)Path.EPathCommands.Stop; break; } if (Path.IsEndPoly(cmd)) { _generator.AddVertex(x, y, cmd); break; } } } _generator.Rewind(0); _status = EStatus.Generate; }
public ShapePath.FlagsAndCommand vertex(out double x, out double y) { x = 0; y = 0; ShapePath.FlagsAndCommand command = ShapePath.FlagsAndCommand.CommandStop; bool done = false; while (!done) { switch (m_status) { case status.initial: markers.remove_all(); m_last_cmd = VertexSource.vertex(out m_start_x, out m_start_y); m_status = status.accumulate; goto case status.accumulate; case status.accumulate: if (ShapePath.is_stop(m_last_cmd)) { return(ShapePath.FlagsAndCommand.CommandStop); } generator.RemoveAll(); generator.AddVertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.CommandMoveTo); markers.add_vertex(m_start_x, m_start_y, ShapePath.FlagsAndCommand.CommandMoveTo); for (; ;) { command = VertexSource.vertex(out x, out y); //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n"); if (ShapePath.is_vertex(command)) { m_last_cmd = command; if (ShapePath.is_move_to(command)) { m_start_x = x; m_start_y = y; break; } generator.AddVertex(x, y, command); markers.add_vertex(x, y, ShapePath.FlagsAndCommand.CommandLineTo); } else { if (ShapePath.is_stop(command)) { m_last_cmd = ShapePath.FlagsAndCommand.CommandStop; break; } if (ShapePath.is_end_poly(command)) { generator.AddVertex(x, y, command); break; } } } generator.Rewind(0); m_status = status.generate; goto case status.generate; case status.generate: command = generator.Vertex(ref x, ref y); //DebugFile.Print("x=" + x.ToString() + " y=" + y.ToString() + "\n"); if (ShapePath.is_stop(command)) { m_status = status.accumulate; break; } done = true; break; } } return(command); }