Search in sources :

Example 6 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 7 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)

Example 8 with KPolyline

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

the class LinguaFrancaSynthesis method createIODependencyEdge.

private KEdge createIODependencyEdge(Object associate, boolean multiport) {
    KEdge edge = _kEdgeExtensions.createEdge();
    if (associate != null) {
        associateWith(edge, associate);
    }
    KPolyline line = _kEdgeExtensions.addPolyline(edge);
    _linguaFrancaStyleExtensions.boldLineSelectionStyle(line);
    _kPolylineExtensions.addJunctionPointDecorator(line);
    if (multiport) {
        // Render multiport connections and bank connections in bold.
        _kRenderingExtensions.setLineWidth(line, 2.2f);
        _kRenderingExtensions.setLineCap(line, LineCap.CAP_SQUARE);
        // Adjust junction point size
        _kPolylineExtensions.setJunctionPointDecorator(line, line.getJunctionPointRendering(), 6, 6);
    }
    return edge;
}
Also used : KEdge(de.cau.cs.kieler.klighd.kgraph.KEdge) KPolyline(de.cau.cs.kieler.klighd.krendering.KPolyline)

Example 9 with KPolyline

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

the class LinguaFrancaSynthesis method createDependencyEdge.

private KEdge createDependencyEdge(Object associate) {
    KEdge edge = _kEdgeExtensions.createEdge();
    if (associate != null) {
        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 10 with KPolyline

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

the class LinguaFrancaStyleExtensions method applyOnEdgeDelayStyle.

public void applyOnEdgeDelayStyle(KLabel label) {
    if (_onEdgeDelayLabelConfigurator == null) {
        LabelDecorationConfigurator configurator = LabelDecorationConfigurator.create().withInlineLabels(true);
        configurator = configurator.withLabelTextRenderingProvider((KContainerRendering container, KLabel klabel) -> {
            KText kText = _kRenderingFactory.createKText();
            _kRenderingExtensions.setFontSize(kText, 8);
            boldTextSelectionStyle(kText);
            kText.setProperty(KlighdInternalProperties.MODEL_ELEMEMT, klabel.getProperty(KlighdInternalProperties.MODEL_ELEMEMT));
            container.getChildren().add(kText);
            return kText;
        });
        configurator = configurator.addDecoratorRenderingProvider(new IDecoratorRenderingProvider() {

            @Override
            public ElkPadding createDecoratorRendering(KContainerRendering container, KLabel label, LabelDecorationConfigurator.LayoutMode layoutMode) {
                ElkPadding padding = new ElkPadding();
                padding.top = 1;
                padding.bottom = 1;
                padding.left = 2;
                padding.right = 2;
                KPolygon polygon = _kRenderingFactory.createKPolygon();
                _kRenderingExtensions.from(polygon, LEFT, (-2), 0, BOTTOM, 0, 0);
                _kRenderingExtensions.to(polygon, LEFT, 2, 0, TOP, 0, 0);
                _kRenderingExtensions.to(polygon, RIGHT, (-2), 0, TOP, 0, 0);
                _kRenderingExtensions.to(polygon, RIGHT, 2, 0, BOTTOM, 0, 0);
                _kRenderingExtensions.setBackground(polygon, Colors.WHITE);
                _kRenderingExtensions.setForeground(polygon, Colors.WHITE);
                container.getChildren().add(polygon);
                KPolyline polyline = _kRenderingFactory.createKPolyline();
                _kRenderingExtensions.from(polyline, LEFT, (-2), 0, BOTTOM, 0, 0);
                _kRenderingExtensions.to(polyline, LEFT, 2, 0, TOP, 0, 0);
                container.getChildren().add(polyline);
                polyline = _kRenderingFactory.createKPolyline();
                _kRenderingExtensions.from(polyline, RIGHT, 2, 0, BOTTOM, 0, 0);
                _kRenderingExtensions.to(polyline, RIGHT, (-2), 0, TOP, 0, 0);
                container.getChildren().add(polyline);
                return padding;
            }
        });
        _onEdgeDelayLabelConfigurator = configurator;
    }
    _onEdgeDelayLabelConfigurator.applyTo(label);
}
Also used : KText(de.cau.cs.kieler.klighd.krendering.KText) KPolygon(de.cau.cs.kieler.klighd.krendering.KPolygon) KLabel(de.cau.cs.kieler.klighd.kgraph.KLabel) LabelDecorationConfigurator(de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator) KContainerRendering(de.cau.cs.kieler.klighd.krendering.KContainerRendering) IDecoratorRenderingProvider(de.cau.cs.kieler.klighd.labels.decoration.IDecoratorRenderingProvider) ElkPadding(org.eclipse.elk.core.math.ElkPadding) 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