Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Links not moving when Node is moved (Read 4599 times)
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Links not moving when Node is moved
May 18th, 2009 at 12:41pm
Print Post  
I am creating links between some nodes using Factory.CreateDiagramLink.

diagram.Factory.CreateDiagramLink(node, destinationNode);

When I then select one of the nodes and move it, the links do not move. The link properties say the link is connect to the 2 nodes, but they do not move with the nodes.

Links I create manually act properly and move when the node is moved.

I have tried using the following without success:
newLink.AllowMoveEnd = true;
newLink.AllowMoveStart = true;
newLink.SnapToNodeBorder = true;
diagram.AllowUnanchoredLinks = false;
diagram.AllowUnconnectedLinks = false;
diagram.Behavior = Behavior.DrawLinks;

I cannot think of anything else. I know it is something very small and simple I am missing.

Thanks for your help.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Links not moving when Node is moved
Reply #1 - May 18th, 2009 at 2:34pm
Print Post  
We could not reproduce this. Are you using ImageMap mode? Are you handling the NodeModified or similar events?

Stoyan
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Links not moving when Node is moved
Reply #2 - May 18th, 2009 at 2:52pm
Print Post  
Hello Stoyo,

I am creating the node like this:
[code]
DiagramLink newLink = diagram.Factory.CreateDiagramLink(node, destinationNode);
[/code]

The diagram code look like this:
[code]diagram.NodeActivated += new NodeEventHandler(diagram_NodeActivated);
           diagram.NodeDeactivated += new NodeEventHandler(diagram_NodeDeactivated);
           diagram.NodeDeleting += new NodeValidationEventHandler(diagram_NodeDeleting);
           diagram.NodeClicked += new NodeEventHandler(diagram_NodeClicked);
           diagram.LinkCreated += new LinkEventHandler(diagram_LinkCreated);
           diagram.LinkDeleting += new LinkValidationEventHandler(diagram_LinkDeleting);
           diagram.LinkClicked += new LinkEventHandler(diagram_LinkClicked);
           diagram.LinkDeselected += new LinkEventHandler(diagram_LinkDeselected);
           diagram.DragOver += new DragEventHandler(diagram_DragOver);
           diagram.Drop += new DragEventHandler(diagram_Drop);
           diagram.LinkHeadShape = ArrowHead.Triangle;
           diagram.Bounds = new Rect(0,0,2000,2000);
           diagram.ShowGrid = true;
           diagram.GridSizeX = 15;
           diagram.GridSizeY = 15;
           diagram.AlignToGrid = true;
           diagram.ShowAnchors = ShowAnchors.Auto;
           diagram.AllowDrop = true;
           diagram.AllowUnanchoredLinks = false;
           diagram.AllowUnconnectedLinks = false;
           diagram.Behavior = Behavior.DrawLinks;[/code]

The nodes are dragged onto the diagram. The xaml code is:
[code]<diagram:NodeListView x:Name="shapeList" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Margin="2">
                   <!--<diagram:ShapeNode x:Name="shapeKbaBox" Shape="DividedEvent" Bounds="2,2,25,25" Brush="AliceBlue" diagram:NodeListView.Label=" KBA Element "/>-->
                   <diagram:TableNode x:Name="shapeKbaTable" ConnectionStyle="Both"
                                      ColumnCount="2" RowCount="4" Bounds="2,2,50,50"
                                      Brush="LightSteelBlue" diagram:NodeListView.Label=" KBA Element "
                                      Style="RoundedRectangle" Grid.IsSharedSizeScope="True"
                                      IgnoreLayout="False" Obstacle="False" CellFrameStyle="None" CellCustomDraw="None" AllowDrop="True" />
               </diagram:NodeListView>
[/code]

Using the diagram_Drop event I do:
[code]
node.AllowIncomingLinks = false;
TableNode tNode = (node as TableNode);
tNode.Bounds = new Rect(tNode.Bounds.Left - 70, tNode.Bounds.Top - 100, 140, 140);
node.AnchorPattern = kbaAnchorPattern;
[/code]

The anchor patterns assigned to each Node looks like this:
[code]AnchorPattern kbaAnchorPattern = new AnchorPattern(new AnchorPoint[]
                  {
                      new AnchorPoint(0, 0, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(0, 100, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(100, 0, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(100, 100, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(50, 0, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(100, 50, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(50, 100, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red)),
                      new AnchorPoint(0, 50, true, true,MarkStyle.Circle,new SolidColorBrush(Colors.Red))
                  });
[/code]

I have a pattern that specifies which nodes should be linked. If a user has not added the required links, the rest are filled in for the user.
The links crated in code are not staying connected.

After inspecting the properties of the links, I have noticed (for example) on the user created link:
* OriginAnchor = -1 and OriginIndex = 2
On the code created link:
* OriginAnchor  = 5 and OriginIndex = -1

I suspect this has something to do with the problem?

Thanks again.
Darren
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Links not moving when Node is moved
Reply #3 - May 18th, 2009 at 3:40pm
Print Post  
Are you using the WPF version?
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Links not moving when Node is moved
Reply #4 - May 18th, 2009 at 3:44pm
Print Post  
Oh, yes! Sorry for not mentioning that.
I am using WPFDiagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Links not moving when Node is moved
Reply #5 - May 18th, 2009 at 3:59pm
Print Post  
Is the node for which you are setting AllowIncomingLinks = false the destination of that link ?
  
Back to top
 
IP Logged
 
darrenwwwa
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: May 12th, 2009
Re: Links not moving when Node is moved
Reply #6 - May 19th, 2009 at 6:41am
Print Post  
Yes. Good catch.
That is only for the parent node (the first node added). That is not applied to any other node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Links not moving when Node is moved
Reply #7 - May 19th, 2009 at 8:04am
Print Post  
I couldn't reproduce this even with AllowIncomingLinks disabled. Does it work better if you leave it enabled? What assembly version number is displayed in the property pane when you select the diagramming.wpf reference in Solution Explorer?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint