Go to the documentation of this file.00001 package org.ros.model.ros.diagram;
00002
00003 import org.eclipse.draw2d.AbstractConnectionAnchor;
00004 import org.eclipse.draw2d.IFigure;
00005 import org.eclipse.draw2d.geometry.Point;
00006 import org.eclipse.draw2d.geometry.PrecisionPoint;
00007 import org.eclipse.draw2d.geometry.Rectangle;
00008
00009 public class FixedConnectionAnchor extends AbstractConnectionAnchor {
00010
00011 private double xOffset;
00012 private double yOffset;
00013
00014 public FixedConnectionAnchor(IFigure owner, PrecisionPoint offset) {
00015 this(owner, offset.preciseX, offset.preciseY);
00016 }
00017
00018 public FixedConnectionAnchor(IFigure owner, double xOffset, double yOffset) {
00019 super(owner);
00020 this.xOffset = xOffset;
00021 this.yOffset = yOffset;
00022 }
00023
00024 @Override
00025 public Point getLocation(Point point) {
00026 return getLocation();
00027 }
00028
00029 public Point getLocation() {
00030 Rectangle r = getOwner().getBounds();
00031 Point p = new PrecisionPoint(r.x + r.width*xOffset, r.y + r.height*yOffset);
00032 getOwner().translateToAbsolute(p);
00033 return p;
00034 }
00035
00036 }