intersecting elements [message #213815] |
Tue, 11 April 2006 12:42 |
Steffen K Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Hello!
I am working on an editor representing a diagram. For that purpose I am
using GEF and draw2d.
Now I want to forbid intersection of elements (draw2d.Figures) in the
diagram.
How can I check if two figures are intersecting?
I created a command that inserts a new element on the mouse's position.
I should possibly forbid the insertion of a new intersecting Figure by
working on the canExecute method of the command.
My actual method looks like :
private NodeModelElement newNode;
private IContainerElement container;
private Rectangle bounds;
public boolean canExecute() {
return (newNode != null && container != null && bounds != null);
}
I have the position of the new Figure (bounds) but I have to check if
there is already an element on the clicked location. How can I verify that?
Or is there another way to avoid intersection of elements in GEF?
Thanks in advance,
Steffen
|
|
|
Powered by
FUDForum. Page generated in 0.03072 seconds