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

Bug 488353

Summary: Revise current default computation strategy of ChopBoxAnchor
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: cletavernier, matthias.wienand
Version: 0.2.0   
Target Milestone: 4.0.0 (Neon) M7   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 488354    
Bug Blocks:    

Description Alexander Nyßen CLA 2016-02-24 02:07:19 EST
The current strategy implemented to compute positions of a ChopBoxAnchor seems to be overly complicated and does not lead to intuitive results (it computes the vertex nearest to the center of the reference shape, and from there the outline point with the closest intersection towards the reference point). 

We should replace it with a strategy that retrieves the nearest point on the reference shape's outline to the given reference point as anchor position. We should also rename it to indicate this (maybe ShortestDistanceOnOutlineStrategy or something similar would be an adequate name).
Comment 1 Matthias Wienand CLA 2016-03-24 12:41:05 EDT
I refactored the code to provide a ProjectionStrategy and a ChopBoxStrategy. The ProjectionStrategy projects the reference point onto the anchorage outline. The ChopBoxStrategy computes intersections from the reference point to its anchorage center, however, if no intersections are found, it falls back to the ProjectionStrategy. The new ChopBoxStrategy is the new default strategy, because using the nearest point results in using the corners of nodes in most cases (which is unintuitive). The code is published on the master branch, therefore, I resolve this ticket as fixed for 4.0.0 M7.