Custom style shapes [message #1835170] |
Thu, 26 November 2020 04:57  |
Eclipse User |
|
|
|
Hi,
My metamodel have a class with an image path attribute.
I use this attribute to change the shape (workspace image) dynamically with style customizations.
But, as we can do with other styles, I want to:
- Set the color dynamically based on an attribute;
- Let the user able to paint the element color;
- Plus: Besides color, I want to add texture (is that possible?).
So, I think I will need to create custom styles for each shape.
I already read the documentation: Provide custom style.
But, I still a little lost as:
- Where create the StyleConfiguration implementations?
- I need to create a GMF project?
Have a tutorial or a similar source code available?
Seeing a full implementation may help me.
Thanks for your time and any contribution!
Jaqueline
|
|
|
Re: Custom style shapes [message #1835348 is a reply to message #1835170] |
Tue, 01 December 2020 05:35  |
Eclipse User |
|
|
|
Hello,
I don't think you need to create custom styles for the two first at least:
- Set the color dynamically based on an attribute: You have two options here. The first one is that in your layer, you add Style Customization that will change the color based on an attribute (so 1 Style customization per attribute value). The other option is to create a "Computed Color" (You can create a palette under the root of the odesign) where the red, green and blue fields are expression so you can have a service to determine it based on the attribute value.
- Let the user able to paint the element color: It is already available, in the tabbar you have a tool with the tooltip "Fill color". You can also find it in the appearance tab of the properties view.
- Plus: Besides color, I want to add texture (is that possible?). I think for this one I would rather go with the extension point to provide new Bundled Image[1] to provide a SVG with texture you want and you this extension point to change to color of the SVG.
You can implement this extension point (or the custom styles if you still want to try it) in the same project as your odesign.
[1]https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_bundled_image_shape.html
|
|
|
Powered by
FUDForum. Page generated in 0.04583 seconds