How can I customize the actor icon in SVG output?

0 votes
asked Nov 28 in Question / help by Rob Oxspring
We'd like to be able to use some plantuml diagrams in user-facing docs but QA aren't happy with the actor "stick man" and would like something better. I've been asked whether we can post-process the SVG to replace the stick men with a different "user" icon. So my questions to you:

1. Would it be possible to supply custom icons for use as actors in diagrams?

2. Could the SVG structure be grouped by diagram element rather than in one flat group so that it's easier to post-process and replace items? (Assuming #1 is not practical)

3. Where in the codebase should I start to try and implement #2? (Assuming #2 is viable but not important to you)

4. Do you have any better ideas for me? :)

I feel sure future requests will be about other symbols used so it would be especially helpful if answers weren't overly specific to the "actor" symbol.

Thanks,

Rob

1 Answer

0 votes
answered Nov 28 by plantuml (208,860 points)
> 1. Would it be possible to supply custom icons for use as actors in diagrams?
>
It's not possible yet.
Other users have made a similar request, so we may implement it in some future.

> 2. Could the SVG structure be grouped by diagram element rather than in one flat group so that it's easier to post-process and replace items? (Assuming #1 is not practical)
>
This is easy to implement, at least for StickMan for starting.
You'd like us to use <g>..</g> in SVG, right?
We could do it very quickly *but* the post-process to replace items should use the same dimension as the actual "StickMan"

> 3. Where in the codebase should I start to try and implement #2? (Assuming #2 is viable but not important to you)
>
The code base is here https://github.com/plantuml/plantuml/blob/master/src/net/sourceforge/plantuml/skin/StickMan.java
But we would process #2 if you need to.

> 4. Do you have any better ideas for me? :)
>
Yes :-)
Another option would be to patch https://github.com/plantuml/plantuml/blob/master/src/net/sourceforge/plantuml/skin/StickMan.java (in the draw() method)
so that you draw your desired stickman.
The code is quite simple here, so minimum Java knowledge should be ok.
You could then send us back your code so that we propose several "StickMan" in the future.

> I feel sure future requests will be about other symbols used so it would be especially helpful if answers weren't overly specific to the "actor" symbol.
>
Yes, option #1 for all symbol should be the right solution.
But we have too many change in progress right now so we cannot open (yet) a new front here :)
commented Nov 29 by plantuml (208,860 points)
> Have a POC with a font awesome inspired user icon if you're interested:
>
More than interested.
This is a great job!

If you're ok, we are going to integrate this "StickMan" in the main branch, even if the legacy StickMan would remain active by default.

- Are you ok with that ?
- We have to rename your file to something else... What about "UserRobOxspring" :-) ? Any other suggestion ?
- Could we cite your name as author of this file ?
- We also have to think about a "skinparam" which would enable your icon. Once again, any suggestion about the syntax ?

Thanks again!
commented Nov 29 by roxspring (260 points)
Integrating this into the main branch sounds great to me - with or without the credit :)

I'm guessing we're looking at something like "skinparam actorSymbol <symbol name>" defaulting to "stickman" and ... I dunno ... naming is hard! ... maybe just "user" given the font-awesome inspiration was just "user" ???? I'd suggest "font-awesome-user" but it might lead to feature requests to support all the other "font-awesome" symbols :)

Whatever you choose should inform a sensible class name I guess.
commented Dec 1 by plantuml (208,860 points)

So we have integrated your code into the main trunk. We must have done some refactoring, the class you've written is now ActorAwesome :-)

So with last beta http://beta.plantuml.net/plantuml.jar you can now have

@startuml
skinparam actorStyle awesome
:User:
"Main Admin" as Admin
(Start)
"Use the application" as (Use)
@enduml

Independent of this, we are wondering if we could integrate Font Awesome free icons in PlantUML like we did for OpenIconic.
See https://fontawesome.com/icons?m=free and http://plantuml.com/en/openiconic

...