Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1b01d61c6f1bc75b63ee745de523ffa59757b286 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*****************************************************************************
 * Copyright (c) 2008 CEA LIST.
 *
 *
 * 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:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.figure.node;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;

public class AssociationNodeFigure extends DefaultSizeNodeFigure {

	// @unused
	public AssociationNodeFigure(Dimension defSize) {
		super(defSize);
		
	}

	public AssociationNodeFigure(int width, int height) {
		super(width, height);
		
	}

	// This returns as the anchoring area only the central line
	@Override
	public PointList getPolygonPoints() {
		PointList points = new PointList(5);
		Rectangle anchorableRectangle = getHandleBounds();
		points.addPoint(anchorableRectangle.x + (anchorableRectangle.width / 2), anchorableRectangle.y);
		points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height / 2);
		points.addPoint(anchorableRectangle.x + (anchorableRectangle.width / 2), anchorableRectangle.y + anchorableRectangle.height);
		points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height / 2);
		points.addPoint(anchorableRectangle.x + (anchorableRectangle.width / 2), anchorableRectangle.y);

		return points;
	}

}

Back to the top