Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Autoresize - keep aspect ratio
Autoresize - keep aspect ratio [message #1743981] Wed, 21 September 2016 09:46 Go to next message
Emil Jenotte is currently offline Emil JenotteFriend
Messages: 25
Registered: September 2016
Junior Member
Hello,

I have a question about auto resizing.
I have two containers represented by a simple circle and a square (Workspace Image). I want the graphical elements to auto resize according to what ever objects are added to the container. That works perfectly fine.
But I would love my containers to always maintain their aspect ratio, so that the circle does not suddenly become an oval and the square does not become a rectangular with unequal side lengths.
Unfortunately I see no option to mark this behavior.
Is there and option - or a workaround?

Cheers
Emil
Re: Autoresize - keep aspect ratio [message #1743987 is a reply to message #1743981] Wed, 21 September 2016 10:01 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Emil,

The behavior you want might require some code on your side, I currently see several ways:
. custom figure / layout provider which will always keep your square/circle aspect
. specific resize edit policy to customize the resize commands and feedback and force user interactions to keep the ratio
. precommitListener/ModelChangeTrigger which will maintain this aspect directly in the GMF model bounds.

If you want to keep the auto-size behavior (GMF bounds set to -1, -1), you will need the first one.
To controle the interaction of your users, you will need 2 and 3.

Regards
Re: Autoresize - keep aspect ratio [message #1744184 is a reply to message #1743987] Fri, 23 September 2016 08:47 Go to previous messageGo to next message
Emil Jenotte is currently offline Emil JenotteFriend
Messages: 25
Registered: September 2016
Junior Member
Hello Maxime,

thank you for your answer.

I would like to keep the resize behavior. But I can not go for (1) "custom figure", because the elements are containers. So my "Style" options are: (a) Workspace Image, (b) Gradient, (c) Parallelogram

If I would want to go for (2), where do I specify the resize edit policy ?

Cheers
Emil
Re: Autoresize - keep aspect ratio [message #1744221 is a reply to message #1744184] Fri, 23 September 2016 12:49 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Emil,

For both, you will need to go through the GMF extension points to provide an edit policy provider or an edit part provider to override the ones provided by Sirius (org.eclipse.gmf.runtime.diagram.ui.editpartProviders, org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders).

You will need to analyze the view for which you have to provide to identify your case:
view.getModel() should return a DDiagramElement
DDiagramElement.getDiagramElementMapping() to retrieve the mapping
Then you can query the name (displayed as id in the VSM editor) to check that you provide a policy/part for your case.

You might take a look to EcoreTools, UMLDesigner and InfomationSystem to see how Cédric, Mélanie and Jérôme did it :
. http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design.ui/plugin.xml
. https://github.com/ObeoNetwork/UML-Designer/blob/master/plugins/org.obeonetwork.dsl.uml2.design/plugin.xml
. https://github.com/ObeoNetwork/InformationSystem/blob/master/designs/is/plugins/org.obeonetwork.dsl.is.design/src/org/obeonetwork/dsl/is/design/ui/providers/EditPolicyProvider.java


Regards

Maxime
Previous Topic:Container drop drug
Next Topic: Authorized Sides missing at Conditional Style
Goto Forum:
  


Current Time: Fri Apr 19 21:08:26 GMT 2024

Powered by FUDForum. Page generated in 0.03025 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top