Re: applying custom styles to diagrams



At 10.11.2010 09:59, niklas | brueckenschlaeger wrote:
Hi,
I'm trying to export diagrams to SVG, then styling them with CSS. This
doesn't work right now because the SVG carries no semantics (i.e. IDs or
classes).
Looking at diasvg.py, it seems like in the renderer there's no access to
the original semantic objects (UML Class, Association, ...) anymore.
Right, the usual renderer interface is pure drawing.

Is there maybe a higher point in the API to hook into for implementing
this?
Only a much higher level, see export-object.py as example. Or codegen.py for something producing more useful output. On the C-level there also is Renderer::draw_object(Object *), but currently there is no way to "overwrite" it from PyDia code. Also missing is the ability to call the base class implmentation, i.e. get the drawing call within the same renderer.

It would also be fine just to be able to generate extra output,
with all the objects in the order they were rendered, then I can
post-process that SVG to add the appropriate classes.

Although the rendering order is deterministic as in:

        for layer in data.layers :
                for o in layer.objects :
                        ...

you still would have a hard time to match the rendering calls with the objects. The best way would be implementing both draw_object parts as outlined above, but that involves some C hacking in the bindings.

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]