Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LayoutTraits (Read 2780 times)
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
LayoutTraits
Feb 23rd, 2008 at 2:44am
Print Post  
Hello,

I am trying to create a flow chart programatically, and was wondering what the LayoutTraits logic is used for?

node.LayoutTraits(FlowLayoutTraits.LogicID) = "NotSpecified"

I am looking at the FlowLayout example that comes with the download.


Thanks!
Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LayoutTraits
Reply #1 - Feb 23rd, 2008 at 8:10am
Print Post  
Hi,

That example, and the ProcessLayout one, demonstrate the FlowLayout automatic layout algorithm. FlowLayout uses customizable rule system to arrange the diagram. When FlowLayout processes a link or a pair of nodes, it uses the LogicID specified through LayoutTraits to find a rule that should be applied to the link or nodes.

LayoutTraits is a simple hashtable. We intend to use for defining node attributes related to layout algorithms, without bloating the API by adding rarely used properties to the item classes. At this point it is used only by FlowLayout, but we plan to use it in other situations too. We'll also remove the Weight property, used by SpringLayout and PathFinder, and will modify the algorithms so that they get the weight values from LayoutTraits.

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


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: LayoutTraits
Reply #2 - Feb 23rd, 2008 at 4:37pm
Print Post  
Hmmm,

Sorry, still not quite getting it. Can I just put any values in these fields?

If I have two nodes that I would like to stay together, should I give them the same value, but give other nodes different values?

i.e. if my diagram has 10 nodes, but I want node 2 and 3 to be right beside each other, but let the other nodes follow the flowcharting algorithm would I set nodes 1,4-9 to any value, and set node 2 and 3 to the same value?

Thanks for your help!
Barry

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LayoutTraits
Reply #3 - Feb 25th, 2008 at 6:29am
Print Post  
Yes, you can set any value as logic ID, but you must also add a rule for that value. FlowLayout examines each pair of connected nodes, and looks for a rule containing either the link ID or both nodes' IDs. The rules state how the next node in the sequence should be positioned relatively to the previous one. The rules are applied only to connected nodes, so you cannot make two arbitrary nodes stay together. Additionally, if there are more than one ways to arrange the nodes based on your rules, the algorithm will apply the first sequence it finds, and in such situations even connected nodes could be placed apart.

Stoyan
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: LayoutTraits
Reply #4 - Feb 27th, 2008 at 7:15pm
Print Post  
Thanks again, I think I am getting closer!

So in my flow I have a lot of if nodes, but in one case, I have an if node, that goes to a 'stop' statement.

I will set the if node and stop node with the same logic id as 'nodestop'

For the rules, is this considered a rule, or is there another setting I need to read up on?


Have a great day!
Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LayoutTraits
Reply #5 - Feb 28th, 2008 at 8:01am
Print Post  
Hi,

Where do you need the 'stop' node to appear relatively to the 'if' node?

Perhaps this needs clarification: FlowLayout can work in two quite different modes, as set via the PreferredRules property.

In the ConnectorRules mode, you assign an array of link ids to the Left / Right / Down / Up Orientation sets in FlowLayout.LayoutRules.ConnectorRules object. Then the layout tries to arrange the diagram in such way that the links directions corresponds to the set that contain their ID. This is the mode used in the FlowLayout sample.  So you could designate a "stop-link" ID and assign it to the link that goes from the 'if' node to the 'stop' node.

If PreferredRules is set to NodeRules, then FlowLayout uses node IDs when inferring what rules to apply. This is the mode used in the ProcessLayout sample. Here nodes connected with links whose id equals to the MainConnectorId are placed in long horizontal sequences, and you can define additional rules for placing nodes above or below the main sequence. Additionally, in this mode there are rules for defining groups of nodes, for assigning nodes to lanes, etc.

I can see we've made a blunder and parts of the topics related to FlowLayout are not accessible from the documentation's TOC. You could open ConnectorRules and NodeRules topics from the index, and then click on Members to see what kind of rules you can use.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint