Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drawing outside a Figure's bounds
Drawing outside a Figure's bounds [message #249042] Sun, 24 May 2009 13:10 Go to next message
Gerrit  is currently offline Gerrit Friend
Messages: 30
Registered: July 2009
Member
For a GEF editor, I'd like to draw a little crosshair for each shape that
I'm displaying, indicating its point of origin. The crosshair should just
be visible, but not be selectable or change the figure's bounds.

When I'm drawing it using the Figure's paintFigure(Graphics) method, it
isn't visible if it's not inside the figure's bounds.

Is there some way to temporarily expand the clipping area without changing
the bounds?

Or would it be easier to have the crosshair be a separate figure, that is
somehow linked to the shape, and updated together with it?

Regards,
Gerrit
Re: Drawing outside a Figure's bounds [message #249163 is a reply to message #249042] Thu, 04 June 2009 05:34 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

This is possible. In GMF there's a cncept of a BorderedNodeFigure and
BorderItemContainerFigure.
However, I'd advice not to play around with clipping regions.
Try combining the crosshair with the figure it's associated with, so
bounds of the figure include the crosshair. Paint the crosshair within
your figure paintFigure method, make sure you don't call fillRectangle or
any fill methods on the big bounds (might as well set opaque flag on the
figure). For the figure override #containtPoint(x,y) such that it returns
true for the point inside your "main" figure. Also you'd probaly have to
override #handleBounds() on the editpart to show the selection and re-size
handles on the "main" figure only. Some edit policies may need to be
overriden.

Also alternative solution can be found. Show crosshair when the shape is
selected for example... In this case you'd show the crosshair in the
"handle" layer, such that you don't have to worry about clipping etc.

Hope this helps.

Cheers,
Alex
Previous Topic:Clipping area
Next Topic:Connections on top
Goto Forum:
  


Current Time: Mon Nov 24 22:53:14 GMT 2014

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

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