Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 442971

Summary: Improve FXChopBoxAnchor to always use point inside outline for intersection calculations
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF FXAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand
Version: unspecified   
Target Milestone: 3.10.0 (Mars) M3   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Nyßen CLA 2014-08-31 23:36:06 EDT
Up to now, FXChopBoxAnchor computes anchor points based a node's outline and an intersection line starting at the center of the node's bounds. This is not failsafe (and we thus have a simple fallback), as there is no intersection point in such cases, where the bound's center is actually not inside the bound's shape (as in case of the E-shape in the MVC.FX example). We should ensure that we can always find an intersection point by always using a point inside the shape (i.e. the centroid of the outline curved polygon) as the starting point for the intersection line.
Comment 1 Matthias Wienand CLA 2014-09-26 10:23:14 EDT
I implemented a simple algorithm to find the vertex on the outline of the anchorage shape closest to the center point of the shape's bounds. The algorithm is used when the center point of the shape's bounds is outside of the shape.

I published the code on the master branch, therefore resolving this ticket as fixed for target milestone 3.10.0M2.

For the implementation of other (more sophisticated) algorithms, new tickets can be used (if needed).
Comment 2 Alexander Nyßen CLA 2014-09-30 15:49:01 EDT
I enhanced the implementation as follows: 
  - Extract FXChopBoxAnchor.ComputationStrategy interface.
  - Transferred FXChopBoxComputationStrategy into FXChopBoxAnchor.ComputationStrategy.Impl.
  - Reduced visibility of FXChopBox.ComputationStrategy.Impl methods as much as possible.
  - Extracted conversion method for GEF4 Geometry points into FXUtils.

These enhancements will be available in 3.10.0 M3.