1 /*******************************************************************************
2 * Copyright (c) 2020 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.connection.rendering;
14 import java.awt.Graphics2D;
15 import java.awt.geom.Path2D;
16 import java.io.Serializable;
17 import java.util.ArrayList;
18 import java.util.List;
20 public class AggregateConnectionStyle implements ConnectionStyle, Serializable{
22 private static final long serialVersionUID = 5888959070127628457L;
23 private List<ConnectionStyle> styles = new ArrayList<>();
25 public void addStyle(ConnectionStyle style) {
30 public void drawBranchPoint(Graphics2D g, double x, double y) {
31 for (ConnectionStyle style : styles) {
32 style.drawBranchPoint(g, x, y);
37 public void drawLine(Graphics2D g, double x1, double y1, double x2, double y2, boolean isTransient) {
38 for (ConnectionStyle style : styles) {
39 style.drawLine(g, x1, y1, x2, y2, isTransient);
44 public void drawPath(Graphics2D g, Path2D path, boolean isTransient) {
45 for (ConnectionStyle style : styles) {
46 style.drawPath(g, path, isTransient);
51 public void drawDegeneratedLine(Graphics2D g, double x, double y, boolean isHorizontal, boolean isTransient) {
52 for (ConnectionStyle style : styles) {
53 style.drawDegeneratedLine(g, x, y, isHorizontal, isTransient);
58 public double getDegeneratedLineLength() {
60 for (ConnectionStyle style : styles) {
61 max = Math.max(max, style.getDegeneratedLineLength());