Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Changing anchor location and z-order of connections
Changing anchor location and z-order of connections [message #11688] Wed, 09 August 2006 10:59 Go to next message
Eclipse UserFriend
Originally posted by: gorillas.paradise.net.nz

I've just started using GMF, and I have worked my way through the
tutorial and am now starting on my own editor.

I have a diagram containing nodes and connections. The node figures are
ellipses with a solid white background and a 2-px width outline. The
connections are solid, 9-px width black lines. I want the connections to
anchor to the centre of the nodes, and for the nodes to be above the
connections in the z-order.

In other words, something like this:

/---\
-----| |-----
-----| |-----
\---/

(like on the London Tube map the way that the stations are on top of
continuous lines :-)

What I actually see is something like this:

/---\
---| | | |----
---| | | |----
\---/

Depending on the angle that the connection comes into the node at, there
can be quite a big gap between the end of the connection and the node. I
also don't want the user to be able to move the anchor point around -
there should just be the one anchor point in the centre of the node, so
I don't think connection decorations would do the trick.

I also want the z-order of the connection point to be lower than all the
other items in the diagram - there are different types of nodes that the
connections won't be connected, but I want the connections to appear
behind those nodes, not in front.

Is it possible to do these things with GMF?

TIA
--
Colin Sharples
Wellington, New Zealand
Re: Changing anchor location and z-order of connections [message #11725 is a reply to message #11688] Wed, 09 August 2006 11:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

Hello!

1. Connection anchors (see org.eclipse.draw2d.ConnectionAnchor) are
used to place connection ends so you may write your own anchor if none
of the existing ones do what you need. Standard EllipseAnchor places
connection ends on ellipse edge.

2. Nodes and connections are placed on different layers - you may swap
the layers so connections will always be above nodes (see
DiagramRootEditPart#createPrintableLayers()).

Colin Sharples wrote:
> I've just started using GMF, and I have worked my way through the
> tutorial and am now starting on my own editor.
>
> I have a diagram containing nodes and connections. The node figures are
> ellipses with a solid white background and a 2-px width outline. The
> connections are solid, 9-px width black lines. I want the connections to
> anchor to the centre of the nodes, and for the nodes to be above the
> connections in the z-order.
>
> In other words, something like this:
>
> /---\
> -----| |-----
> -----| |-----
> \---/
>
> (like on the London Tube map the way that the stations are on top of
> continuous lines :-)
>
> What I actually see is something like this:
>
> /---\
> ---| | | |----
> ---| | | |----
> \---/
>
> Depending on the angle that the connection comes into the node at, there
> can be quite a big gap between the end of the connection and the node. I
> also don't want the user to be able to move the anchor point around -
> there should just be the one anchor point in the centre of the node, so
> I don't think connection decorations would do the trick.
>
> I also want the z-order of the connection point to be lower than all the
> other items in the diagram - there are different types of nodes that the
> connections won't be connected, but I want the connections to appear
> behind those nodes, not in front.
>
> Is it possible to do these things with GMF?
>
> TIA
Re: Changing anchor location and z-order of connections [message #65378 is a reply to message #11725] Wed, 18 October 2006 14:32 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
Sorry, but it was not clear to me where to add the anchor.
i have a similar situation, and i want to connections to be placed only
at the left and right (the A's on the "figure" below) anchors of a figure.

-------
- -
----A A----
- -
-------

Can you help me on this?
thank you in advance!
Ugo


Dmitry Stadnik wrote:
> Hello!
>
> 1. Connection anchors (see org.eclipse.draw2d.ConnectionAnchor) are
> used to place connection ends so you may write your own anchor if none
> of the existing ones do what you need. Standard EllipseAnchor places
> connection ends on ellipse edge.
>
> 2. Nodes and connections are placed on different layers - you may
> swap the layers so connections will always be above nodes (see
> DiagramRootEditPart#createPrintableLayers()).
>
> Colin Sharples wrote:
>> I've just started using GMF, and I have worked my way through the
>> tutorial and am now starting on my own editor.
>>
>> I have a diagram containing nodes and connections. The node figures
>> are ellipses with a solid white background and a 2-px width outline.
>> The connections are solid, 9-px width black lines. I want the
>> connections to anchor to the centre of the nodes, and for the nodes to
>> be above the connections in the z-order.
>>
>> In other words, something like this:
>>
>> /---\
>> -----| |-----
>> -----| |-----
>> \---/
>>
>> (like on the London Tube map the way that the stations are on top of
>> continuous lines :-)
>>
>> What I actually see is something like this:
>>
>> /---\
>> ---| | | |----
>> ---| | | |----
>> \---/
>>
>> Depending on the angle that the connection comes into the node at,
>> there can be quite a big gap between the end of the connection and the
>> node. I also don't want the user to be able to move the anchor point
>> around - there should just be the one anchor point in the centre of
>> the node, so I don't think connection decorations would do the trick.
>>
>> I also want the z-order of the connection point to be lower than all
>> the other items in the diagram - there are different types of nodes
>> that the connections won't be connected, but I want the connections to
>> appear behind those nodes, not in front.
>>
>> Is it possible to do these things with GMF?
>>
>> TIA
Re: Changing anchor location and z-order of connections [message #71497 is a reply to message #65378] Mon, 30 October 2006 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: julias.frb.br

You just get the FixedConnectionAnchor from Logic Example and put this
on your XXXEditPart:


/**
* @generated NOT
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart
arg0) {
FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
getFigure());
fixedAnchor.offsetH = 120;
fixedAnchor.offsetV = 40;
//it creates an anchor for source on point 120,40
return fixedAnchor;
}


/**
* @generated NOT
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {

FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
getFigure());
fixedAnchor.offsetH = 120;
fixedAnchor.offsetV = 40;

return fixedAnchor;

}

/**
* @generated NOT
*/
@Override
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart
arg0) {
FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
getFigure());
fixedAnchor.offsetH = 0;
fixedAnchor.offsetV = 40;

return fixedAnchor;
}

/**
* @generated NOT
*/
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
getFigure());
fixedAnchor.offsetH = 0;
fixedAnchor.offsetV = 40;

return fixedAnchor;

}


Ugo Sangiorgi wrote:
> Sorry, but it was not clear to me where to add the anchor.
> i have a similar situation, and i want to connections to be placed only
> at the left and right (the A's on the "figure" below) anchors of a figure.
>
> -------
> - -
> ----A A----
> - -
> -------
>
> Can you help me on this?
> thank you in advance!
> Ugo
>
>
> Dmitry Stadnik wrote:
>> Hello!
>>
>> 1. Connection anchors (see org.eclipse.draw2d.ConnectionAnchor)
>> are used to place connection ends so you may write your own anchor if
>> none of the existing ones do what you need. Standard EllipseAnchor
>> places connection ends on ellipse edge.
>>
>> 2. Nodes and connections are placed on different layers - you may
>> swap the layers so connections will always be above nodes (see
>> DiagramRootEditPart#createPrintableLayers()).
>>
>> Colin Sharples wrote:
>>> I've just started using GMF, and I have worked my way through the
>>> tutorial and am now starting on my own editor.
>>>
>>> I have a diagram containing nodes and connections. The node figures
>>> are ellipses with a solid white background and a 2-px width outline.
>>> The connections are solid, 9-px width black lines. I want the
>>> connections to anchor to the centre of the nodes, and for the nodes
>>> to be above the connections in the z-order.
>>>
>>> In other words, something like this:
>>>
>>> /---\
>>> -----| |-----
>>> -----| |-----
>>> \---/
>>>
>>> (like on the London Tube map the way that the stations are on top of
>>> continuous lines :-)
>>>
>>> What I actually see is something like this:
>>>
>>> /---\
>>> ---| | | |----
>>> ---| | | |----
>>> \---/
>>>
>>> Depending on the angle that the connection comes into the node at,
>>> there can be quite a big gap between the end of the connection and
>>> the node. I also don't want the user to be able to move the anchor
>>> point around - there should just be the one anchor point in the
>>> centre of the node, so I don't think connection decorations would do
>>> the trick.
>>>
>>> I also want the z-order of the connection point to be lower than all
>>> the other items in the diagram - there are different types of nodes
>>> that the connections won't be connected, but I want the connections
>>> to appear behind those nodes, not in front.
>>>
>>> Is it possible to do these things with GMF?
>>>
>>> TIA
Re: Changing anchor location and z-order of connections [message #148736 is a reply to message #71497] Sat, 01 September 2007 09:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: blaent.gmx.de

Many thanks to Julia, it works fine!
After moving the figure the anchors are no longer fixed... How can I
achieve that?

Thanks for any help,
Markus


Julia Sartori wrote:
> You just get the FixedConnectionAnchor from Logic Example and put this
> on your XXXEditPart:
>
>
> /**
> * @generated NOT
> */
> @Override
> public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart
> arg0) {
> FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
> getFigure());
> fixedAnchor.offsetH = 120;
> fixedAnchor.offsetV = 40;
> //it creates an anchor for source on point 120,40
> return fixedAnchor;
> }
>
>
> /**
> * @generated NOT
> */
> @Override
> public ConnectionAnchor getSourceConnectionAnchor(Request request) {
>
> FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
> getFigure());
> fixedAnchor.offsetH = 120;
> fixedAnchor.offsetV = 40;
>
> return fixedAnchor;
>
> }
>
> /**
> * @generated NOT
> */
> @Override
> public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart
> arg0) {
> FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
> getFigure());
> fixedAnchor.offsetH = 0;
> fixedAnchor.offsetV = 40;
>
> return fixedAnchor;
> }
>
> /**
> * @generated NOT
> */
> @Override
> public ConnectionAnchor getTargetConnectionAnchor(Request request) {
> FixedConnectionAnchor fixedAnchor = new FixedConnectionAnchor(
> getFigure());
> fixedAnchor.offsetH = 0;
> fixedAnchor.offsetV = 40;
>
> return fixedAnchor;
>
> }
>
>
> Ugo Sangiorgi wrote:
>> Sorry, but it was not clear to me where to add the anchor.
>> i have a similar situation, and i want to connections to be placed
>> only at the left and right (the A's on the "figure" below) anchors of
>> a figure.
>>
>> -------
>> - -
>> ----A A----
>> - -
>> -------
>>
>> Can you help me on this?
>> thank you in advance!
>> Ugo
>>
>>
>> Dmitry Stadnik wrote:
>>> Hello!
>>>
>>> 1. Connection anchors (see org.eclipse.draw2d.ConnectionAnchor)
>>> are used to place connection ends so you may write your own anchor if
>>> none of the existing ones do what you need. Standard EllipseAnchor
>>> places connection ends on ellipse edge.
>>>
>>> 2. Nodes and connections are placed on different layers - you may
>>> swap the layers so connections will always be above nodes (see
>>> DiagramRootEditPart#createPrintableLayers()).
>>>
>>> Colin Sharples wrote:
>>>> I've just started using GMF, and I have worked my way through the
>>>> tutorial and am now starting on my own editor.
>>>>
>>>> I have a diagram containing nodes and connections. The node figures
>>>> are ellipses with a solid white background and a 2-px width outline.
>>>> The connections are solid, 9-px width black lines. I want the
>>>> connections to anchor to the centre of the nodes, and for the nodes
>>>> to be above the connections in the z-order.
>>>>
>>>> In other words, something like this:
>>>>
>>>> /---\
>>>> -----| |-----
>>>> -----| |-----
>>>> \---/
>>>>
>>>> (like on the London Tube map the way that the stations are on top of
>>>> continuous lines :-)
>>>>
>>>> What I actually see is something like this:
>>>>
>>>> /---\
>>>> ---| | | |----
>>>> ---| | | |----
>>>> \---/
>>>>
>>>> Depending on the angle that the connection comes into the node at,
>>>> there can be quite a big gap between the end of the connection and
>>>> the node. I also don't want the user to be able to move the anchor
>>>> point around - there should just be the one anchor point in the
>>>> centre of the node, so I don't think connection decorations would do
>>>> the trick.
>>>>
>>>> I also want the z-order of the connection point to be lower than all
>>>> the other items in the diagram - there are different types of nodes
>>>> that the connections won't be connected, but I want the connections
>>>> to appear behind those nodes, not in front.
>>>>
>>>> Is it possible to do these things with GMF?
>>>>
>>>> TIA
Re: Changing anchor location and z-order of connections [message #513227 is a reply to message #11688] Tue, 09 February 2010 12:42 Go to previous message
Bastian Roth is currently offline Bastian RothFriend
Messages: 19
Registered: September 2009
Junior Member
Hello,

I've the same problem. But your solution doesn't work with the current
version of GMF. So how is it possible to swap the node and connection
layers now?

thanks,
Bastian

Colin Sharples schrieb:
> I've just started using GMF, and I have worked my way through the
> tutorial and am now starting on my own editor.
>
> I have a diagram containing nodes and connections. The node figures are
> ellipses with a solid white background and a 2-px width outline. The
> connections are solid, 9-px width black lines. I want the connections to
> anchor to the centre of the nodes, and for the nodes to be above the
> connections in the z-order.
>
> In other words, something like this:
>
> /---\
> -----| |-----
> -----| |-----
> \---/
>
> (like on the London Tube map the way that the stations are on top of
> continuous lines :-)
>
> What I actually see is something like this:
>
> /---\
> ---| | | |----
> ---| | | |----
> \---/
>
> Depending on the angle that the connection comes into the node at, there
> can be quite a big gap between the end of the connection and the node. I
> also don't want the user to be able to move the anchor point around -
> there should just be the one anchor point in the centre of the node, so
> I don't think connection decorations would do the trick.
>
> I also want the z-order of the connection point to be lower than all the
> other items in the diagram - there are different types of nodes that the
> connections won't be connected, but I want the connections to appear
> behind those nodes, not in front.
>
> Is it possible to do these things with GMF?
>
> TIA
Previous Topic:About overriding existing code
Next Topic:How to add new DragDropEditPolicy
Goto Forum:
  


Current Time: Tue Mar 19 07:00:36 GMT 2024

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

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

Back to the top