Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » self-referencing connections
self-referencing connections [message #190522] Thu, 04 August 2005 13:27 Go to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

Hello,

does GEF support self-referencing connections? I am currently experiencing
problems, in that self-referecing connections are displayed with the
outgoing end pointing into the free diagram space, instead of back to the
originating table.

Just wanted to ask before I delve into the GEF (and my own) codebase.

thanks,
christian
Re: self-referencing connections [message #190530 is a reply to message #190522] Thu, 04 August 2005 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

never mind. There is no problem with self-referencing connections as such.
However, the ManhattanConnectionRouter does a pretty bad job in
visualizing them. Does anyone have a better suggestion, or do I have to
roll my own?

thanks,
chris
Re: self-referencing connections [message #190577 is a reply to message #190530] Thu, 04 August 2005 17:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

The EDiagram example automatically introduces some manual bendpoints in such
cases so that the connections are better seen. A better way to do this,
however, would be to have your router (probably in its route() method)
introduce some automatic bendpoints for self-referencing connections that
have no manual bendpoints. These would be relative to the node and hence
work much better than manual bendpoints. None of our routers do this, so
you'll have to subclass the one you're using.

You should be able to get this done in a generic way using the
AutomaticRouter. Maybe you can make a contribution to GEF.

"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
> never mind. There is no problem with self-referencing connections as such.
> However, the ManhattanConnectionRouter does a pretty bad job in
> visualizing them. Does anyone have a better suggestion, or do I have to
> roll my own?
>
> thanks,
> chris
>
Re: self-referencing connections [message #190602 is a reply to message #190530] Thu, 04 August 2005 19:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Regardless of your solution, you should open a feature request for better
handling of self-referencing connections.

"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
> never mind. There is no problem with self-referencing connections as such.
> However, the ManhattanConnectionRouter does a pretty bad job in
> visualizing them. Does anyone have a better suggestion, or do I have to
> roll my own?
>
> thanks,
> chris
>
Re: self-referencing connections [message #190610 is a reply to message #190602] Thu, 04 August 2005 22:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

Pratik,

I have looked into the problem, and have found that the solution is more
in the reponsibility of the connection anchor. All I need to do is to
add special handling for the self-reference case in the getLocation(xx)
method and make sure the source and target anchors are positioned such
that the connection router will draw a nice line between them.

At least the ManhattanConnectionRouter does a rather nice job if,for
example, I place the source and target anchors at getBounds().getLeft()
and getBounds().getTop(), respectively.

There do however remain enough challenges in the connection
routing/anchoring field..

regards,
chris

Pratik Shah wrote:
> Regardless of your solution, you should open a feature request for better
> handling of self-referencing connections.
>
> "Christian Sell" <christian.sell@netcologne.de> wrote in message
> news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
>
>>never mind. There is no problem with self-referencing connections as such.
>>However, the ManhattanConnectionRouter does a pretty bad job in
>>visualizing them. Does anyone have a better suggestion, or do I have to
>>roll my own?
>>
>>thanks,
>>chris
>>
>
>
>
Re: self-referencing connections [message #190684 is a reply to message #190610] Fri, 05 August 2005 16:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

You can fix it that way, but I wouldn't say it's the ConnectionAnchor's
responsibility to avoid this case. Even if the start and endpoints are the
same exact point, the router should be able to show the connection in a
clear manner. Plus, I don't think anchors like ChopboxAnchor can do what
you suggest (at least not without violating some OO principles -- your
anchor probably does that too).

"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:dcu60u$kvm$1@news.eclipse.org...
> Pratik,
>
> I have looked into the problem, and have found that the solution is more
> in the reponsibility of the connection anchor. All I need to do is to
> add special handling for the self-reference case in the getLocation(xx)
> method and make sure the source and target anchors are positioned such
> that the connection router will draw a nice line between them.
>
> At least the ManhattanConnectionRouter does a rather nice job if,for
> example, I place the source and target anchors at getBounds().getLeft()
> and getBounds().getTop(), respectively.
>
> There do however remain enough challenges in the connection
> routing/anchoring field..
>
> regards,
> chris
>
> Pratik Shah wrote:
> > Regardless of your solution, you should open a feature request for
better
> > handling of self-referencing connections.
> >
> > "Christian Sell" <christian.sell@netcologne.de> wrote in message
> > news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
> >
> >>never mind. There is no problem with self-referencing connections as
such.
> >>However, the ManhattanConnectionRouter does a pretty bad job in
> >>visualizing them. Does anyone have a better suggestion, or do I have to
> >>roll my own?
> >>
> >>thanks,
> >>chris
> >>
> >
> >
> >
Re: self-referencing connections [message #190754 is a reply to message #190684] Fri, 05 August 2005 18:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

Pratik Shah wrote:
> You can fix it that way, but I wouldn't say it's the ConnectionAnchor's
> responsibility to avoid this case. Even if the start and endpoints are the
> same exact point, the router should be able to show the connection in a
> clear manner.

well, it may be up to the router what to do in a case where start and
end are the same, but it is the the connection anchors that make (or
bear) the decision where start and end are located. In the case of a
self-referencing relationship, I would not want to have start and end at
the same point anyway, so IMO it is the connection anchors that have to
take action. My solution is this:

In method NodeEditPart#get[Source/Target]ConnectionAnchor() I can easily
determine whether this is a self-referencing connection by comparing the
parameter editpart with the editpart that receives the message:

public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart c)
{
return new CustomChopboxAnchor(getFigure(), connection.getTarget()
== this);
}

Note that there is no complex coordinate computation needed. My
CustomChopboxAnchor only specifically handles the self-reference case
(in method getLocation()), by placing the connection source at the top
center and the connection target at the right. All other cases are
passed to the inherited implementation. That way, self-referencing
connections go around the top right corner of the figure.

I dont see how this violates OO principles, or even how the Router could
do a better job at this. Again, it is the routers job to determine the
path between 2 points, but it is the anchors job to set the points. My
problem is (was) about the points, not the route.

I still need to figure out a way to handle multiple self-references, by
spreading out their connections. I could use help from the router here,
because at least the ManhattanRouter draws connections that have the
same source and target points so close to eachother that they are hardly
distinguishable.

My feeling is that this subject of routing/anchoring still bears a good
number of challenges, at least for my use case.

Christian


Plus, I don't think anchors like ChopboxAnchor can do what
> you suggest (at least not without violating some OO principles -- your
> anchor probably does that too).
>
> "Christian Sell" <christian.sell@netcologne.de> wrote in message
> news:dcu60u$kvm$1@news.eclipse.org...
>
>>Pratik,
>>
>>I have looked into the problem, and have found that the solution is more
>>in the reponsibility of the connection anchor. All I need to do is to
>>add special handling for the self-reference case in the getLocation(xx)
>>method and make sure the source and target anchors are positioned such
>>that the connection router will draw a nice line between them.
>>
>>At least the ManhattanConnectionRouter does a rather nice job if,for
>>example, I place the source and target anchors at getBounds().getLeft()
>>and getBounds().getTop(), respectively.
>>
>>There do however remain enough challenges in the connection
>>routing/anchoring field..
>>
>>regards,
>>chris
>>
>>Pratik Shah wrote:
>>
>>>Regardless of your solution, you should open a feature request for
>
> better
>
>>>handling of self-referencing connections.
>>>
>>>"Christian Sell" <christian.sell@netcologne.de> wrote in message
>>>news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
>>>
>>>
>>>>never mind. There is no problem with self-referencing connections as
>
> such.
>
>>>>However, the ManhattanConnectionRouter does a pretty bad job in
>>>>visualizing them. Does anyone have a better suggestion, or do I have to
>>>>roll my own?
>>>>
>>>>thanks,
>>>>chris
>>>>
>>>
>>>
>>>
>
>
Re: self-referencing connections [message #190783 is a reply to message #190754] Fri, 05 August 2005 20:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

BTW, alternatively one could implement a SelfReferenceAnchor and return
that from getSource/TargetConnectionAnchor for the self reference case,
and the normal ChopBoxAnchor otherwise
Re: self-referencing connections [message #190872 is a reply to message #190754] Sat, 06 August 2005 20:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:dd0c9v$sfd$1@news.eclipse.org...
> Pratik Shah wrote:
> > You can fix it that way, but I wouldn't say it's the ConnectionAnchor's
> > responsibility to avoid this case. Even if the start and endpoints are
the
> > same exact point, the router should be able to show the connection in a
> > clear manner.
>
> well, it may be up to the router what to do in a case where start and
> end are the same, but it is the the connection anchors that make (or
> bear) the decision where start and end are located. In the case of a
> self-referencing relationship, I would not want to have start and end at
> the same point anyway, so IMO it is the connection anchors that have to
> take action. My solution is this:
>
> In method NodeEditPart#get[Source/Target]ConnectionAnchor() I can easily
> determine whether this is a self-referencing connection by comparing the
> parameter editpart with the editpart that receives the message:
>
> public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart c)
> {
> return new CustomChopboxAnchor(getFigure(), connection.getTarget()
> == this);
> }
>
> Note that there is no complex coordinate computation needed. My
> CustomChopboxAnchor only specifically handles the self-reference case
> (in method getLocation()), by placing the connection source at the top
> center and the connection target at the right. All other cases are
> passed to the inherited implementation. That way, self-referencing
> connections go around the top right corner of the figure.
>
> I dont see how this violates OO principles, or even how the Router could
> do a better job at this. Again, it is the routers job to determine the

Fair enough. I suspected you might be having the anchor somehow determine
whether the connection is self-referencing, but your solution sounds fine.
However, I still think the router would be a better place to fix this
because then you wouldn't need multiple chopbox anchors for the same
editpart. Plus, the router would fix this in an anchor-independent manner.
Also, it would be able to handle the case where the start and end locations
were the same exact point.

> path between 2 points, but it is the anchors job to set the points. My
> problem is (was) about the points, not the route.
>
> I still need to figure out a way to handle multiple self-references, by
> spreading out their connections. I could use help from the router here,
> because at least the ManhattanRouter draws connections that have the
> same source and target points so close to eachother that they are hardly
> distinguishable.
>
> My feeling is that this subject of routing/anchoring still bears a good
> number of challenges, at least for my use case.
>
> Christian
>
>
> Plus, I don't think anchors like ChopboxAnchor can do what
> > you suggest (at least not without violating some OO principles -- your
> > anchor probably does that too).
> >
> > "Christian Sell" <christian.sell@netcologne.de> wrote in message
> > news:dcu60u$kvm$1@news.eclipse.org...
> >
> >>Pratik,
> >>
> >>I have looked into the problem, and have found that the solution is more
> >>in the reponsibility of the connection anchor. All I need to do is to
> >>add special handling for the self-reference case in the getLocation(xx)
> >>method and make sure the source and target anchors are positioned such
> >>that the connection router will draw a nice line between them.
> >>
> >>At least the ManhattanConnectionRouter does a rather nice job if,for
> >>example, I place the source and target anchors at getBounds().getLeft()
> >>and getBounds().getTop(), respectively.
> >>
> >>There do however remain enough challenges in the connection
> >>routing/anchoring field..
> >>
> >>regards,
> >>chris
> >>
> >>Pratik Shah wrote:
> >>
> >>>Regardless of your solution, you should open a feature request for
> >
> > better
> >
> >>>handling of self-referencing connections.
> >>>
> >>>"Christian Sell" <christian.sell@netcologne.de> wrote in message
> >>>news:45e12a03a06aa040188f6003ca70e669$1@www.eclipse.org...
> >>>
> >>>
> >>>>never mind. There is no problem with self-referencing connections as
> >
> > such.
> >
> >>>>However, the ManhattanConnectionRouter does a pretty bad job in
> >>>>visualizing them. Does anyone have a better suggestion, or do I have
to
> >>>>roll my own?
> >>>>
> >>>>thanks,
> >>>>chris
> >>>>
> >>>
> >>>
> >>>
> >
> >
Re: self-referencing connections [message #190908 is a reply to message #190872] Sat, 06 August 2005 22:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

Pratik Shah wrote:
> Fair enough. I suspected you might be having the anchor somehow determine
> whether the connection is self-referencing, but your solution sounds fine.

well, if I look at org.eclipse.gef.examples.flow.parts.BottomAnchor,
line 34, it looks to me like it is doing just what you mention
(determining a self-reference). I did it that way at first, but then
switched to my solution.

> However, I still think the router would be a better place to fix this
> because then you wouldn't need multiple chopbox anchors for the same
> editpart. Plus, the router would fix this in an anchor-independent manner.
> Also, it would be able to handle the case where the start and end locations
> were the same exact point.

As I see it, I will always need separate anchors for self-references, as
I want to have them show up around the top-right corner of the figure.
Also, the ChopboxAnchor is unusable in such a context, as it uses an
outside reference point to compute the direction of the connection -
which is meaningless in the case of a self-reference.

It would, of course, be good if the router also took care of
self-references and of the special case where start and end location are
identical, e.g. by avoiding the figure area. But IMO this is a feature
of each individual router implementation - it is not prescribed by the
ConnectionRouter interface. Every router may handle it completely
differently.

I am open to further directions. I am looking for a router with
orthogonal, moveable segments. If I dont find a one, I may have to
tackle that issue anyway.

regards,
christian
Re: self-referencing connections [message #191115 is a reply to message #190908] Mon, 08 August 2005 19:47 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> well, if I look at org.eclipse.gef.examples.flow.parts.BottomAnchor, line
> 34, it looks to me like it is doing just what you mention (determining a
> self-reference). I did it that way at first, but then switched to my
> solution.

My guess is that it looks to see if it is connected to something inside
itself like a child. Your solution sounds fine and it's one of the reasons
why we haven't had to actually handle self-connection in a robust way ...
yet.
Previous Topic:Non-rectangular clipping
Next Topic:Curved connnections
Goto Forum:
  


Current Time: Tue Dec 03 09:44:59 GMT 2024

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

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

Back to the top