Bug 509469 - Allow specifiers to specify the resulting shape of 'Workspace Image' styles.
Summary: Allow specifiers to specify the resulting shape of 'Workspace Image' styles.
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-12-19 11:53 EST by Florent Latombe CLA
Modified: 2016-12-22 09:45 EST (History)
1 user (show)

See Also:


Attachments
Illustrative example project. (21.17 KB, application/zip)
2016-12-19 11:53 EST, Florent Latombe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florent Latombe CLA 2016-12-19 11:53:50 EST
Created attachment 265951 [details]
Illustrative example project.

When using a 'Workspace Image' style for a mapping, the resulting shape is, by default, a square. Its width may be enlarged so that its label fits within the shape. The size of that square is an issue of its own (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=508050 - TL;DR 'Size Computation Expression' is ignored for Containers).

In case of an SVG file, the image can specify how its ratio should be handled by resizing through the 'preserveAspectRatio' attribute.
For some images, preserving the original ratio is important. This can be done through a variety of values for the 'preserveAspectRatio' attribute (cf. http://tutorials.jenkov.com/svg/svg-viewport-view-box.html#preserving-aspect-ratio).

However, in Sirius, the resulting shape for a 'Workspace Image' style is always a square (possibly reshaped due to the label's width). This results in poor experience for the diagram end user: there is a lot of "blank space" on the shape, so they usually have to resize it manually (provided it is even allowed).

The specifier should be able to specify shapes other than square for 'Workspace Image' style. This could be done for instance by using 'width' and 'height' attributes as in the 'parallelogram' or 'square' styles; or by relying on the figure's ratio.

Note: this enhancement description is based on Sirius 3.1.3.201511201007

---

To illustrate this issue, import the attached project into your workspace, and open the aird file in the 'model/' folder. 

When you create a new EClass using the tool from the palette, there two nodes are created:

* One node entitled 'none' represents the EClass with an SVG file using 'preserveAspectRatio="none"'. The image ratio is modified to fit the square shape created, as expected. => OK.

* Another node entitled 'meet' uses 'preserveAspectRatio="xMinYMax meet"'. This shape is also a square, but the image is a rectangle (due to the initial ratio of the SVG file used). There is blank space between the label and the keyboard (more visible if you scale the shape using shift + left click to compensate for bug #508050 - we can't make the initial shape bigger). => KO.
When the SVG to render is very wide, the resulting shape is unpractical, i.e. there is a lot of blank space between the label and the image. With the solution of relying on the figure's ratio to determine the dimensions of the shape, the shape would instead be a rectangle exactly fitting the image.