Search in sources :

Example 1 with KEllipse

use of de.cau.cs.kieler.klighd.krendering.KEllipse 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)

Example 2 with KEllipse

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

the class LinguaFrancaStyleExtensions method addCloudIcon.

public KContainerRendering addCloudIcon(final KContainerRendering parent) {
    KRectangle figure = _kContainerRenderingExtensions.addRectangle(parent);
    _kRenderingExtensions.setInvisible(figure, true);
    KRoundedRectangle roundRectangle = _kContainerRenderingExtensions.addRoundedRectangle(figure, CLOUD_WIDTH / 7, CLOUD_WIDTH / 7);
    _kRenderingExtensions.setBackground(roundRectangle, Colors.GRAY);
    _kRenderingExtensions.setForeground(roundRectangle, Colors.GRAY);
    _kRenderingExtensions.setPointPlacementData(roundRectangle, _kRenderingExtensions.LEFT, 2, 0, _kRenderingExtensions.TOP, 0, 0.5f, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 0, 0, CLOUD_WIDTH, CLOUD_WIDTH / 3);
    KEllipse childEllipse = _kContainerRenderingExtensions.addEllipse(figure);
    _kRenderingExtensions.setBackground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setForeground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setPointPlacementData(childEllipse, _kRenderingExtensions.LEFT, 0, 0f, _kRenderingExtensions.TOP, 0, 0.38f, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 0, 0, CLOUD_WIDTH / 2.5f, CLOUD_WIDTH / 2.5f);
    childEllipse = _kContainerRenderingExtensions.addEllipse(figure);
    _kRenderingExtensions.setBackground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setForeground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setPointPlacementData(childEllipse, _kRenderingExtensions.LEFT, 0, 0.5f, _kRenderingExtensions.TOP, 0, 0.25f, _kRenderingExtensions.H_RIGHT, _kRenderingExtensions.V_TOP, 0, 0, CLOUD_WIDTH / 3f, CLOUD_WIDTH / 3f);
    childEllipse = _kContainerRenderingExtensions.addEllipse(figure);
    _kRenderingExtensions.setBackground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setForeground(childEllipse, Colors.GRAY);
    _kRenderingExtensions.setPointPlacementData(childEllipse, _kRenderingExtensions.LEFT, 0, 0.4f, _kRenderingExtensions.TOP, CLOUD_WIDTH / 10, 0, _kRenderingExtensions.H_LEFT, _kRenderingExtensions.V_TOP, 0, 0, CLOUD_WIDTH / 2, CLOUD_WIDTH / 2);
    return figure;
}
Also used : KEllipse(de.cau.cs.kieler.klighd.krendering.KEllipse) KRoundedRectangle(de.cau.cs.kieler.klighd.krendering.KRoundedRectangle) KRectangle(de.cau.cs.kieler.klighd.krendering.KRectangle)

Example 3 with KEllipse

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

the class LinguaFrancaShapeExtensions method addTimerFigure.

/**
 * Creates the visual representation of a timer node
 */
public KEllipse addTimerFigure(KNode node, TimerInstance timer) {
    _kNodeExtensions.setMinimalNodeSize(node, 30, 30);
    KEllipse figure = _kRenderingExtensions.addEllipse(node);
    _kRenderingExtensions.setBackground(figure, Colors.GRAY_95);
    _linguaFrancaStyleExtensions.noSelectionStyle(figure);
    _kRenderingExtensions.setLineWidth(figure, 1);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(figure);
    List<KPosition> polylinePoints = List.of(_kRenderingExtensions.createKPosition(LEFT, 0, 0.5f, TOP, 0, 0.1f), _kRenderingExtensions.createKPosition(LEFT, 0, 0.5f, TOP, 0, 0.5f), _kRenderingExtensions.createKPosition(LEFT, 0, 0.7f, TOP, 0, 0.7f));
    KPolyline polyline = _kContainerRenderingExtensions.addPolyline(figure, 1, polylinePoints);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(polyline);
    List<String> labelParts = new ArrayList<>();
    if (timer.getOffset() != TimerInstance.DEFAULT_OFFSET && timer.getOffset() != null) {
        labelParts.add(timer.getOffset().toString());
    }
    if (timer.getPeriod() != TimerInstance.DEFAULT_PERIOD && timer.getPeriod() != null) {
        if (timer.getOffset() == TimerInstance.DEFAULT_OFFSET) {
            labelParts.add(timer.getOffset().toString());
        }
        labelParts.add(timer.getPeriod().toString());
    }
    if (!labelParts.isEmpty()) {
        _kLabelExtensions.addOutsideBottomCenteredNodeLabel(node, "(" + String.join(", ", labelParts) + ")", 8);
    }
    return figure;
}
Also used : KEllipse(de.cau.cs.kieler.klighd.krendering.KEllipse) ArrayList(java.util.ArrayList) KPosition(de.cau.cs.kieler.klighd.krendering.KPosition) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Example 4 with KEllipse

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

the class LinguaFrancaShapeExtensions method addStartupFigure.

/**
 * Creates the visual representation of a startup trigger.
 */
public KEllipse addStartupFigure(KNode node) {
    _kNodeExtensions.setMinimalNodeSize(node, 18, 18);
    KEllipse figure = _kRenderingExtensions.addEllipse(node);
    _kRenderingExtensions.setLineWidth(figure, 1);
    _kRenderingExtensions.setBackground(figure, Colors.WHITE);
    _linguaFrancaStyleExtensions.noSelectionStyle(figure);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(figure);
    return figure;
}
Also used : KEllipse(de.cau.cs.kieler.klighd.krendering.KEllipse)

Aggregations

KEllipse (de.cau.cs.kieler.klighd.krendering.KEllipse)4 KPolyline (de.cau.cs.kieler.klighd.krendering.KPolyline)2 KRectangle (de.cau.cs.kieler.klighd.krendering.KRectangle)2 KArc (de.cau.cs.kieler.klighd.krendering.KArc)1 KPosition (de.cau.cs.kieler.klighd.krendering.KPosition)1 KRoundedRectangle (de.cau.cs.kieler.klighd.krendering.KRoundedRectangle)1 ArrayList (java.util.ArrayList)1