archi icon indicating copy to clipboard operation
archi copied to clipboard

[feature proposal] rendering extension to plug-ins to customize element colours

Open cedepz opened this issue 8 years ago • 4 comments
trafficstars

Hello,

First I must say that you do a great job with archi. This spring I attended a training session on Archimate given by @jbsarrodie and it helps me to (re)discover this product. I also quickly tested the new version 4, it is promising !

I just read few feature requests asking for different rendering options like shading, transparency, patterns or even simply no colour at all... This is also something I have been thinking of, my idea was to enhance a little the presentation of archi diagrams. I know that sounds pointless but my experience is that sometimes it helps to convince people (especially when presenting diagrams to non-architect people).

So I had a look at the source code of archi (+some little tests ;)) I think that a quick and proper way to implement such features would be to propose a simple extension point in the different figure rendering classes : The idea would be to delegate the calls to drawing primitives to a single class that could be overridden by some plug-ins.

In practice this kind of code (found for example in RectangleFigureDelegate): graphics.setBackgroundColor(getFillColor()); graphics.fillRectangle(bounds); should be replaced by something like: renderingDelegate.fillRectangle(graphics,getFillColor(),bounds,properties);

'properties' are the EList<IProperty> obtained from the IArchimateElement manipulated by the figure. In the core product the default implementation will remain the same :

It should look like :

public class DefaultRenderingDelegate implements IRenderingDelegate {

public void fillRectangle(Graphics graphics,Color getFillColor(),Rectangle bounds,EList<IProperty> properties) {
	graphics.setBackgroundColor(getFillColor());
    	graphics.fillRectangle(bounds);
}

public void fillRoundRectangle...
public void fillPath...

Then it would be easy for a simple plug-in to override default implementation and to propose its own rendering implementation based on specific properties (for example use a Pattern instead of a simple background color). Interesting thing is that there is no change in the models and if you do not have specific plug-in then default rendering will apply so full compatibility would remain. It would also avoid to integrate many rendering capabilities inside the core editor (there is so much possibilities that it would be heavy to maintain and never enough for users)

Does it makes sense to you ?

Ps: If you provide this kind of extension point, I would be very happy to develop a plug-in to propose some rendering extensions. Ps2 : I could eventually help to modify core editor source code but I do not want to interfere with your current work of course !

cedepz avatar Dec 09 '16 10:12 cedepz

Hi,

I really like the idea. I had a similar one when reading a book about Eclipse RCP applications but never managed to find time to look at it. In fact I think we should do a little bit more and you are welcome to contribute...

Asof today, only some elements have a figure delegate. I think that all figures should be able to use all figure delegate. Of course by default one of the allowed standard notation would be used (based on the preferences, like now), but the user should be able to switch between figures if this helps him convey the intended information more easily. For this to work, some refactoring is needed, because icons would have to be drawn not by the figure deletage itself but by another, separated, class. So at the end we should end up with a generic way of drawing the global shape which would call (or not if this doesn't make sens) a generic way of drawing icon.

So this means that we have to first think about the needed changes, and of course make sure that someone can override such classes/methods through a plugin. I'm sure @e-remy could also contribute.

Regards.

JB

This spring I attended a training session on Archimate given by @jbsarrodie PS: But wait, who are you ?

jbsarrodie avatar Dec 09 '16 10:12 jbsarrodie

Yes, it's possible to hook into the code with extensions. I'll take a look at the issue once we have released Archi 4.

Phillipus avatar Dec 09 '16 12:12 Phillipus

Just bumping this thread. Archi and Archimate are great. We are looking for ways to allow us to add our own custom visual notations on the elements that help better communicate our diagrams within our company. We are currently using the specializations plugin, but it doesn't fit as well as a native integration into the visual element.

sudr avatar May 28 '20 02:05 sudr

Another friendly bump. For my master thesis I will be focussing on the multi-view consistency problem. I was hoping to extend Archi with view relations and the ability to visually highlight elements and relationships that cause inconsistencies. I will start coding in February 2021. I'm keeping my fingers crossed for this one... :)

sefanja avatar Dec 08 '21 21:12 sefanja