Subject: Re: Rounded Polyline, and other questions?
Date: Tue, 27 Apr 2004 07:58:54 +0200
On Mon, 2004-04-26 at 23:32, anthonym@overture.com wrote:
> Hi,
>
> I mentioned in a previous email that I am working on implementing the
> BPMN in dia. I've done most of the shapes using the built in export
> to shape functionality, which seems to work well, although it is
> very easy to export a shape which cannot be imported (basically anything
> with an arc will export an SVG path with an 'A' element, but then
> can't be loaded).
I'm guessing nobody converted the A element yet, but haven't looked at
it hard enough to figure out why.
> Now I'm working on the sequence and message flows which are essentially
> zigzaglines with a certain subset of arrows. One difference however is
> that in the BPMN docs, the flows use orthogonal connections with rounded
> corners, and I would like to mimic this.
>
> I've looked the the current crop of programmed objects and found that
> the SADT arrow does this, but this object seems to rely on a new orth
> connection object which is claimed to be a short term object.
> The SADT arrow also seems to not include some of the code in the
> zigzagline which pushes the line behind the arrow point (behavior I like
> because it makes the arrow heads look nicer).
It does indeed. It's one of the things that makes the newer versions of
Dia much more palatable.
> I believe the best approach to accomplishing what I want to do would
> be to migrate the rounded arrow code from the SADT object into the
> diarenderer. I'ved create a couple of functions called 'draw_rounded_polyline'
> and 'draw_rounded_polyline_with_arrows', and copied the code from the
> SADT arrow into the first. I'll then probably move the arrow and point
> adjusting code from the draw_polyline_with_arrows into a common function
> so it can be shared. I can then call the rounded version of
> draw_polyline_with_arrows in my object.
And you're making a default implementation of draw_rounded_polyline* in
DiaRenderer, yes?
> With the above approach my programmed objects essentially become a
> constrained version of the zigzagline, which seems like a much cleaner
> approach than some of the other arrow type programmed objects I've
> looked at. I don't know if it is actually possible to extend zigzagline
> or whether I need to essentially copy it and add in the constraints?
It ought to be possible to extend the zigzagline, but methinks the
properties and object menus will get in the way -- notice how they're
defined with macros for polyline. If you can think up a way to define
objects that's not more complex than now, but makes inheritance easier,
I'm all ears.
> Now I have a couple of questions. Is the above a feasible approach?
> Are there any recommendations on different approaches?
It sounds good, that's what I can say.
> Should I
> implement a rounded corner dialog into the zigzagline, such that
> the corner rounding works the way it does with the box (ie, you have
> an option to set a corner radius, if it's zero don't round and use
> the old functions if it is greater than zero use the rounded methods)?
Yes, that sounds like a good idea.
> I'm really new to the code so could be completely off on all of the
> above, please correct me if I am.
It sounds like you have a good understanding of the code already, so Iøm
not too worried. You may want to code off the DIA_0_94_DEV branch, if
you're not doing so already.
-Lars