[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.gef] Re: Custom ConnectionAnchor - How to set the connection points to the center of each side?

D. Rolfes escribió:
Hi,

I have two rectangular figures and want to connect them. The four
target and source connection points have to be at the center of each side.
So I think I have to override the methodes getSourceConnectionAnchor(..) and getTargetConnectionAchor(...) in my XXXEditPart class and I've tried to use the FixedConnectionAnchor. I've played around with the getLocation(...) method and managed to place the anchors on the bottom-center of the rectangle. My problem is that the connection points depend on where the two figures are located.
If one figure is at the top and the other below it, the connection has to be from the bottom of the first figure to the top of the second one.
If the first one is left and the second one on the right side, the connection has to be from the right side of figure one to the left side of figure two. And so one.
How do I determine where the two figures are located? Or is there an easier approach?


Thanks,
Daniel
Hi Daniel,
the Schema Diagram Editor example does it in the same way you want. Have a look the part.connectors package.


Luis