Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Howto layout grouped "network-devices" (Read 2952 times)
Spyklee
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 18th, 2008
Howto layout grouped "network-devices"
May 18th, 2008 at 3:35pm
Print Post  
Hello,

Using latest version of FC.NET 5.0.3 (pro) and would like to know how to do the following layout and grouping.

Have created several rectangle nodes, representing network devices (like a switch), attached to these devices are eclipses, representing their interfaces.

One device and all its interfaces are grouped together.

To represent a device with some interfaces the links between an interface and the device should not be that long. Is ther a way to 'lock' this?
Since interfaces from several devices are able to be connected to each other the location of the interface must by dynamic 'around' the device so it is able to layout nicely.

Is there some particular algorithm for the kind of layout?

Also de diagramView/Diagram should not be able to draw new shapes or delete shapes, is there a property for this?

Please advice, cheers!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Howto layout grouped "network-devices&quo
Reply #1 - May 19th, 2008 at 8:31am
Print Post  
Hi,

You could use SpringLayout using two different Weight values for the two types of links. For example, set device/interface links' Weight = 0.5 and interface/interface Weight = 2. I'm not sure whether values greater or less than one make the links shorter, so if that doesn't work, try values > 1 for device/interface and < 1 for interface/interface.

Set DelKeyAction = None and Behavior = Modify (or DrawLink to allow drawing links). Both are properties of DiagramView.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Spyklee
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 18th, 2008
Re: Howto layout grouped "network-devices&quo
Reply #2 - May 19th, 2008 at 2:04pm
Print Post  
Hi,

Thanks for the reply, works great!

Since the ellipse shape (interface) is that small I changes the textarea to show the interface name. Is it possible to layout this based on the location of the interface on the diagram? Like left, or on the right sight of the shape we it's suited best? (not cross device shape)

Cheers! Eric
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Howto layout grouped "network-devices&quo
Reply #3 - May 19th, 2008 at 4:21pm
Print Post  
Hi,

You could set the TextFormat's Alignment and LineAlignment to Near/Center/Far, depending on which side of the device node the interface has been placed.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Spyklee
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 18th, 2008
Re: Howto layout grouped "network-devices&quo
Reply #4 - May 19th, 2008 at 4:51pm
Print Post  
Is this dynamically set so if the lay-out is re-arranged is possible it ends on the other side?

Cheers!

(thanks for the support)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Howto layout grouped "network-devices&quo
Reply #5 - May 20th, 2008 at 5:05am
Print Post  
Hi,

There is no dynamic text layout feature available yet. You will have to change the text alignments each time after applying a layout. It could look like this in pseudo code:

springLayout.Arrange(...);
foreach (interface)
{
     if (interface.right < device.left)
           textformat.alignment = far;
     else if (interface.left > device.right)
           textformat.alignment = near;
     else
           textformat.alignment = center;

     if (interface.bottom < device.top)
           textformat.linealignment = far;
     else if (interface.top > device.bottom)
           textformat.linealignment = near;
     else
           textformat.linealignment = center;
}

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Spyklee
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: May 18th, 2008
Re: Howto layout grouped "network-devices&
Reply #6 - Jun 10th, 2008 at 10:06am
Print Post  
Stoyo,

I'm not able to render the lay-out of the nodes as I would like. See code below:

Code
Select All
ShapeNode baseNode = diagram1.Factory.CreateShapeNode(50, 10, 20, 10);
baseNode.Shape = Shapes.Rectangle;

for (int i = 0; i < 52; i++)
{
   ShapeNode childNode = diagram1.Factory.CreateShapeNode(50, 10, 5, 5);
                childNode.Shape = Shapes.Ellipse;
   childNode.AttachTo(baseNode, AttachToNode.TopLeft);
   DiagramLink dl = diagram1.Factory.CreateDiagramLink(baseNode, childNode);
}

springLayout1.IterationCount = 250;
springLayout1.NodeDistance = 25;
springLayout1.MinimizeCrossings = true;
springLayout1.EnableClusters = true;
springLayout1.KeepGroupLayout = false;
springLayout1.Arrange(diagram1); 



All of the child nodes are rendered on top of each other.

Please advice,

Eric
« Last Edit: Jun 10th, 2008 at 11:39am by Spyklee »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Howto layout grouped "network-devices&quo
Reply #7 - Jun 10th, 2008 at 2:49pm
Print Post  
In this case you'd better use the radial layout. If your graph is not strictly a tree, you could apply the radial layout before SpingLayout in order to get a more uniform initial placement of the nodes, e.g.

TreeLayout rl = new TreeLayout();
rl.Root = baseNode;
rl.Type = TreeLayoutType.Radial;
rl.Arrange(diagram);

SpringLayout springLayout1 = new SpringLayout();
springLayout1.IterationCount = 10;
springLayout1.NodeDistance = 70;
springLayout1.MinimizeCrossings = true;
springLayout1.EnableClusters = true;
springLayout1.KeepGroupLayout = false;
springLayout1.Arrange(diagram);

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