Java Code Examples for org.eclipse.draw2d.geometry.Point#getTranslated()

The following examples show how to use org.eclipse.draw2d.geometry.Point#getTranslated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EdgeLabelQuery.java    From statecharts with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Get the standard center location according to the label keyPoint (
 * {@link org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart#getKeyPoint()}
 * ) and the default snap back position (
 * {@link LabelEditPart#getSnapBackPosition(String)}
 *
 * @param pointsList The points of the edge of the label.
 * @param keyPoint   The keyPoint of the label (
 *                   {@link org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart#getKeyPoint()}
 *                   ).
 * @return The center of the label {@link Bounds} if this label is located by
 *         default.
 */
private Point getStandardLabelCenterLocation(PointList pointsList, Integer keyPoint) {
	int percentage = getLocation(keyPoint);
	Point newAnchorPoint = getAnchorPoint(pointsList, percentage);
	Point snapBackPosition = getSnapBackPosition(keyPoint);
	Point standardLabelCenter = newAnchorPoint.getTranslated(snapBackPosition);
	return standardLabelCenter;
}