X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FConnectionSelectionOutline.java;h=55989f6d0255d33a550114ef78bc8fdbe7cec74c;hb=refs%2Fchanges%2F61%2F561%2F5;hp=2f0f208d751a71df1644e0479c3edffa0a80ca75;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ConnectionSelectionOutline.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ConnectionSelectionOutline.java index 2f0f208d7..55989f6d0 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ConnectionSelectionOutline.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ConnectionSelectionOutline.java @@ -1,49 +1,49 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.g2d.element.handler.impl; - -import java.awt.BasicStroke; -import java.awt.Shape; -import java.awt.Stroke; - -import org.simantics.g2d.element.ElementUtils; -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.handler.EdgeVisuals; -import org.simantics.g2d.element.handler.SelectionOutline; - -public class ConnectionSelectionOutline implements SelectionOutline { - - private static final long serialVersionUID = 1L; - - public final static ConnectionSelectionOutline INSTANCE = new ConnectionSelectionOutline(); - - public static final Stroke defaultStroke = new BasicStroke(0.3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); - - public Stroke resolveStroke(IElement e, Stroke defaultValue) { - for (EdgeVisuals ev : e.getElementClass().getItemsByClass(EdgeVisuals.class)) { - BasicStroke stroke = (BasicStroke) ev.getStroke(e); - if (stroke != null) { -// return stroke; - return new BasicStroke(1.5f*stroke.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); - } - } - return defaultStroke; - } - - @Override - public Shape getSelectionShape(IElement e) { - Stroke stroke = resolveStroke(e, defaultStroke); - Shape es = ElementUtils.getElementShapeOrBounds(e); - return stroke.createStrokedShape(es); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 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.g2d.element.handler.impl; + +import java.awt.BasicStroke; +import java.awt.Shape; +import java.awt.Stroke; + +import org.simantics.g2d.element.ElementUtils; +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.handler.EdgeVisuals; +import org.simantics.g2d.element.handler.SelectionOutline; + +public class ConnectionSelectionOutline implements SelectionOutline { + + private static final long serialVersionUID = 1L; + + public final static ConnectionSelectionOutline INSTANCE = new ConnectionSelectionOutline(); + + public static final Stroke defaultStroke = new BasicStroke(0.3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); + + public Stroke resolveStroke(IElement e, Stroke defaultValue) { + for (EdgeVisuals ev : e.getElementClass().getItemsByClass(EdgeVisuals.class)) { + BasicStroke stroke = (BasicStroke) ev.getStroke(e); + if (stroke != null) { +// return stroke; + return new BasicStroke(1.5f*stroke.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); + } + } + return defaultStroke; + } + + @Override + public Shape getSelectionShape(IElement e) { + Stroke stroke = resolveStroke(e, defaultStroke); + Shape es = ElementUtils.getElementShapeOrBounds(e); + return stroke.createStrokedShape(es); + } + +}