Hi,
First off, we've renewed our license.
I'm still having issues with the anchors I'm setting not being used.
I have set swimLayout.Anchoring = Anchoring.Keep; as well as
diagram.RoutingOptions.Anchoring = Anchoring.Keep;
I'm setting the preferred anchor points for the source and target nodes as follows.
The returned value from this function is assigned to:
link.OriginAnchor or link.DestinationAnchor.
protected int getTaskAnchor(ShapeNode node, string side)
{
if (side == "left")
{
if (!node.AnchorPattern.Points[2].AllowIncoming)
{
node.AnchorPattern.Points[2].AllowIncoming = true;
return 2;
}
if (!node.AnchorPattern.Points[1].AllowIncoming)
{
node.AnchorPattern.Points[1].AllowIncoming = true;
return 1;
}
if (!node.AnchorPattern.Points[3].AllowIncoming)
{
node.AnchorPattern.Points[3].AllowIncoming = true;
return 3;
}
if (!node.AnchorPattern.Points[0].AllowIncoming)
{
node.AnchorPattern.Points[0].AllowIncoming = true;
return 0;
}
if (!node.AnchorPattern.Points[4].AllowIncoming)
{
node.AnchorPattern.Points[4].AllowIncoming = true;
return 4;
}
}
if (side == "right")
{
if (!node.AnchorPattern.Points[7].AllowOutgoing)
{
node.AnchorPattern.Points[7].AllowOutgoing = true;
return 7;
}
if (!node.AnchorPattern.Points[6].AllowOutgoing)
{
node.AnchorPattern.Points[6].AllowOutgoing = true;
return 6;
}
if (!node.AnchorPattern.Points[8].AllowOutgoing)
{
node.AnchorPattern.Points[8].AllowOutgoing = true;
return 8;
}
if (!node.AnchorPattern.Points[5].AllowOutgoing)
{
node.AnchorPattern.Points[5].AllowOutgoing = true;
return 5;
}
if (!node.AnchorPattern.Points[9].AllowOutgoing)
{
node.AnchorPattern.Points[9].AllowOutgoing = true;
return 9;
}
}
if (side == "bottom")
{
if (!node.AnchorPattern.Points[12].AllowIncoming)
{
node.AnchorPattern.Points[12].AllowIncoming = true;
node.AnchorPattern.Points[12].AllowOutgoing = true;
return 12;
}
if (!node.AnchorPattern.Points[11].AllowIncoming)
{
node.AnchorPattern.Points[11].AllowIncoming = true;
node.AnchorPattern.Points[11].AllowOutgoing = true;
return 11;
}
if (!node.AnchorPattern.Points[13].AllowIncoming)
{
node.AnchorPattern.Points[13].AllowIncoming = true;
node.AnchorPattern.Points[13].AllowOutgoing = true;
return 13;
}
if (!node.AnchorPattern.Points[10].AllowIncoming)
{
node.AnchorPattern.Points[10].AllowIncoming = true;
node.AnchorPattern.Points[10].AllowOutgoing = true;
return 10;
}
if (!node.AnchorPattern.Points[14].AllowIncoming)
{
node.AnchorPattern.Points[14].AllowIncoming = true;
node.AnchorPattern.Points[14].AllowOutgoing = true;
return 14;
}
}
return 0; // Shouldn't get here, but this makes the compiler happy !
}
The AnchorPattern being used is as follows:
AnchorPattern taskAnchors2 =
new AnchorPattern(new AnchorPoint[]
{
new AnchorPoint(0, 16, false, false, MarkStyle.Rectangle, Color.Blue),
new AnchorPoint(0, 33, false, false, MarkStyle.Rectangle, Color.Blue),
new AnchorPoint(0, 50, false, false, MarkStyle.Rectangle, Color.Blue),
new AnchorPoint(0, 66, false, false, MarkStyle.Rectangle, Color.Blue),
new AnchorPoint(0, 83, false, false, MarkStyle.Rectangle, Color.Blue),
new AnchorPoint(100, 16, false, false, MarkStyle.Rectangle, Color.Green),
new AnchorPoint(100, 33, false, false, MarkStyle.Rectangle, Color.Green),
new AnchorPoint(100, 50, false, false, MarkStyle.Rectangle, Color.Green),
new AnchorPoint(100, 66, false, false, MarkStyle.Rectangle, Color.Green),
new AnchorPoint(100, 83, false, false, MarkStyle.Rectangle, Color.Green),
new AnchorPoint(16, 100, false, false, MarkStyle.Rectangle, Color.Red),
new AnchorPoint(33, 100, false, false, MarkStyle.Rectangle, Color.Red),
new AnchorPoint(50, 100, false, false, MarkStyle.Rectangle, Color.Red),
new AnchorPoint(66, 100, false, false, MarkStyle.Rectangle, Color.Red),
new AnchorPoint(83, 100, false, false, MarkStyle.Rectangle, Color.Red)
});
As you can see I have disabled all anchor points, and only enable them as I need them.
I get the same incorrect results whether I use diagram.RouteAllLinks(); or not.
Here's my diagram settings:
diagram.DrawLink += OnDrawLink; // Add an event handler to draw images on links if they exist
diagram.EnableShadowEffects = true;
diagram.ShowGrid = false;
diagram.GridColor = Color.LightGray;
diagram.GridStyle = GridStyle.Lines;
diagram.AlignToGrid = true;
diagram.MeasureUnit = GraphicsUnit.Millimeter;
diagram.LinkStyle = LinkStyle.Cascading;
diagram.LinkCascadeOrientation = Orientation.Auto;
diagram.DynamicLinks = true;
diagram.EnableLanes = true;
diagram.GridOffsetX = 4;
diagram.GridOffsetY = 4;
//diagram.Bounds = new RectangleF(0, 0, 500, 400);
diagram.LinkCrossings = LinkCrossings.Arcs;
diagram.EnableStyledText = true;
diagram.PolygonalTextLayout = true;
diagram.LinkSegments = 2;
diagram.SnapToAnchor = SnapToAnchor.OnCreateOrModify;
diagram.LinkEndsMovable = true;
diagram.DefaultShape = Shapes.RoundRect;
diagram.LinkTextStyle = LinkTextStyle.OverLongestSegment;
diagram.RoundedLinks = true;
diagram.ShowAnchors = ShowAnchors.Selected;
diagram.AutoResize = AutoResize.RightAndDown;
diagram.ContainersFoldable = true;
diagram.LinkCascadeOrientation = Orientation.Auto;
diagram.LinkRouter = new GridRouter();
//diagram.LinkRouter = new QuickRouter();
diagram.RouteLinks = true;
diagram.RoutingOptions.Anchoring = Anchoring.Keep;
diagram.RoutingOptions.CrossingCost = 50;
diagram.RoutingOptions.LengthCost = 10;
diagram.RoutingOptions.NodeVicinityCost = 5;
diagram.RoutingOptions.TurnCost = 10;
diagram.EnableLanes = true;
diagram.LinkHeadShape = ArrowHeads.Triangle;
diagram.LinkHeadShapeSize = 4;
diagram.BackBrush = new MindFusion.Drawing.SolidBrush(Color.White);
Any suggestions on what to try next?
Thanks again for all your help.
Jim