1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.element.handler;
14 import java.awt.Color;
15 import java.awt.Shape;
16 import java.awt.Stroke;
17 import java.util.EnumSet;
19 import org.simantics.g2d.element.IElement;
20 import org.simantics.g2d.element.handler.impl.ConfigurableEdgeVisuals;
21 import org.simantics.g2d.element.handler.impl.StaticEdgeVisuals;
24 * Edge visual properties
26 * @See {@link ConfigurableEdgeVisuals}
27 * @See {@link StaticEdgeVisuals}
28 * @author Toni Kalajainen
30 * TODO: configurable arrow shape
32 public interface EdgeVisuals extends ElementHandler {
34 public static enum StrokeType { Absolute, Relative }
36 public static enum ArrowType { None, Stroke, Fill, Both }
38 public static interface Arrow {
40 Color getStrokeColor();
43 * @return the renderable arrow shape described by this arrow type. The
44 * returned shape is interpreted to be facing in the positive X
45 * direction (right), with 0 degree rotation
50 public static enum EdgeEnd {
52 public EdgeEnd other() {
53 return this == Begin ? End : Begin;
57 public static EnumSet<EdgeEnd> BEGIN = EnumSet.of(EdgeEnd.Begin);
58 public static EnumSet<EdgeEnd> END = EnumSet.of(EdgeEnd.End);
59 public static EnumSet<EdgeEnd> BOTH = EnumSet.allOf(EdgeEnd.class);
61 Stroke getStroke(IElement e);
62 void setStroke(IElement e, Stroke s);
64 StrokeType getStrokeType(IElement e);
65 void setStrokeType(IElement e, StrokeType t);
67 ArrowType getArrowType(IElement e, EdgeEnd end);
68 void setArrowType(IElement e, EdgeEnd end, ArrowType arrowType);
70 double getArrowSize(IElement e, EdgeEnd end);
71 void setArrowSize(IElement e, EdgeEnd end, double size);
73 // TODO: weight, transparency, corner rounds/rounding size