Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Anchor covers figure
Anchor covers figure [message #1220920] Mon, 16 December 2013 08:05 Go to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Hi there,

in our editor, we have a lot of nodes with a label placed next to them, e.g. a circle with a label under it well outside the circle. Graphiti inherits GEF's good old clipping "feature", such that I have to use an invisible figure as a common container GA for label's Text and the Ellipse. Nevertheless, I want connections to connect to the Ellipse only.

I used a BoxRelative anchor with an (invisible) circle of the same size to achieve that and it works for connections. The problem is that this anchor now covers the figure in terms of selection, i.e. the figure is not selected when I click on it.

Am I missing something? Is there a workaround?

Thanks
Jan
Re: Anchor covers figure [message #1220942 is a reply to message #1220920] Mon, 16 December 2013 09:38 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 154
Registered: July 2009
Senior Member
Hi Jan,

I am not quite sure why you are creating a second invisible ellipse and not just set the referenced GA of the Anchor to the circle GA?
Would a ChopBoxAnchor on the ellipse be an alternative?

Andreas

[Updated on: Mon, 16 December 2013 09:43]

Report message to a moderator

Re: Anchor covers figure [message #1220958 is a reply to message #1220942] Mon, 16 December 2013 11:13 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
> I am not quite sure why you are creating a second invisible ellipse and
> not just set the referenced GA of the Anchor to the circle GA?

Correct me if I am wrong, but AFAIK the referenced GA of an Anchor is only used as a reference coordinate system for the placement and clipping of anchor's GA. This would not help me having edges at the border of the ellipse, as it deals with rectangular bounding boxes only.

Furthermore you *have to* set a child GA in a BoxRelativeAnchor otherwise you'll get NPEs. From what I know, the outline of this GA is the one defining where exactly the connecting point is located. So putting an ellipse will connect to the outline of the ellipse.

> Would a ChopBoxAnchor on the ellipse be an alternative?

You can only set anchors on PEs and the ellipse is a GA. Futhermore a chopbox anchor only takes the bounding box of the container's GA into account. That's why it doesn't need its own GA. It will once again not let connections touch the ellipse.

My current suspicion is that Graphiti just doesn't allow what I want to do. As it allows to drag an anchor for creating connections (as in the tutorial) anchors need to be selectable and that means I can only select the underlying PE where it exceeds the Anchor's bounds.

Can anybody confirm this?
Re: Anchor covers figure [message #1221007 is a reply to message #1220958] Mon, 16 December 2013 16:23 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Some corrections: The ChopBoxAnchor of the ellipse would work if the ellipse was the GA of the root pictogram element.
Unfortunately that is not possible, because I need the invisible rectangle to put the label next to the ellipse, so the rect is the GA of the root PE.

I've also experimented with setActive on various shapes but to no extend.
Re: Anchor covers figure [message #1221008 is a reply to message #1220920] Mon, 16 December 2013 16:30 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1618
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Jan,

the missing piece may be the method getSelection in your Tool Behavior
Provider. Override that and return the correct shape to select for your
shape.

HTH,
Michael
Re: Anchor covers figure [message #1221673 is a reply to message #1221008] Wed, 18 December 2013 07:54 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Thanks Michael, that will do it.
Re: Anchor covers figure [message #1231381 is a reply to message #1221008] Tue, 14 January 2014 14:27 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Finally got the time to try Michael's proposal, but it doesn't work: The anchor is never passed to the DiagramToolBehaviorProvider.getSelection(PictogramElement, PictogramElement[]) method but it is still selectable in the diagram. Any other suggestions?
Re: Anchor covers figure [message #1249748 is a reply to message #1231381] Tue, 18 February 2014 15:33 Go to previous message
Felix Velasco is currently offline Felix Velasco
Messages: 43
Registered: July 2009
Member
Have you trying returning the ellipse in DiagramToolBehaviorProvider.getChopboxAnchorArea(PictogramElement) ?

Using this, and (obviously) a ChopboxAnchor instead of the BoxRelative should work.
Previous Topic:The diagramUpdateFeature ignores isAutoUpdateAtRuntime
Next Topic:Diagrams Export
Goto Forum:
  


Current Time: Fri Oct 24 20:46:09 GMT 2014

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

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