GMF Asymmetric grid [message #986912] |
Thu, 22 November 2012 10:56 |
Thomas Jouve Messages: 1 Registered: October 2012 |
Junior Member |
|
|
Hi,
I am currently dealing with a model where object position and size are based on an asymmetric scale.
Thats means that an object with a size of (1,1) in model may be displayed as a figure with a size of (5,8). Currently I adapt my model object position and size in my EditParts#refreshBounds() function.
I was wondering if there is a more generic way to doing this.
I also starting to search a way to configure an asymmetric grid and ruler for my diagram. I particular I was questioning myself about the IMapMode which comment said :
Objects implementing this interface are responsible for mapping the units in the model to pixles but I am not sure this is the good way to achieve this.
I the same time I found DiagramRootEditPart which deal with the diagram layer. But it seems it configure and use a symmetric grid.
Currently I just override createPartControl in my XXXDiagramEditor whith
((DiagramRootEditPart) getDiagramEditPart().getRoot()).getViewer().setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(5, 8));
And I am using a custom ruler for displaying correct metrics.
Should I overload DiagramRootEditPart Class and defined my own grid option/rulers or is there an other way to achieve my goal ?
Did someone have any feedback on such implementation ?
[Updated on: Thu, 22 November 2012 13:13] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02993 seconds