Bug 112788 - API: Encapsulate MapMode / HiMetric coordinate system from clients
Summary: API: Encapsulate MapMode / HiMetric coordinate system from clients
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P1 enhancement
Target Milestone: 1.0   Edit
Assignee: Steven R. Shaw CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2005-10-17 10:23 EDT by Steven R. Shaw CLA
Modified: 2008-08-13 13:06 EDT (History)
7 users (show)

See Also:


Attachments
Design document describing the potential changes (383.50 KB, application/octet-stream)
2005-10-24 13:33 EDT, Steven R. Shaw CLA
no flags Details
Design document describing the refactoring (416.00 KB, application/octet-stream)
2005-10-27 16:16 EDT, Steven R. Shaw CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steven R. Shaw CLA 2005-10-17 10:23:11 EDT
- Try to move MapMode dependency out from the figure world.
- Allow greater reuse of existing GEF based figures and editparts.
- Support different coordinate systems?  (Potentially could be pushed to GEF).
Comment 1 Steven R. Shaw CLA 2005-10-17 21:57:04 EDT
The best to provide this is to support different scale factors.  To allow 
clients to fully reuse their figures, the scale factor would be set to 1.0.

Issues:
- Need to make sure all GMF figures are using MapMode to initialize defaults 
instead of hard-coding himetric values.
- Need to store scale factor in notation meta-model to ensure 
interoperability.  Different clients should be able to read diagrams with 
different scale factors.
- MapMode class could be hidden inside NodeFigure and other base class 
implementations.  i.e. have them implement the IMapMode interface.
Comment 2 Steven R. Shaw CLA 2005-10-17 22:11:44 EDT
- MapMode class would need to be stored somewhere.  It could not remain static 
as this will break with 2 domain editors open supporting different coordinate 
scale factors.
Comment 3 Steven R. Shaw CLA 2005-10-24 13:33:59 EDT
Created attachment 28702 [details]
Design document describing the potential changes

Design document describing the potential changes
Comment 4 Steven R. Shaw CLA 2005-10-27 16:16:56 EDT
Created attachment 28885 [details]
Design document describing the refactoring

Design document describing how to accommodate multiple coordinate systems.
Comment 5 Steven R. Shaw CLA 2005-10-27 16:18:14 EDT
Made some changes to design document based on initial development work.
- Moved MapModeTypes to public api.
- Removed dependency from DiagramRootEditPart to MapModeUtil
- Removed extra methods from MapModeUtil
- Created internal class DiagramMapModeUtil to encapsulate scale factor
Comment 6 Steven R. Shaw CLA 2005-10-28 10:35:44 EDT
Deliver initial refactoring of MapMode infrastructure to (No external API 
impact):
- Remove circular dependency between MapMode and HiMetricMapMode class
- Make IMapMode class public and make api consistent
- Introduce new public class MapModeUtil which is designed to replace old 
MapMode class which will be deprecated soon.  Has similar functionality except 
it introduces a method context.
- Introduce new public class MapModeTypes which will encapsule different 
IMapMode types available to clients.

Next phase:
- Sweep for all occurrences of MapMode in diagram layer and redirect to 
MapModeUtil.getMapMode(IFigure) instead.
- Notation meta-model support

Comment 7 Steven R. Shaw CLA 2005-11-01 17:49:06 EST
Comments on removing MapMode class:

If you are not concerned with reusing your figures with-in different Editors 
that have different coordinate systems then you can simply do a direct 
replacement of MapMode to MapModeUtil.getMapMode().  

Otherwise, to get maximum reuse out of your figures and editparts you would 
need to do the retrieve the IMapMode from an appropropriate context.Replace 
occurrences to MapMode with API as follows:

1. Referencing MapMode from within a Figure
MapMode.DPtoLP	--> 	MapModeUtil.getMapMode(this).DPtoLP

2. Referencing MapMode from within an EditPart
MapMode.DPtoLP	-->	getMapMode()  	(api defined on GraphicalEditPart)

3. Other contexts
If you have access to the DiagramRootEditPart, then it has the main access 
point to retrieve the IMapMode --> getMapMode()
Comment 8 Steven R. Shaw CLA 2005-11-08 11:07:57 EST
Delivered:
- Enabled IdentityMapMode in an example (GeoShapes example) 
- Fixed some issues with Note, Text and Bendpoint which had hard coded 
himetric values. 
- Moved CreateRootEditPartOperation into the public API to allow clients to 
install their own IMapMode for their Editor (see GeoShapes example)

Activities: 
bugzilla 112788 gmf-head sshaw 051108 API: Encapsulate MapMode / HiMetric 
coordinate system from clients

Note: I may close this enhancement with this delivery.  The remaining 
(potential) work is around interoperability (copy / paste) between different 
domains that utilize different map modes.  Clients should be able to utilize 
the IdentityMapMode with the current delivery to ease their GEF migration.  I 
may consider the interoperability in a different enhancement request.
Comment 9 Steven R. Shaw CLA 2005-11-14 09:25:16 EST
Resolving enhancement for M3.  

Follow-up enhancement for notation meta-model changes captured in 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=116224.
Comment 10 Richard Gronback CLA 2008-08-13 13:06:03 EDT
[target cleanup] 1.0 M3 was the original target milestone for this bug
Comment 11 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug