Most such cases of wanting to show a solid line or a dotted line or a dashed line can be achieved within the same template via a data Binding on the Shape.strokeDashArray property. Have the conversion function return
- null for a solid line
- [2, 2], or something like that, for a dotted line
- [8, 3], or something like that, for a dashed line
So you would not be changing the category property of the link data object, nor the Part.category of the Link, but just some other property on the link data object and letting the binding update the link’s path’s strokeDashArray property. Remember to call Model.set to change any data properties.
Thus you might be able to use a single link template for all of your links, and you would not need to use the Diagram.linkTemplateMap at all.
But if you really need to sometimes have a semi-circular link path and sometimes a straight one, you should modify the SemicircleLink class so that the override of Link.makeGeometry, depending on some data property, either returns the custom Geometry or returns the “normal” result by calling the super method.
Hmmm, looking at the code, it seems that is already does that – just set or bind the Link.curviness property to zero if you want the normal rendering behavior.