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
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?
This is possible. In GMF there's a cncept of a BorderedNodeFigure and
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
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.