Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layouting with Bezier arrows (Read 2656 times)
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Layouting with Bezier arrows
Oct 21st, 2009 at 8:27am
Print Post  
Hi.

I'm working on a visualisation of a state machine. I use the MindFusion.FlowChartX.LayoutSystem.LayeredLayout to automatically arrange the states and transitions.
my question is, is it possible to use a Layout with bezier arrows? when I use this layout all arraws are set to asPolyline.

Thanks for all hints?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting with Bezier arrows
Reply #1 - Oct 21st, 2009 at 9:54am
Print Post  
Hi,

LayeredLayout doesn't have built-in support for Bezier links. You could change the links' Style to Bezier after the layout is applied. You will first have to save the control point positions as set by LayeredLayout, then insert two additional control points for each segment at appropriate locations to make the segment joins nicely curved. Finally assign the points back to the Bezier links ControlPoints property.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: Layouting with Bezier arrows
Reply #2 - Oct 21st, 2009 at 11:18am
Print Post  
Ok. Thanks for this reply.
Only to be sure, I have to do following:

1. Apply the LayeredLayout.
2. Store the Control-Points of all Arrows
3. Change Arrowstyle of all Arrows to bezier (iterate through the arrowcollection of the flowchart)
4. Add 2 extra control Points to the control points collection (do i have directly access to the segments i have to split?) i think the two point should split the segment into 4 parts, right?
Maybe you have an excample of what you mean with appropreate locations...
5. Assign the augmented control points collection to the arrows.

is this the right order?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting with Bezier arrows
Reply #3 - Oct 21st, 2009 at 11:54am
Print Post  
That's the right order. Bezier links have to types of control points, ones through which the curve passes, and ones that just attract it. Each segment of the link has two points of the first kind at its ends, and two intermediate points of the second kind. The points you get from LayeredLayout correspond to the first kind; the links should pass through them to reuse the path found among nodes by LayeredLayout. For each pair of such points you get from LayeredLayout, you should insert two intermediate points to attract the Bezier curve in some direction. An additional requirement is that the intermediate points that are adjacent to the join point of two segments should lie on the same tangent line, so that the link remains curved at the join.
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: Layouting with Bezier arrows
Reply #4 - Oct 21st, 2009 at 12:55pm
Print Post  
Ok I understand what you mean.
My first problem with this is, that when I do the following my application crashes with astrange error message like "parameter not correct" or something.

foreach (Arrow a in flowChart.Arrows)
{
PointCollection pColl = new PointCollection(a.ControlPoints.Count);
pColl.AddRange(a.ControlPoints.Clone());
              //ToDo:
               //set to bezier
               //add additional points to pointCollection
               a.ControlPoints.Clear();
a.ControlPoints.AddRange(pColl);
}

Is this the wrong way to save the control points and assign again?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting with Bezier arrows
Reply #5 - Oct 21st, 2009 at 1:48pm
Print Post  
You should add 3 * link.SegmentCount + 1 points when the link.Style is Bezier. Is that how much points are in pColl?
  
Back to top
 
IP Logged
 
mbuechler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: Oct 21st, 2009
Re: Layouting with Bezier arrows
Reply #6 - Oct 21st, 2009 at 1:52pm
Print Post  
I don't think so. In a.ControlPoints are only 2 Points when it is a straight line.

just to be sure: with link you mean an array?

the problem ist, the ControlPoints Property on Arrow ist readonly. So I don't have the possibility to set a new Collection to this property.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting with Bezier arrows
Reply #7 - Oct 21st, 2009 at 2:56pm
Print Post  
The method you are using should work:

a.ControlPoints.Clear();
a.ControlPoints.AddRange(pColl);

You should just make sure that when the link is Bezier, you add 3 * segments + 1 points. Having 2 points when it is a straight line with one segment is correct, because straight-line links don’t have the intermediate control points. So between each pair of point set by LayeredLayout for the polyline links, you should now insert two intermediate control points.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint