Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Moveable Connection anchors
Moveable Connection anchors [message #206726] Thu, 05 January 2006 18:34 Go to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

All,

Is it possible to creat movable connection anchors within a figure? What
I want to do is allow the user to move the anchor along the path of the
outline border of the figure?

Thank you,
Harsh
Re: Moveable Connection anchors [message #206805 is a reply to message #206726] Fri, 06 January 2006 17:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

Hi,

all I can say right now is: yes, it is! However, as I did not implement
this myself, I cannot give you the details. My best advice is to look
around for some (open source) example plugin that has this feature.

christian

harsh wrote:
> All,
>
> Is it possible to creat movable connection anchors within a figure?
> What I want to do is allow the user to move the anchor along the path of
> the outline border of the figure?
>
> Thank you,
> Harsh
>
Re: Moveable Connection anchors [message #206814 is a reply to message #206805] Fri, 06 January 2006 18:48 Go to previous messageGo to next message
Hannes Niederhausen is currently offline Hannes NiederhausenFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

add a ConnectionEndpointEditPolicy to your ConnectionEditPart and overload
the method showConnectionMoveFeedback.
There you can set your anchor to the new position.

I've the problem, that the anchor while moving it has a fixed orientation.
Does anybody know hot to set the orientation of an anchor?

Hannes

Christian Sell wrote:

> Hi,
>
> all I can say right now is: yes, it is! However, as I did not implement
> this myself, I cannot give you the details. My best advice is to look
> around for some (open source) example plugin that has this feature.
>
> christian
>
> harsh wrote:
>> All,
>>
>> Is it possible to creat movable connection anchors within a figure?
>> What I want to do is allow the user to move the anchor along the path of
>> the outline border of the figure?
>>
>> Thank you,
>> Harsh
>>
Re: Moveable Connection anchors [message #206824 is a reply to message #206814] Fri, 06 January 2006 21:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Thank you Hannes.

As for the orientation, it is based on a static pointlist. The graphics
then uses this to fill and draw the polygon. Here is a code snippet..

static {
topConnector.addPoint(-2, 0);
topConnector.addPoint(1, 0);
topConnector.addPoint(2, 1);
topConnector.addPoint(2, 5);
topConnector.addPoint(-1, 5);
topConnector.addPoint(-1, 1);

bottomConnector.addPoint(-2, -1);
bottomConnector.addPoint(1, -1);
bottomConnector.addPoint(2, -2);
bottomConnector.addPoint(2, -6);
bottomConnector.addPoint(-1, -6);
bottomConnector.addPoint(-1, -2);
}
Re: Moveable Connection anchors [message #206829 is a reply to message #206814] Fri, 06 January 2006 22:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Hannes,

Have you implemented something similar? If so, do you mind sending me a
code snippet? Also, don't you have to extend the AbstractConnectionAnchor
and in your connection anchor have a setLocation method?

Also, ConnectionAnchors must have a figure as their owner. I am assuming
the figure then will also have to do the HitTest to see if the new
location region matches the outline of your figure correct? Also, do your
figures have a border?

Thank you,
Harsh
Re: Moveable Connection anchors [message #206845 is a reply to message #206829] Sat, 07 January 2006 09:43 Go to previous messageGo to next message
Hannes Niederhausen is currently offline Hannes NiederhausenFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

Look at the ChopBoxAnchor (that's what I did) and try to understand how this
Anchor works. I added a setLocation method to the anchor and checked the
given position with the figure border.

Sorry can't give you any code, 'cause I wrote that for a non Open source
project.

Hannes

Harsh wrote:

> Hannes,
>
> Have you implemented something similar? If so, do you mind sending me a
> code snippet? Also, don't you have to extend the AbstractConnectionAnchor
> and in your connection anchor have a setLocation method?
>
> Also, ConnectionAnchors must have a figure as their owner. I am assuming
> the figure then will also have to do the HitTest to see if the new
> location region matches the outline of your figure correct? Also, do your
> figures have a border?
>
> Thank you,
> Harsh
Re: Moveable Connection anchors [message #206909 is a reply to message #206845] Sun, 08 January 2006 19:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

I am quite sure Hannes can post the code, if you just wait a little..

el_bosso@gmx.de wrote:
> Hi,
>
> Look at the ChopBoxAnchor (that's what I did) and try to understand how this
> Anchor works. I added a setLocation method to the anchor and checked the
> given position with the figure border.
>
> Sorry can't give you any code, 'cause I wrote that for a non Open source
> project.
>
> Hannes
>
> Harsh wrote:
>
>> Hannes,
>>
>> Have you implemented something similar? If so, do you mind sending me a
>> code snippet? Also, don't you have to extend the AbstractConnectionAnchor
>> and in your connection anchor have a setLocation method?
>>
>> Also, ConnectionAnchors must have a figure as their owner. I am assuming
>> the figure then will also have to do the HitTest to see if the new
>> location region matches the outline of your figure correct? Also, do your
>> figures have a border?
>>
>> Thank you,
>> Harsh
>
Re: Moveable Connection anchors [message #207064 is a reply to message #206909] Tue, 10 January 2006 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

That would be much appreciated as I have a million other tasks on my plate
=).

Regards,
Harsh
Re: Moveable Connection anchors [message #207189 is a reply to message #207064] Wed, 11 January 2006 19:02 Go to previous messageGo to next message
Hannes Niederhausen is currently offline Hannes NiederhausenFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

Here is the code of my ConnectionEndpointEditPolicy implementation.

protected void showConnectionMoveFeedback(ReconnectRequest request) {
MoveableAnchor anchor;
ForeignKeyEditPart editPart = (ForeignKeyEditPart)
request.getConnectionEditPart();
if (!request.isMovingStartAnchor()) {
anchor = (MoveableAnchor) editPart.getTargetConnectionAnchor();
anchor.computeSlot(request.getLocation());
}
else {
anchor = (MoveableAnchor) editPart.getSourceConnectionAnchor();
anchor.computeSlot(request.getLocation());
}
request.setLocation(anchor.getLocation(request.getLocation() ));
super.showConnectionMoveFeedback(request);
}

Some explanations:
anchor.computeSlot calculates the new position of the anchor. It uses the
figure (look at ChopBoxAnchor.getBox()) then positions it in 7 slots (we
didn't want a 100% free positioning).
After that calculation we set the computed location to the new location of
the request and let the showConnectionMoveFeedback() of
ConnectionEndpointEditPolicy display the new position.

ForeignKeyEditpArt is our implementation of the AbstractConnectionEditPart.
It has the source and target anchor as private member.

Hope this will help a bit.
Re: Moveable Connection anchors [message #207192 is a reply to message #207189] Wed, 11 January 2006 19:13 Go to previous message
Eclipse UserFriend
Originally posted by: harsh.ti.com

This does help a lot.

Thank you very much. I owe you one.

Regards,
Harsh
Previous Topic:GEF & RCP Support?
Next Topic:painted Connection decorations get overwritten
Goto Forum:
  


Current Time: Wed Feb 05 07:00:28 GMT 2025

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

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

Back to the top