diff --git a/src/main/dig/Ampel_Einfach.dig b/src/main/dig/Ampel_Einfach.dig index b6fd40b4f..0b0325b7a 100644 --- a/src/main/dig/Ampel_Einfach.dig +++ b/src/main/dig/Ampel_Einfach.dig @@ -1,5 +1,6 @@ + 1 JK_FF @@ -9,7 +10,7 @@ z_0 - + 0 @@ -20,19 +21,19 @@ z_1 - + 0 And - + 0 Const - + 0 @@ -43,7 +44,7 @@ Rot - + 0 @@ -63,7 +64,7 @@ Gelb - + 0 @@ -83,7 +84,7 @@ Grün - + 0 @@ -91,113 +92,113 @@ Label - Clock + Takt - + 0 - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + \ No newline at end of file diff --git a/src/main/dig/Ampel_Feuer.dig b/src/main/dig/Ampel_Feuer.dig index 925d96ba4..8e23f337a 100644 --- a/src/main/dig/Ampel_Feuer.dig +++ b/src/main/dig/Ampel_Feuer.dig @@ -1,16 +1,17 @@ + 1 JK_FF - + 0 JK_FF - + 0 @@ -21,13 +22,13 @@ 3 - + 0 Const - + 0 @@ -38,7 +39,7 @@ Rot - + 0 @@ -58,7 +59,7 @@ Gelb - + 0 @@ -78,7 +79,7 @@ Grün - + 0 @@ -86,10 +87,10 @@ Label - Clock + Takt - + 0 @@ -100,236 +101,232 @@ Feuer - + 0 Not - + 0 And - + 0 Or - + 0 And - + 0 Or - + 0 - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/src/main/dig/Ampel_Feuer2.dig b/src/main/dig/Ampel_Feuer2.dig index 47031f18f..b2b23277d 100644 --- a/src/main/dig/Ampel_Feuer2.dig +++ b/src/main/dig/Ampel_Feuer2.dig @@ -1,28 +1,51 @@ + 1 JK_FF - + 0 JK_FF - + 0 And - + 0 Const - + + 0 + + + Clock + + + Label + Takt + + + + 0 + + + In + + + Label + Feuer + + + 0 @@ -33,7 +56,7 @@ Rot - + 0 @@ -53,7 +76,19 @@ Gelb - + + 0 + + + Or + + + 0 + + + Not + + 0 @@ -73,152 +108,126 @@ Grün - - 0 - - - Clock - - - Label - Clock - - - - 0 - - - Or - - - 0 - - - Not - - - 0 - - - In - - - Label - Feuer - - - + 0 - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/de/neemann/digital/draw/graphics/Graphic.java b/src/main/java/de/neemann/digital/draw/graphics/Graphic.java index fe876f769..f0500c6d2 100644 --- a/src/main/java/de/neemann/digital/draw/graphics/Graphic.java +++ b/src/main/java/de/neemann/digital/draw/graphics/Graphic.java @@ -5,19 +5,53 @@ package de.neemann.digital.draw.graphics; */ public interface Graphic { + /** + * Draws a line + * + * @param p1 first point + * @param p2 second point + * @param style the line style + */ void drawLine(Vector p1, Vector p2, Style style); + /** + * Draws a polygon + * + * @param p the polygon + * @param style the style + */ void drawPolygon(Polygon p, Style style); + /** + * Draws a circle + * + * @param p1 upper left corner of outer rectangle containing the circle + * @param p2 lower right corner of outer rectangle containing the circle + * @param style the style + */ void drawCircle(Vector p1, Vector p2, Style style); + /** + * Draws text + * + * @param p1 point to draw the text + * @param p2 at the left of p1, is used to determine the correct orientation of the text after transforming coordinates + * @param text the text + * @param orientation the texts orientation + * @param style the text style + */ void drawText(Vector p1, Vector p2, String text, Orientation orientation, Style style); + /** + * opens a new group, used to create SVG grouping + */ default void openGroup() { } + /** + * closes a group, used to create SVG grouping + */ default void closeGroup() { } - ; } diff --git a/src/main/java/de/neemann/digital/draw/graphics/GraphicSVG.java b/src/main/java/de/neemann/digital/draw/graphics/GraphicSVG.java index 0bad1fe77..863782092 100644 --- a/src/main/java/de/neemann/digital/draw/graphics/GraphicSVG.java +++ b/src/main/java/de/neemann/digital/draw/graphics/GraphicSVG.java @@ -76,7 +76,10 @@ public class GraphicSVG implements Graphic, Closeable { w.write("\""); // if (style.isDashed()) // addStrokeDash(w, style.getDashArray()); - w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"none\"/>\n"); + if (style.isFilled()) + w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"" + getColor(style) + "\"/>\n"); + else + w.write(" stroke=\"" + getColor(style) + "\" stroke-width=\"" + getStrokeWidth(style) + "\" fill=\"none\"/>\n"); } catch (IOException e) { throw new RuntimeException(e); }