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