public override IEnumerable <VertexData> Vertices() { Arc currentProcessingArc = new Arc() { ResolutionScale = ResolutionScale }; currentProcessingArc.init(bounds.Left + leftBottomRadius.X, bounds.Bottom + leftBottomRadius.Y, leftBottomRadius.X, leftBottomRadius.Y, Math.PI, Math.PI + Math.PI * 0.5); foreach (VertexData vertexData in currentProcessingArc.Vertices()) { if (ShapePath.is_stop(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.init(bounds.Right - rightBottomRadius.X, bounds.Bottom + rightBottomRadius.Y, rightBottomRadius.X, rightBottomRadius.Y, Math.PI + Math.PI * 0.5, 0.0); foreach (VertexData vertexData in currentProcessingArc.Vertices()) { if (ShapePath.is_move_to(vertexData.command)) { // skip the initial moveto continue; } if (ShapePath.is_stop(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.init(bounds.Right - rightTopRadius.X, bounds.Top - rightTopRadius.Y, rightTopRadius.X, rightTopRadius.Y, 0.0, Math.PI * 0.5); foreach (VertexData vertexData in currentProcessingArc.Vertices()) { if (ShapePath.is_move_to(vertexData.command)) { // skip the initial moveto continue; } if (ShapePath.is_stop(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.init(bounds.Left + leftTopRadius.X, bounds.Top - leftTopRadius.Y, leftTopRadius.X, leftTopRadius.Y, Math.PI * 0.5, Math.PI); foreach (VertexData vertexData in currentProcessingArc.Vertices()) { if (ShapePath.is_move_to(vertexData.command)) { // skip the initial moveto continue; } if (ShapePath.is_stop(vertexData.command)) { break; } yield return(vertexData); } yield return(new VertexData(ShapePath.FlagsAndCommand.EndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW, new Vector2())); yield return(new VertexData(ShapePath.FlagsAndCommand.Stop, new Vector2())); }
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); }