1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g2d.element.handler;
\r
14 import java.awt.Color;
\r
15 import java.awt.Shape;
\r
16 import java.awt.Stroke;
\r
17 import java.util.EnumSet;
\r
19 import org.simantics.g2d.element.IElement;
\r
20 import org.simantics.g2d.element.handler.impl.ConfigurableEdgeVisuals;
\r
21 import org.simantics.g2d.element.handler.impl.StaticEdgeVisuals;
\r
24 * Edge visual properties
\r
26 * @See {@link ConfigurableEdgeVisuals}
\r
27 * @See {@link StaticEdgeVisuals}
\r
28 * @author Toni Kalajainen
\r
30 * TODO: configurable arrow shape
\r
32 public interface EdgeVisuals extends ElementHandler {
\r
34 public static enum StrokeType { Absolute, Relative }
\r
36 public static enum ArrowType { None, Stroke, Fill, Both }
\r
38 public static interface Arrow {
\r
39 ArrowType getType();
\r
40 Color getStrokeColor();
\r
41 Color getFillColor();
\r
43 * @return the renderable arrow shape described by this arrow type. The
\r
44 * returned shape is interpreted to be facing in the positive X
\r
45 * direction (right), with 0 degree rotation
\r
50 public static enum EdgeEnd {
\r
52 public EdgeEnd other() {
\r
53 return this == Begin ? End : Begin;
\r
57 public static EnumSet<EdgeEnd> BEGIN = EnumSet.of(EdgeEnd.Begin);
\r
58 public static EnumSet<EdgeEnd> END = EnumSet.of(EdgeEnd.End);
\r
59 public static EnumSet<EdgeEnd> BOTH = EnumSet.allOf(EdgeEnd.class);
\r
61 Stroke getStroke(IElement e);
\r
62 void setStroke(IElement e, Stroke s);
\r
64 StrokeType getStrokeType(IElement e);
\r
65 void setStrokeType(IElement e, StrokeType t);
\r
67 ArrowType getArrowType(IElement e, EdgeEnd end);
\r
68 void setArrowType(IElement e, EdgeEnd end, ArrowType arrowType);
\r
70 double getArrowSize(IElement e, EdgeEnd end);
\r
71 void setArrowSize(IElement e, EdgeEnd end, double size);
\r
73 // TODO: weight, transparency, corner rounds/rounding size
\r