GoRectangle to Rectangle/F

I need to detect intersecting nodes in my document.

What I thought about doing is as fallow:

When inserting a new node run through all the nodes in the document and check if they are intersecting.

The check, as I see in now needs to be done manually which means a lot of conditions (about 15) and it looks pretty ugly… :-\

Is there a way to cast the Shape of the node to Rectangle or RectangleF and the check will be done as a method call instead of my ugly way?..

Concept changes that could help solving this problem will be happily accepted.

Thank you a lot.

Forgot to share an idea that I can allocate new nodes evey time and get the needed constractor parameters for the RectangleF class thought It’s also a kind of messy.

If somebody thinks about a diffarent and more nice way I’d love to hear…

Before you add a node to your document, you can use the GoDocument.IsUnoccupied predicate to see if a proposed node’s bounding rectangle has any existing nodes overlapping that rectangle.

It doesn’t always give me the correct return value.

I rather follow my Idea which checks just the nodes I want to check and their positions, ignoring the links and other object I want to ignore.

Do you see any other way for doing that except for what I had in mind?

Thank you a lot!

Well I managed implementing this algorithem with the rectangle system…

If there is a more efficient way of implementing that algorithem I’d love to hear. Star

Thank you…