View | Details | Raw Unified | Return to bug 212280 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/RelativeBendpoint.java (-13 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
12
13
import org.eclipse.draw2d.geometry.Dimension;
13
import org.eclipse.draw2d.geometry.Dimension;
14
import org.eclipse.draw2d.geometry.Point;
14
import org.eclipse.draw2d.geometry.Point;
15
import org.eclipse.draw2d.geometry.PrecisionPoint;
15
16
16
/**
17
/**
17
 * RelativeBendpoint is a Bendpoint that calculates its location based on its distance
18
 * RelativeBendpoint is a Bendpoint that calculates its location based on its distance
Lines 58-77 Link Here
58
 * @since 2.0
59
 * @since 2.0
59
 */
60
 */
60
public Point getLocation() {
61
public Point getLocation() {
61
	Point a1 = getConnection().getSourceAnchor().getReferencePoint();
62
	PrecisionPoint a1 = new PrecisionPoint(getConnection().getSourceAnchor().getReferencePoint());
62
	Point a2 = getConnection().getTargetAnchor().getReferencePoint();
63
	PrecisionPoint a2 = new PrecisionPoint(getConnection().getTargetAnchor().getReferencePoint());
63
	
64
	
64
	Point p = new Point();
65
	getConnection().translateToRelative(a1);
65
	Dimension dim1 = d1.getCopy(), dim2 = d2.getCopy();
66
	getConnection().translateToRelative(a2);
66
	
67
	
67
	getConnection().translateToAbsolute(dim1);
68
	return new PrecisionPoint((a1.preciseX() + d1.preciseWidth())
68
	getConnection().translateToAbsolute(dim2);
69
				* (1f - weight) + weight * (a2.preciseX() + d2.preciseWidth()),
69
	
70
				(a1.preciseY() + d1.preciseHeight()) * (1f - weight) + weight
70
	p.x = (int)((a1.x + dim1.width) * (1f - weight) + weight * (a2.x + dim2.width));
71
						* (a2.preciseY() + d2.preciseHeight()));
71
	p.y = (int)((a1.y + dim1.height) * (1f - weight) + weight * (a2.y + dim2.height));
72
	}
72
	getConnection().translateToRelative(p);
73
	return p;
74
}
75
73
76
/**
74
/**
77
 * Sets the Connection this bendpoint should be associated with.
75
 * Sets the Connection this bendpoint should be associated with.

Return to bug 212280