X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2Frendering%2FExampleConnectionStyle.java;fp=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2Frendering%2FExampleConnectionStyle.java;h=4983df8df454fc3a682834bf9239c503e123875b;hp=1641b2bfd84d8e5f428cf4a4cee52c5c477d9fe2;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ExampleConnectionStyle.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ExampleConnectionStyle.java index 1641b2bfd..4983df8df 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ExampleConnectionStyle.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/rendering/ExampleConnectionStyle.java @@ -1,78 +1,78 @@ -/******************************************************************************* - * Copyright (c) 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram.connection.rendering; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.geom.Ellipse2D; -import java.awt.geom.Line2D; -import java.awt.geom.Path2D; -import java.io.Serializable; - -public class ExampleConnectionStyle implements ConnectionStyle, Serializable { - - private static final long serialVersionUID = -5799681720482456895L; - - public final static BasicStroke SOLID = - new BasicStroke(1f); - - public final static BasicStroke BOLD = - new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); - - @Override - public void drawLine(Graphics2D g, double x1, double y1, double x2, - double y2, boolean isTransient) { - g.setColor(Color.BLACK); - if(isTransient) - g.draw(new Line2D.Double(x1, y1, x2, y2)); - else { - g.setStroke(BOLD); - g.draw(new Line2D.Double(x1, y1, x2, y2)); - g.setStroke(SOLID); - } - } - - @Override - public void drawPath(Graphics2D g, Path2D path, boolean isTransient) { - g.setColor(Color.BLACK); - if(isTransient) - g.draw(path); - else { - g.setStroke(BOLD); - g.draw(path); - g.setStroke(SOLID); - } - } - - @Override - public void drawBranchPoint(Graphics2D g, double x, double y) { - g.setColor(Color.BLACK); - g.fill(new Ellipse2D.Double(x-3, y-3, 6, 6)); - } - - @Override - public void drawDegeneratedLine(Graphics2D g, double x, double y, - boolean isHorizontal, boolean isTransient) { - double d = getDegeneratedLineLength()*0.5; - if(isHorizontal) - g.draw(new Line2D.Double(x-d, y, x+d, y)); - else - g.draw(new Line2D.Double(x, y-d, x, y+d)); - } - - @Override - public double getDegeneratedLineLength() { - return 8.0; - } - -} +/******************************************************************************* + * Copyright (c) 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection.rendering; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Line2D; +import java.awt.geom.Path2D; +import java.io.Serializable; + +public class ExampleConnectionStyle implements ConnectionStyle, Serializable { + + private static final long serialVersionUID = -5799681720482456895L; + + public final static BasicStroke SOLID = + new BasicStroke(1f); + + public final static BasicStroke BOLD = + new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); + + @Override + public void drawLine(Graphics2D g, double x1, double y1, double x2, + double y2, boolean isTransient) { + g.setColor(Color.BLACK); + if(isTransient) + g.draw(new Line2D.Double(x1, y1, x2, y2)); + else { + g.setStroke(BOLD); + g.draw(new Line2D.Double(x1, y1, x2, y2)); + g.setStroke(SOLID); + } + } + + @Override + public void drawPath(Graphics2D g, Path2D path, boolean isTransient) { + g.setColor(Color.BLACK); + if(isTransient) + g.draw(path); + else { + g.setStroke(BOLD); + g.draw(path); + g.setStroke(SOLID); + } + } + + @Override + public void drawBranchPoint(Graphics2D g, double x, double y) { + g.setColor(Color.BLACK); + g.fill(new Ellipse2D.Double(x-3, y-3, 6, 6)); + } + + @Override + public void drawDegeneratedLine(Graphics2D g, double x, double y, + boolean isHorizontal, boolean isTransient) { + double d = getDegeneratedLineLength()*0.5; + if(isHorizontal) + g.draw(new Line2D.Double(x-d, y, x+d, y)); + else + g.draw(new Line2D.Double(x, y-d, x, y+d)); + } + + @Override + public double getDegeneratedLineLength() { + return 8.0; + } + +}