Search in sources :

Example 1 with GraphicMinMax

use of de.neemann.digital.draw.graphics.GraphicMinMax in project Digital by hneemann.

the class FragmentVisualElement method doLayout.

@Override
public Box doLayout() {
    GraphicMinMax mm = new GraphicMinMax();
    for (Vector p : inputs) mm.check(p);
    for (Vector p : outputs) mm.check(p);
    Vector delta = mm.getMax().sub(mm.getMin());
    if (visualElement.equalsDescription(FlipflopJK.DESCRIPTION) || visualElement.equalsDescription(FlipflopD.DESCRIPTION))
        // Space for label
        return new Box(delta.x, delta.y + SIZE);
    else
        return new Box(delta.x, delta.y);
}
Also used : GraphicMinMax(de.neemann.digital.draw.graphics.GraphicMinMax) Vector(de.neemann.digital.draw.graphics.Vector)

Example 2 with GraphicMinMax

use of de.neemann.digital.draw.graphics.GraphicMinMax in project Digital by hneemann.

the class DocuTest method writeSVG.

private void writeSVG(File imageFile, VisualElement ve) throws IOException {
    try (FileOutputStream out = new FileOutputStream(imageFile)) {
        try (GraphicSVG svg = new GraphicSVGIndex(out, null, 20)) {
            GraphicMinMax minMax = new GraphicMinMax(true, svg);
            ve.drawTo(minMax, null);
            svg.setBoundingBox(minMax.getMin(), minMax.getMax());
            ve.drawTo(svg, null);
        }
    }
}
Also used : GraphicSVGIndex(de.neemann.digital.draw.graphics.GraphicSVGIndex) GraphicMinMax(de.neemann.digital.draw.graphics.GraphicMinMax) GraphicSVG(de.neemann.digital.draw.graphics.GraphicSVG)

Aggregations

GraphicMinMax (de.neemann.digital.draw.graphics.GraphicMinMax)2 GraphicSVG (de.neemann.digital.draw.graphics.GraphicSVG)1 GraphicSVGIndex (de.neemann.digital.draw.graphics.GraphicSVGIndex)1 Vector (de.neemann.digital.draw.graphics.Vector)1