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

Bug 120411

Summary: SnapToGeometry.THRESHOLD should be retrieved via accessor method
Product: [Tools] GEF Reporter: Chris Lee <eclipse>
Component: GEF-Legacy GEF (MVC)Assignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 3.1   
Target Milestone: 3.4.0 (Ganymede) M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
add protected double getThreshold ()
none
added getThreshold / setThreshold nyssen: iplog+

Description Chris Lee CLA 2005-12-12 12:41:12 EST
Rather than use the static member THRESHOLD in SnapToGeometry, an overridable accessor 'protected double getThreshold()' should be used instead.  This will allow subclasses to easily change the threhold used without overriding every single method that requires knowledge of the threshold.

Would it be possible to get this in for 3.2?
Comment 1 Randy Hudson CLA 2005-12-12 13:17:34 EST
Could you submit a patch against the latest code in HEAD?
Comment 2 Chris Lee CLA 2005-12-12 16:29:01 EST
Sure; I'll get that done later this week.
Comment 3 Chris Lee CLA 2005-12-14 12:25:26 EST
Created attachment 31761 [details]
add protected double getThreshold ()

added & hooked up getThreshold() method
Comment 4 Chris Lee CLA 2006-07-05 19:10:34 EDT
Hey guys; any word on when we'll be able to use this?  

An alternative to this patch would be to make THRESHOLD non-final; the issue is that we need to set a custom threshold.
Comment 5 Chris Lee CLA 2006-12-20 17:16:56 EST
This has become an issue, as we need to set a custom threshold.  The main place where we need to use this has a zoom UI multiplier of 15 set, making the THRESHOLD of 5 very useless - we would need to change the THRESHOLD to 75 to get the same effect.

Currently, we have a copy-paste of SnapToGeometry with the patch implemented on it, however, I've been advised that we can't actually use that version for shipping our product.

Is there anything blocking this patch from being accepted?
Comment 6 Randy Hudson CLA 2006-12-20 17:35:07 EST
I wonder why the threshold is not determined in absolute coordinates rather than relative?

Do you not also want a setThreshold method so you wouldn't have to subclass?
Comment 7 Chris Lee CLA 2006-12-20 17:54:10 EST
Created attachment 56006 [details]
added getThreshold / setThreshold

created patch with getThreshold/setThreshold based on current HEAD version.

In response to comment #6 - the threshold being in relative coordinates seems alright to me - I would like it to scale as I zoom.  The main issue is that it doesn't account for different UI multipliers (or those who want to change the threshold from the default to be some other customized number)
Comment 8 Anthony Hunter CLA 2007-08-14 15:16:14 EDT
Committed to HEAD.

Note that I made both methods protected as requested (and not what was in the patch).