Search in sources :

Example 1 with KArc

use of de.cau.cs.kieler.klighd.krendering.KArc in project lingua-franca by lf-lang.

the class LinguaFrancaShapeExtensions method addStopwatchFigure.

/**
 * Stopwatch figure for deadlines.
 */
public KRectangle addStopwatchFigure(KContainerRendering parent) {
    final int size = 12;
    KRectangle container = _kContainerRenderingExtensions.addRectangle(parent);
    _kRenderingExtensions.setInvisible(container, true);
    _kRenderingExtensions.setPointPlacementData(container, _kRenderingExtensions.LEFT, 0, 0, _kRenderingExtensions.TOP, 0, 0, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 0, 0, size, size);
    KPolyline polyline = _kContainerRenderingExtensions.addPolyline(container, 2, List.of(_kRenderingExtensions.createKPosition(LEFT, 3, 0.5f, TOP, (-2), 0), _kRenderingExtensions.createKPosition(LEFT, (-3), 0.5f, TOP, (-2), 0)));
    _kRenderingExtensions.setForeground(polyline, Colors.BROWN);
    polyline = _kContainerRenderingExtensions.addPolyline(container, 2, List.of(_kRenderingExtensions.createKPosition(LEFT, 0, 0.5f, TOP, (-2), 0), _kRenderingExtensions.createKPosition(LEFT, 0, 0.5f, TOP, 1, 0)));
    _kRenderingExtensions.setForeground(polyline, Colors.BROWN);
    KEllipse body = _kContainerRenderingExtensions.addEllipse(container);
    _kRenderingExtensions.setLineWidth(body, 1);
    _kRenderingExtensions.setForeground(body, Colors.BROWN);
    _kRenderingExtensions.<KEllipse>setPointPlacementData(body, _kRenderingExtensions.LEFT, 0, 0, _kRenderingExtensions.TOP, 0, 0, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 0, 0, size, size);
    _linguaFrancaStyleExtensions.noSelectionStyle(body);
    KArc arc = _kContainerRenderingExtensions.addArc(body);
    arc.setStartAngle((-20));
    arc.setArcAngle(110);
    arc.setArcType(Arc.PIE);
    _kRenderingExtensions.setLineWidth(arc, 0);
    _kRenderingExtensions.setBackground(arc, Colors.BROWN);
    _kRenderingExtensions.setPointPlacementData(arc, _kRenderingExtensions.LEFT, 2, 0, _kRenderingExtensions.TOP, 2, 0, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 2, 2, size - 4, size - 4);
    _linguaFrancaStyleExtensions.noSelectionStyle(arc);
    return container;
}
Also used : KArc(de.cau.cs.kieler.klighd.krendering.KArc) KEllipse(de.cau.cs.kieler.klighd.krendering.KEllipse) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline) KRectangle(de.cau.cs.kieler.klighd.krendering.KRectangle)

Aggregations

KArc (de.cau.cs.kieler.klighd.krendering.KArc)1 KEllipse (de.cau.cs.kieler.klighd.krendering.KEllipse)1 KPolyline (de.cau.cs.kieler.klighd.krendering.KPolyline)1 KRectangle (de.cau.cs.kieler.klighd.krendering.KRectangle)1