Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF3D » Dirty workaround fixes problem with Draw2D 3.6, GEF3D should now work with GEF 3.6
Dirty workaround fixes problem with Draw2D 3.6, GEF3D should now work with GEF 3.6 [message #663027] Sat, 02 April 2011 07:28
Jens von Pilgrim is currently offline Jens von Pilgrim
Messages: 293
Registered: July 2009
Senior Member
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
Previous Topic:OpenGL support for Draw2D; any news?
Next Topic:Errors while installing GEF3D on eclipse
Goto Forum:
  


Current Time: Fri Aug 22 08:02:05 EDT 2014

Powered by FUDForum. Page generated in 0.02229 seconds