Bug 218170 - Extension of the snap to shape feature: Snap to distance
Summary: Extension of the snap to shape feature: Snap to distance
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-07 09:42 EST by Florian CLA
Modified: 2011-04-08 17:46 EDT (History)
1 user (show)

See Also:


Attachments
Example Screenshot (6.79 KB, image/png)
2008-02-07 09:46 EST, Florian CLA
no flags Details
Source files (17.93 KB, application/zip)
2008-02-07 09:47 EST, Florian CLA
no flags Details
Patch adopted to GEF 3.7 (51.25 KB, patch)
2011-04-08 17:46 EDT, Alexander Nyßen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian CLA 2008-02-07 09:42:57 EST
Hello GEF team,

we are two students of the Christian-Albrechts University of Kiel.
Currently we are participating in a course where we create features for
GMF generated editors.
Our task is to add the feature 'snap to distance' - snapping of objects
at simular distance of each other (see attachement).

We noticed that in M4 the snap to shape (geometry) is implemented. We
would like to contribute our extension of this which is implemented in a
simmilar way in GEF to the community.

Here is how you can add the snap to distance feature:

1) unfortunately, the feature has to be registered in GMF, so add to the SnapHelperUtil.java in org.eclipse.gmf.runtime.diagram.ui.internal.editparts to method getSnapHelper() at the end (*):
   snapStrategies.add(new SnapToDistanceEx(parent));   
2) add file SnapToDistanceEx.java to package org.eclipse.gmf.runtime.diagram.ui.internal.ruler;
3) add file SnapToDistance.java to package org.eclipse.gef
4) Replace file SnapFeedbackPolicy.java in org.eclipse.gef.editpolicies by SnapFeedbackPolicy.java (We will create a patch if you like the feature.)

Though we are not in the gef-dev list, please respond to fsch@informatik.uni-kiel.de or via comment here.

Best,
Sven and Florian

(*) we also added a button similar to the snap to shape button in the preference pane, but that's gmf and we will contact the gmf people after our feature is in gef :)
Comment 1 Florian CLA 2008-02-07 09:46:27 EST
Created attachment 89133 [details]
Example Screenshot

Example Screenshot
Comment 2 Florian CLA 2008-02-07 09:47:20 EST
Created attachment 89136 [details]
Source files
Comment 3 Alexander Nyßen CLA 2011-04-08 17:46:20 EDT
Created attachment 192882 [details]
Patch adopted to GEF 3.7

Nice! While I haven't looked into the details of your implementation yet, I have added a patch that adopts your source code to the changes made to the Draw2d precision geometry API in 3.7 (replaced all accesses to precision fields with calls to the getters/setters). I have also added code to apply it to the GEF logic example editor, so it can be evaluated without using GMF.

Unfortunately we are past API-freeze for 3.7 now, so this may not be considered before 3.8.