Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic CreateArrow (Read 3287 times)
richardpopple
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jan 11th, 2006
CreateArrow
Jan 13th, 2006 at 1:06pm
Print Post  
Hi,
I am using the createArrow method and I am noticing some slightly odd behavior.

1) When I create an arrow programaticallly with createArrow(Box box, int anchor, Box box2, int anchor2) and I then set the AutoRoute property of the arrow to true the arrow will still go through nodes. If however I use the createArrow(Box box1, Box box2) and set the AutoRoute property to true this arrow will avoid nodes. If I set flowChart.RouteArrows to false then, for some reason arrows created using the createArrow(Box box, int anchor, Box box2, int anchor2) will avoid nodes, but then any user drawn arrows will go through nodes!

2) When creating arrows programatically if there is only one segment to them then an arrow head does not appear on the end.

3) When creating arrows directly from one box to another where a straight horizontal line could be drawn the arrow created has a very slight kink in it like:
   -----------
   |                                                          |
--                                                                          -->

Any idea how I might straighten out this behaviour?
Thanks for any help.

Rich.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateArrow
Reply #1 - Jan 13th, 2006 at 2:40pm
Print Post  
Hi,

regarding 1: are there any decoration boxes in the background that could prevent the routing algorithm find a path? If there are, try setting their Obstacle property to false. Otherwise can you email me your diagram saved in a file, so I try that with the same settingsas yours here?

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateArrow
Reply #2 - Jan 13th, 2006 at 2:59pm
Print Post  
I've tried that with the Decision1In3Out anchors value, seems to work fine. Do you use any of the predefined anchor patterns or your own one ? And what are the values of the flowchart ArrowStyle and ArrowSegment properties ?

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateArrow
Reply #3 - Jan 13th, 2006 at 5:11pm
Print Post  
Thanks for the sample project,

It is a bug in that overloaded CreateArrow method. If RouteArrows is true, the method first routes the newly created arrow and then assigns the anchor points, but changing the anchor point has a side effect of resetting all arrow control points to a simple non-routed staircase pattern. We will just move the routing code to the end of that method in order to fix it.

For now, use fc.RouteArrows = true and call

lArrow.Route();

at the end of your drawLine method before the 'return' statement.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateArrow
Reply #4 - Jan 13th, 2006 at 5:31pm
Print Post  
This code will cause an index-out-of range exceptions to be thrown at some point if routing is enabled:

// Now set the control points to those we want
currentLink.ControlPoints.Clear();
currentLink.ControlPoints.Add(mStartPoint);
currentLink.ControlPoints.Add(new PointF(mStartPoint.X, mEndPoint.Y));
currentLink.ControlPoints.Add(mEndPoint);

It will only work if arrow.SegmentCount == 2 but routed arrows change the number of their segment dynamically. Better do a loop over all points in the collection and set their coordinates instead of leaving just 3 points there, because the flowchart might look for more points in the collection depending on the SegmentCount value.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CreateArrow
Reply #5 - Jan 14th, 2006 at 8:57am
Print Post  
3) could happen if an arrow tries to go around a node below it. Try to decrease the NodeVicinityCost/Size values in RoutingOptions or increase the TurnCost value.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint