Dirty workaround fixes problem with Draw2D 3.6, GEF3D should now work with GEF 3.6 [message #663027] |
Sat, 02 April 2011 07:28 |
Eclipse User |
|
|
|
Hi,
the update from Draw2D 3.5 to 3.6 introduces a new feature in Figure: a
clipping strategy. With this new strategy, the paintChildren method has
been slightly changed, which causes problems with GEF3D: in some cases,
no figures are painted anymore.
I have analyzed the problem and it can be reduced to a change of
behavior in paintChildren(..), which may also effects pure 2D
implementations:
In version 3.5, in Figure.paintChildren(Graphics) the following
(slightly simplfied) condition is checked to decide whether a child is
to be drawn or not:
if (child.intersects(graphics.getClip(Rectangle.SINGLETON)))
In version 3.6, the rectangles of the clipping strategy are tested. If
no clipping strategy is provided, the clipping rectangle used in 3.6
usually is simply the bound of the child. Simplified, that means the
following condition is checked:
if (child.getBounds().intersects(graphics.getClip(Rectangle.SIN GLETON)))
Unfortunately, this is a change of the behavior:
child.intersects(..) vs. child.getBounds().intersects(..)
In GEF3D, Figure3D.intersects(..) is overridden and always returns true.
We changed that, since redrawing is differently handled in Draw3D, as in
case of a redraw, the whole 3D scene has to be redrawn, and there are no
dirty areas.
I have added a workaround in Draw3D rev. 561 which returns a special
rectangle in Figure3D.getBounds():
public Rectangle getBounds() {
return new Rectangle(super.getBounds()) {
..
@Override
public boolean intersects(Rectangle i_rect) {
return true;
}
};
}
I'm well aware that this is a dirty dirty workaround, as is the whole
handling of clipping and dirty regions in GEF3D/Draw3D. Volunteers
refactoring that issues are welcome!
I post this issue here, because I'm not completely sure whether this
really fixes the problem when updating to GEF 3.6 or not, and it may
introduces other problems.
Cheers,
Jens
|
|
|
Powered by
FUDForum. Page generated in 0.04811 seconds