Search in sources :

Example 1 with KPolyline

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

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

the class LinguaFrancaShapeExtensions method addCommentPolyline.

public KPolyline addCommentPolyline(KEdge edge) {
    KPolyline polyline = _kEdgeExtensions.addPolyline(edge);
    _kRenderingExtensions.setLineWidth(polyline, 1);
    _kRenderingExtensions.setLineStyle(polyline, LineStyle.DOT);
    return polyline;
}
Also used : KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Example 3 with KPolyline

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

the class InterfaceDependenciesVisualization method createDependencyEdge.

/**
 * Create an edges for interface dependencies and adjust visibility based on the expansion state of the node.
 */
private KEdge createDependencyEdge(final Pair<KPort, KPort> connection, final boolean expanded) {
    KEdge depEdge = _kEdgeExtensions.createEdge();
    depEdge.setSource(connection.getKey().getNode());
    depEdge.setSourcePort(connection.getKey());
    depEdge.setTarget(connection.getValue().getNode());
    depEdge.setTargetPort(connection.getValue());
    depEdge.setProperty(InterfaceDependenciesVisualization.INTERFACE_DEPENDENCY, true);
    // no routing!
    depEdge.setProperty(CoreOptions.NO_LAYOUT, true);
    DiagramSyntheses.suppressSelectability(depEdge);
    KPolyline polyline = _kEdgeExtensions.addPolyline(depEdge);
    _kRenderingExtensions.setLineStyle(polyline, LineStyle.DOT);
    _linguaFrancaStyleExtensions.noSelectionStyle(polyline);
    // make sure there is a style to toggle!
    _kRenderingExtensions.setInvisible(polyline, expanded);
    return depEdge;
}
Also used : KEdge(de.cau.cs.kieler.klighd.kgraph.KEdge) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Example 4 with KPolyline

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

the class LinguaFrancaSynthesis method createDelayEdge.

private KEdge createDelayEdge(Object associate) {
    KEdge edge = _kEdgeExtensions.createEdge();
    associateWith(edge, associate);
    KPolyline line = _kEdgeExtensions.addPolyline(edge);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(line);
    _kPolylineExtensions.addJunctionPointDecorator(line);
    if (getBooleanValue(USE_ALTERNATIVE_DASH_PATTERN)) {
        _kRenderingExtensions.setLineStyle(line, LineStyle.CUSTOM);
        _kRenderingExtensions.getLineStyle(line).getDashPattern().addAll(ALTERNATIVE_DASH_PATTERN);
    } else {
        _kRenderingExtensions.setLineStyle(line, LineStyle.DASH);
    }
    return edge;
}
Also used : KEdge(de.cau.cs.kieler.klighd.kgraph.KEdge) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Example 5 with KPolyline

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

the class LinguaFrancaSynthesis method createOrderEdge.

private KEdge createOrderEdge() {
    KEdge edge = _kEdgeExtensions.createEdge();
    KPolyline line = _kEdgeExtensions.addPolyline(edge);
    _kRenderingExtensions.setLineWidth(line, 1.5f);
    _kRenderingExtensions.setLineStyle(line, LineStyle.DOT);
    _kRenderingExtensions.setForeground(line, Colors.CHOCOLATE_1);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(line);
    // addFixedTailArrowDecorator() // Fix for bug: https://github.com/kieler/KLighD/issues/38
    _kPolylineExtensions.addHeadArrowDecorator(line);
    return edge;
}
Also used : KEdge(de.cau.cs.kieler.klighd.kgraph.KEdge) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Aggregations

KPolyline (de.cau.cs.kieler.klighd.krendering.KPolyline)12 KEdge (de.cau.cs.kieler.klighd.kgraph.KEdge)5 KText (de.cau.cs.kieler.klighd.krendering.KText)4 KPolygon (de.cau.cs.kieler.klighd.krendering.KPolygon)3 KLabel (de.cau.cs.kieler.klighd.kgraph.KLabel)2 KContainerRendering (de.cau.cs.kieler.klighd.krendering.KContainerRendering)2 KEllipse (de.cau.cs.kieler.klighd.krendering.KEllipse)2 KRectangle (de.cau.cs.kieler.klighd.krendering.KRectangle)2 KRendering (de.cau.cs.kieler.klighd.krendering.KRendering)2 IDecoratorRenderingProvider (de.cau.cs.kieler.klighd.labels.decoration.IDecoratorRenderingProvider)2 LabelDecorationConfigurator (de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator)2 ElkPadding (org.eclipse.elk.core.math.ElkPadding)2 KArc (de.cau.cs.kieler.klighd.krendering.KArc)1 KDecoratorPlacementData (de.cau.cs.kieler.klighd.krendering.KDecoratorPlacementData)1 KPosition (de.cau.cs.kieler.klighd.krendering.KPosition)1 KSpline (de.cau.cs.kieler.klighd.krendering.KSpline)1 ArrayList (java.util.ArrayList)1 ReactorInstance (org.lflang.generator.ReactorInstance)1