Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic AnchorPoint (Read 2466 times)
Luca
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 14th, 2007
AnchorPoint
Nov 14th, 2007 at 7:06pm
Print Post  
Hello!, We are using version 4.3 of FlowChart.NET
i have 2 boxes y each box with 3 anchor points and 3 arrow each one conected to a one origin anchor to dest anchor.

The propierty 
diagram1.AllowUnanchoredArrows=false.

When i call to ReassignAnchorPoints function i have a problem because  in sometimes the arrow is connected directly to the Box instead of the anchors

How can I control that this will not happen?

I test this issue in the 5.01 and the same thing happens...

Thanks for your help and sorry for my English;)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AnchorPoint
Reply #1 - Nov 14th, 2007 at 7:18pm
Print Post  
Hi,

Does your application handle the ValidateAnchorPoint event? Could you post here your code that defines the anchor points and creates the links?

Stoyan
  
Back to top
 
IP Logged
 
Luca
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 14th, 2007
Re: AnchorPoint
Reply #2 - Nov 14th, 2007 at 8:03pm
Print Post  
The Boxes and the arrows are created manually on the flowchart

[code]
private void Form1_Load(object sender, EventArgs e)
{
fc.ShowAnchors = ShowAnchors.Always;
fc.SnapToAnchor = SnapToAnchor.OnCreateOrModify ;
fc.AllowUnanchoredArrows = false;

}

private void fc_BoxDblClicked(object sender, MindFusion.Diagramming.WinForms.BoxMouseArgs e)
{
short xpercent = (short)(e.RelativePos.X / e.Box.BoundingRect.Width * 100);
short ypercent = (short)(e.RelativePos.Y / e.Box.BoundingRect.Height * 100);

if (e.Box.AnchorPattern == null)
{
e.Box.AnchorPattern = new AnchorPattern();
}
e.Box.AnchorPattern.Points.Add(new MindFusion.Diagramming.WinForms.AnchorPoint(xpercent, ypercent,true,true,MarkStyle.Circle));

}

private void button1_Click(object sender, EventArgs e)
{
foreach (Arrow oArrow in fc.Arrows )
{
oArrow.ReassignAnchorPoints();

}
}

private void fc_ValidateAnchorPoint(object sender, MindFusion.Diagramming.WinForms.AttachConfirmArgs e)
{
if (numArrowsEntrada(e.Node, e.AnchorIndex) > 2)
e.Confirm = false;

if (numArrowsSalida(e.Node, e.AnchorIndex) > 2)
e.Confirm = false;

}

private int numArrowsEntrada(Node node, int anchorIndex)
{
int total = 0;
foreach (Arrow arrow in node.IncomingArrows)
if (arrow.DestAnchor == anchorIndex)
total++;

return total;
}

private int numArrowsSalida(Node node, int anchorIndex)
{
int total = 0;
foreach (Arrow arrow in node.OutgoingArrows)
if (arrow.OrgnAnchor == anchorIndex)
total++;

return total;
}
[/code]

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AnchorPoint
Reply #3 - Nov 15th, 2007 at 6:03am
Print Post  
A link would not connect to an anchor point if the ValidateAnchorPoint handler returns false for all points of a node. Perhaps you should not count the link for which you are calling Reassign when checking how many links are already connected to a point?

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint