| Summary: | Fix clipping related problems (with GEF/Draw2D 3.6) | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Jens Von Pilgrim <developer> |
| Component: | Gef3d | Assignee: | Project Inbox <gef3d.draw3d-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Jens Von Pilgrim
Fixed with a dirty workaround in rev. 561.
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.SINGLETON)))
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!
|