use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class ConnectionFigure method containsPoint.
@Override
public boolean containsPoint(int x, int y) {
Rectangle tempBounds = new Rectangle();
int tolerance = (int) Math.max(getLineWidthFloat() / 2.0f, 3 + getLineWidth() / 2);
tempBounds.setBounds(getBounds());
tempBounds.expand(tolerance, tolerance);
if (!tempBounds.contains(x, y))
return false;
return shapeContainsPoint(x, y) || childrenContainsPoint(x, y);
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class NodesPasteCommand method findLocationForNodeInProcess.
@SuppressWarnings("unchecked")
private Point findLocationForNodeInProcess(final Point location, Dimension size, NodePart copiedNodePart) {
Rectangle copiedRect = new Rectangle(location, size);
Point newLocation = new Point(location);
for (IGraphicalNode node : (List<IGraphicalNode>) process.getGraphicalNodes()) {
Rectangle currentRect = new Rectangle(node.getLocation(), node.getSize());
if (currentRect.intersects(copiedRect)) {
newLocation.x += size.width;
newLocation.y += size.height;
return findLocationForNodeInProcess(newLocation, size, copiedNodePart);
}
}
return newLocation;
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class NodesMoveCommond method findLocationForNodeInProcess.
@SuppressWarnings("unchecked")
private Point findLocationForNodeInProcess(final Point location, Dimension size) {
Rectangle copiedRect = new Rectangle(location, size);
Point newLocation = new Point(location);
for (IGraphicalNode node : (List<IGraphicalNode>) process.getGraphicalNodes()) {
Rectangle currentRect = new Rectangle((Point) node.getLocation(), (Dimension) node.getSize());
if (currentRect.intersects(copiedRect)) {
newLocation.x += size.width;
newLocation.y += size.height;
return findLocationForNodeInProcess(newLocation, size);
}
}
return newLocation;
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class NodesPasteCommand method findLocationForNodeInContainerList.
private Point findLocationForNodeInContainerList(final Point location, Dimension size, int index, int firstIndex, NodePart copiedNodePart) {
Rectangle copiedRect = new Rectangle(location, size);
Point newLocation = new Point(location);
if (getCursorLocation() == null) {
for (NodeContainer nodeContainer : nodeContainerList) {
IGraphicalNode node = nodeContainer.getNode();
Rectangle currentRect = new Rectangle(node.getLocation(), node.getSize());
if (currentRect.intersects(copiedRect)) {
newLocation.x += size.width;
newLocation.y += size.height;
// newLocation = computeTheDistance(index, firstIndex, newLocation);
Point tmpPoint = findLocationForNodeInProcess(newLocation, size, copiedNodePart);
return findLocationForNodeInContainerList(tmpPoint, size, index, firstIndex, copiedNodePart);
}
}
return newLocation;
}
if (!nodePart.equals(copiedNodePart)) {
newLocation = computeTheDistance(index, firstIndex, newLocation);
}
return newLocation;
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class NodesMoveCommond method findLocationForNodeInContainerList.
private Point findLocationForNodeInContainerList(final Point location, Dimension size, int index, int firstIndex, Node copiedNode) {
Rectangle copiedRect = new Rectangle(location, size);
Point newLocation = new Point(location);
if (getCursorLocation() == null) {
for (NodeContainer nodeContainer : nodeContainerList) {
IGraphicalNode node = nodeContainer.getNode();
Rectangle currentRect = new Rectangle((Point) node.getLocation(), (Dimension) node.getSize());
if (currentRect.intersects(copiedRect)) {
newLocation.x += size.width;
newLocation.y += size.height;
// newLocation = computeTheDistance(index, firstIndex, newLocation);
Point tmpPoint = findLocationForNodeInProcess(newLocation, size);
return findLocationForNodeInContainerList(tmpPoint, size, index, firstIndex, copiedNode);
}
}
return newLocation;
}
if (!node.equals(copiedNode)) {
newLocation = computeTheDistance(index, firstIndex, newLocation);
}
return newLocation;
}
Aggregations