Skip to main content



      Home
Home » Eclipse Projects » GEF » Dynamically change the anchor points.
Dynamically change the anchor points. [message #167055] Sat, 05 February 2005 01:27 Go to next message
Eclipse UserFriend
Originally posted by: jsk_lam.hotmail.com

Hi,

I would like to change the anchor point of the figure dynamically
and programmatically based on the orientation of the nodes.
For example, the following diagram shows the link that connects
figure A and B on either left or right side of the figure:

A <---------> B

B <---------> A

Could someone please help on this?

Thanks,
SL
Re: Dynamically change the anchor points. [message #167063 is a reply to message #167055] Sat, 05 February 2005 04:07 Go to previous messageGo to next message
Eclipse UserFriend
slam wrote:

> Hi,
>
> I would like to change the anchor point of the figure dynamically
> and programmatically based on the orientation of the nodes.
> For example, the following diagram shows the link that connects
> figure A and B on either left or right side of the figure:
>
> A <---------> B
>
> B <---------> A
>
> Could someone please help on this?
>
> Thanks,
> SL

What I did was, I put the calculation of the anchor points inside the figure
and let validate() call the calculation method which in turn fills a List
with all valid anchors.

Looking at your drawing, some questions come to my mind:

Why not having one (or more) anchors at the left and right hand side of your
figure? Each of them could be used to connect.

Why not using ChopboxAnchor, which "automatically" places the anchor point
on the right edge.


Regards,
Fabian
Re: Dynamically change the anchor points. [message #167226 is a reply to message #167055] Sun, 06 February 2005 17:44 Go to previous message
Eclipse UserFriend
slam wrote:

> Hi,
>
> I would like to change the anchor point of the figure dynamically
> and programmatically based on the orientation of the nodes.
> For example, the following diagram shows the link that connects
> figure A and B on either left or right side of the figure:
>
> A <---------> B
>
> B <---------> A
>
> Could someone please help on this?
>
> Thanks,
> SL
>
>
I did this by creating my own anchor that "decided" which side to place
itself on in its getLocation method. If you look at the source for
ChopBoxAnchor you will see a more general version of this. In
particular pay attention to the conversions to/from absolute coordinates
- that tripped me up for a while.
Previous Topic:Coordinate movement of separate EditPart figures
Next Topic:Serialization error
Goto Forum:
  


Current Time: Sat May 10 10:14:06 EDT 2025

Powered by FUDForum. Page generated in 0.02845 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top