Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Nodes are getting Trespassed (Read 3700 times)
ramesh.Kurmilla
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: May 12th, 2009
Nodes are getting Trespassed
May 12th, 2009 at 11:26am
Print Post  
Hi,
  When linking 2 nodes, links are not getting auto routed. Rather it tresspasses the nodes in between. Following is the code snippet and output thereof. Please advice.

XAML.CS CODE
********
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;
using System.Windows.Data;
using MindFusion.Diagramming.Silverlight.Layout;
using MindFusion.Diagramming.Silverlight;
using System.Xml.Linq;
using System.Windows.Media.Imaging;
using System.Windows.Resources;

namespace SampleApp8
{
    public partial class Page : UserControl
    {
       public Page()
       {
           InitializeComponent();

           MindFusion.Diagramming.Silverlight.ShapeNode node1 = diagram.Factory.CreateShapeNode(100,0, 60, 60);
           node1.Text = "One";
           //node1.Obstacle = false;

           MindFusion.Diagramming.Silverlight.ShapeNode node2 = diagram.Factory.CreateShapeNode(200,0, 60, 60);
           node2.Text = "Two";
           node2.Obstacle = false;

           MindFusion.Diagramming.Silverlight.ShapeNode node3 = diagram.Factory.CreateShapeNode(300,50, 60, 60);
           node3.Text = "Three";
           node3.Obstacle = false;

           
           node3.Opacity = 100;          
           MindFusion.Diagramming.Silverlight.ShapeNode node4 = diagram.Factory.CreateShapeNode(500, 0, 60, 60);
           node4.Text = "Four";            

           diagram.Factory.CreateDiagramLink(node1,node2);
           diagram.Factory.CreateDiagramLink(node1,node3);
           //diagram.Factory.CreateDiagramLink(node4, node3);
           //diagram.Factory.CreateDiagramLink(node3, node2);
           //diagram.Factory.CreateDiagramLink(node2, node4);
           diagram.DynamicLinks = true;
           diagram.ShowAnchors = ShowAnchors.Auto;
           diagram.RoutingOptions.Anchoring = Anchoring.Keep;
           diagram.RoutingOptions.CrossingCost = 200;
           diagram.RoutingOptions.NodeVicinityCost = 40;
           diagram.RouteLinks = true;
 
           //TreeLayout tree = new TreeLayout();
           //tree.Root = diagram.Nodes[0];
           //tree.Direction = TreeLayoutDirection.LeftToRight;
           //tree.LinkStyle = TreeLayoutLinkType.Cascading3;
           //tree.LevelDistance = 400;
           //tree.NodeDistance = 40;            
           //tree.Arrange(diagram);

           GridLayout newLayout = new GridLayout();
           newLayout.Anchoring = Anchoring.Keep;
           newLayout.RandomSeed = 5;
           newLayout.Iterations = 15;
           newLayout.GridSize = 15;
           newLayout.Root = diagram.Nodes[0];


       }
    }
}


XAML CODE
**********

<UserControl x:Class="SampleApp8.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="clr-namespace:MindFusion.Diagramming.Silverlight;assembly=DiagramLite"
    Width="800" Height="800">
    <Grid x:Name="LayoutRoot" Background="White">
       <d:Diagram x:Name="diagram" Width="1000" Height="1650"
                      ShowGrid="False"
                      Background="#FFE0E0E0"
                      >
       </d:Diagram>
    </Grid>
</UserControl>
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Nodes are getting Trespassed
Reply #1 - May 12th, 2009 at 12:12pm
Print Post  
RouteLinks specifies the default value for the AutoRoute property of newly created links, so setting diagram.RouteLinks = true after the links are created does not have any effect.
  
Back to top
 
IP Logged
 
ramesh.Kurmilla
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: May 12th, 2009
Re: Nodes are getting Trespassed
Reply #2 - May 12th, 2009 at 1:54pm
Print Post  
hi

i have commneted the line  " diagram.RouteLinks = true;" in my application. but not any effect.

plz help me in this issue..!!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Nodes are getting Trespassed
Reply #3 - May 12th, 2009 at 2:08pm
Print Post  
You should not comment it out but set it before the links are created.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ramesh.Kurmilla
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: May 12th, 2009
Re: Nodes are getting Trespassed
Reply #4 - May 13th, 2009 at 5:50am
Print Post  
i have used this peace of codebut it is not routing the links:
if possible plz send me sample of code to routing the links when node beteen them.

Page.xaml:
<UserControl x:Class="SampleApp8.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="clr-namespace:MindFusion.Diagramming.Silverlight;assembly=DiagramLite"
    Width="800" Height="800">
    <Grid x:Name="LayoutRoot" Background="White">
       <d:Diagram x:Name="diagram" Width="1000" Height="1650"
                      ShowGrid="False"
                      Background="#FFE0E0E0" RouteLinks="True" DynamicLinks="True" >
       </d:Diagram>
    </Grid>
</UserControl>


page.xaml.cs;
MindFusion.Diagramming.Silverlight.ShapeNode node1 = diagram.Factory.CreateShapeNode(100, 0, 60, 60);
           node1.Text = "One";
           //node1.Obstacle = false;

           MindFusion.Diagramming.Silverlight.ShapeNode node2 = diagram.Factory.CreateShapeNode(200, 0, 60, 60);
           node2.Text = "Two";
           node2.Obstacle = false;

           MindFusion.Diagramming.Silverlight.ShapeNode node3 = diagram.Factory.CreateShapeNode(300, 50, 60, 60);
           node3.Text = "Three";
           //node3.Obstacle = false;
           
           MindFusion.Diagramming.Silverlight.ShapeNode node1 = diagram.Factory.CreateShapeNode(100, 0, 60, 60);
           node1.Text = "One";

           MindFusion.Diagramming.Silverlight.ShapeNode node2 = diagram.Factory.CreateShapeNode(200, 0, 60, 60);
           node2.Text = "Two";

           MindFusion.Diagramming.Silverlight.ShapeNode node3 = diagram.Factory.CreateShapeNode(300, 50, 60, 60);
           node3.Text = "Three";
                       
           MindFusion.Diagramming.Silverlight.ShapeNode node4 = diagram.Factory.CreateShapeNode(500, 0, 60, 60);
           node4.Text = "Four";
           
           diagram.Factory.CreateDiagramLink(node1, node2);
           diagram.Factory.CreateDiagramLink(node1, node3);
GridLayout newLayout = new GridLayout();
           newLayout.Anchoring = Anchoring.Keep;
           newLayout.RandomSeed = 5;
           newLayout.Iterations = 15;
           newLayout.GridSize = 15;
           newLayout.Root = diagram.Nodes[0];


plz help me in this issue.
link is crossing the nodes.

THanks
Ram...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Nodes are getting Trespassed
Reply #5 - May 13th, 2009 at 9:08am
Print Post  
It seems at this time new links are auto-routed only when created interactively. Try calling the link.Route() method after creating a link.
  
Back to top
 
IP Logged
 
ramesh.Kurmilla
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: May 12th, 2009
Re: Nodes are getting Trespassed
Reply #6 - May 13th, 2009 at 1:00pm
Print Post  
thanks stoyo

got it..!!!

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