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.geom.Path2D;
15 import java.awt.geom.Point2D;
16 import java.util.List;
18 import org.simantics.g2d.diagram.handler.Topology;
19 import org.simantics.g2d.element.IElement;
20 import org.simantics.g2d.element.ElementClass.Single;
23 * Interface for adapting editing edge bends between information models.
25 * Bend is a control point of an edge. The path of an edge follows thru all its
29 * @author Toni Kalajainen
32 public interface BendsHandler extends ElementHandler {
34 /** Information for painter */
35 public static enum AngleType {
36 Line, /* Straight from begin to end */
37 RightAngled, /* 90-degree angles */
38 Linear, /* 1st degree lines, free angles */
39 Quadratic /* 3rd degree line segments */
40 // FIXME: 2nd, not 3rd degree ?
42 AngleType getAngleType(IElement e);
43 void setAngleType(IElement e, AngleType angleType);
45 public interface Bend {}
50 * @param bends collection to be filled with bends
52 void getBends(IElement e, List<Bend> bends);
56 * Get bend position in element coordinate system
60 * @param pos point object to be filled with the position (not null)
61 * @return point object pos
63 void getBendPosition(IElement e, Bend b, Point2D pos);
69 * @param pos element coordinate system position
72 Bend addBend(IElement e, int index, Point2D pos);
78 * @return true if successful
80 boolean removeBend(IElement e, Bend b);
83 * move position of a bend
86 * @param pos position in element coordinate system
88 void moveBend(IElement e, Bend b, Point2D pos);
95 int getBendsCount(IElement e);
102 Path2D getPath(IElement e);
109 void setPath(IElement e, Path2D p);