Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) FlowLayout Exception (Read 13941 times)
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
FlowLayout Exception
Apr 14th, 2009 at 9:52am
Print Post  
The diagram I was laying out was previously in an AnnealLayout with Striaght / Dynamic Links with no joints in them.

Code
Select All
System.ArgumentOutOfRangeException was unhandled
  Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
  Source="mscorlib"
  ParamName="index"
  StackTrace:
       at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
       at MindFusion.Diagramming.PointCollection.get_Item(Int32 index)
       at MindFusion.Diagramming.DiagramLink.x5fcd47acc4164137()
       at MindFusion.Diagramming.DiagramLink.xd433eaf1292c9575()
       at MindFusion.Diagramming.DiagramLink.x0d5905a18dc24aa7(Boolean x1c5ff8c3c1ac16ad)
       at MindFusion.Diagramming.DiagramLink.UpdateFromPoints(Boolean updateGroups, Boolean updateSegmentCount)
       at MindFusion.Diagramming.DiagramLink.UpdateFromPoints(Boolean updateGroups)
       at MindFusion.Diagramming.DiagramLink.UpdateFromPoints()
       at MindFusion.Diagramming.Layout.x3462aa19b03aac15.xe47b2712dbae7a09()
       at MindFusion.Diagramming.Layout.x3462aa19b03aac15.x0360c0152e0fc04b(ArrayList x6fa2570084b2ad39)
       at MindFusion.Layout.x0bd7aa907b5c2ae1.xa80296b5ce0aad9d(x82e1bd820ac7ff15 x9fc3ee03a439f6f0, ArrayList xd9cc9787b074c77c)
       at MindFusion.Layout.x0bd7aa907b5c2ae1.x96f3a1e179e5157d(x82e1bd820ac7ff15 x9fc3ee03a439f6f0, Single xd4d7bd59bc0483e3)
       at MindFusion.Layout.xabd66bcda3e8fc57.x8d75079465097c70(x0bd7aa907b5c2ae1 x6b631e0009a9deea, Boolean x4c8d8e849653d454, x01a1fee0f328037a xf4336cad79ab23b5)
       at MindFusion.Layout.xabd66bcda3e8fc57.x0bd7aa907b5c2ae1(Boolean x4c8d8e849653d454)
       at MindFusion.Diagramming.Layout.FlowLayout.BendLinks(Diagram diagram)
       at MindFusion.Diagramming.Layout.FlowLayout.x91cb73cecf8b5941(Diagram x8b62359f01cfd806)
       at MindFusion.Diagramming.Layout.FlowLayout.Arrange(Diagram diagram, DiagramItemCollection items, RectangleF[] laneBorders)
       at MindFusion.Diagramming.Layout.FlowLayout.Arrange(Diagram diagram, DiagramItemCollection items)
       at MindFusion.Diagramming.Layout.Layout.Arrange(Diagram diagram)
       at FlowVisualiser.FlowVisualiser.LayoutAllItems() in C:\Perforce\f1branches\dev\dev1\programming\tools\fe\FlowVisualiser\FlowVisualiser.cs:line 1213
       at FlowVisualiser.FlowVisualiser.LayoutFlowDiagram() in C:\Perforce\f1branches\dev\dev1\programming\tools\fe\FlowVisualiser\FlowVisualiser.cs:line 1240
       at FlowVisualiser.FlowVisualiser.applyToolStripMenuItem1_Click(Object sender, EventArgs e) in C:\Perforce\f1branches\dev\dev1\programming\tools\fe\FlowVisualiser\FlowVisualiser.cs:line 1533
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at FlowVisualiser.Program.Main() in C:\Perforce\f1branches\dev\dev1\programming\tools\fe\FlowVisualiser\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
 


  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #1 - Apr 14th, 2009 at 11:22am
Print Post  
I'm creating a diagram consisting off:

5 ContainerNodes Random Positions
9 ShapeNodes Random Position
26 DiagramLinks connecting these container nodes and shape nodes

note: the container nodes do not contain anything they are just used a representation of internal processing. the links connect to and from the containernodes to the shapenodes.

When I am using an anneal layout the diagram works fine, if I use a flow diagram it breaks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #2 - Apr 14th, 2009 at 3:26pm
Print Post  
Thank you, our developer will check this tomorrow.
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #3 - Apr 15th, 2009 at 9:39am
Print Post  
Here is the code I am using for the layout using the flow layout, and this code crashes without the diagram having previously been laid out

Code
Select All
            public void SetupRoutingOptions(Diagram diagram)
            {
                diagram.RoutingOptions.SetDefaultMode();
                diagram.RoutingOptions.SmartPolylineEnds = true;
                diagram.RoutingOptions.TurnCost = 15;
                diagram.RoutingOptions.CrossingCost = 25;
                diagram.RoutingOptions.LengthCost = 15;
                diagram.RoutingOptions.NodeVicinitySize = 10;
                diagram.RoutingOptions.NodeVicinityCost = 20;
                diagram.RoutingOptions.Anchoring = Anchoring.Keep;
                diagram.RoutingOptions.GridSize = 10;
            }

            public void Setup(Diagram diagram)
            {
                SetupRoutingOptions(diagram);

                this.AutoRoute = true;
                this.HorizontalGroupOffset = 60;
                this.VerticalGroupOffset = 35;
                this.NodeDistance = 10;
                this.Margins = new SizeF(0, 0);
                this.RecreateGraph = true;

                FlowLayoutRules rules = this.LayoutRules;
                rules.PreferredRules = PreferredRules.ConnectorRules;
                rules.NodeRules.GroupStartNodes = "Start";
                rules.NodeRules.GroupEndNodes = "End";
                rules.ConnectorRules.HorizontalBendOrientation = false;
            }

            private void LayoutAllItems(Diagram diagram, DiagramView view)
            {
                diagram.ResizeToFitItems(20);
                this.Arrange(diagram);
                diagram.ResizeToFitItems(20);
                view.ZoomToFit();
                view.ZoomOut();
            }

            public void LayoutVis(Diagram diagram, DiagramView view)
            {
                Setup(diagram);
                LayoutAllItems(diagram, view);
            }
 

  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #4 - Apr 15th, 2009 at 9:46am
Print Post  
I managed to narrow this crash down to these lines of code:

Code
Select All
            public void Setup(Diagram diagram)
            {
                FlowLayoutRules rules = this.LayoutRules;

                rules.PreferredRules = PreferredRules.ConnectorRules;
                rules.ConnectorRules.HorizontalBendOrientation = false;
            }
 


  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #5 - Apr 15th, 2009 at 10:59am
Print Post  
infact its literrally this:

Code
Select All
rules.ConnectorRules.HorizontalBendOrientation = false;
 



and it doesn't matter if I set it to true or false...

regards
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #6 - Apr 15th, 2009 at 11:00am
Print Post  
as a work around just remove from the code

Code
Select All
rules.ConnectorRules.HorizontalBendOrientation = false;
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #7 - Apr 15th, 2009 at 12:02pm
Print Post  
Our developer has tried this but could not reproduce the exception. Could you save the diagram as xml file and email it to support@mindfusion.eu?

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #8 - Apr 15th, 2009 at 12:07pm
Print Post  
also... should we run anneal layout before that to reproduce the exception?
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #9 - Apr 15th, 2009 at 12:55pm
Print Post  
I was originally getting the exception while changing to flowlayout from anneal, but then I got it when I was just starting the diagram in flow layout.

How do I export the diagram to xml?
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #10 - Apr 15th, 2009 at 2:09pm
Print Post  
okay I've emailed the diagram Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #11 - Apr 15th, 2009 at 3:36pm
Print Post  
we've got it - thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #12 - Apr 16th, 2009 at 12:16pm
Print Post  
We still can't reproduce it :-/ After replacing the IDs of your custom classes to load the file, FlowChartShapeNode with std:ShapeNode, FlowChartLink with std:DiagramLink, etc, FlowLayout runs without an exception. Do your custom item classes override any methods of the base classes? Any chance you send us the code for the custom classes?

Also, seems with that setup the layout cannot find any rules to follow, and just bends the links while preserving the node positions, which should not be different from applying OrthogonalRouter.

Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #13 - Apr 16th, 2009 at 3:05pm
Print Post  
I will post each of my custom classes here:

Code
Select All
        public class FlowBlockContainerNode : MindFusion.Diagramming.ContainerNode
        {
            #region Internal State
            private FlowBlock m_flowBlock;
            #endregion

            #region Constructors
            static FlowBlockContainerNode()
            {
            }
            public FlowBlockContainerNode(Diagram diagram, FlowBlock flowBlock) : base(diagram)
            {
                PointF position = new PointF(m_random.Next(0, 400), m_random.Next(0, 400));
                SizeF size = new SizeF(45, 30);
                this.FlowBlock = flowBlock;
                diagram.Nodes.Add(this);
                this.Move(position.X, position.Y);
                this.Resize(size.Width, size.Height);
                this.MinimumSize = size;
                this.Expanded = false;
                this.AutoShrink = true;
                this.CaptionHeight = 10;
            }
            #endregion

            #region Override Shadow Rendering
            public override void DrawShadow(IGraphics graphics, RenderOptions options)
            {

            }
            #endregion

            #region Accessors
            public FlowBlock FlowBlock
            {
                set
                {
                    m_flowBlock = value;
                    this.Caption = m_flowBlock.ID.ToString();
                }
                get
                {
                    return m_flowBlock;
                }
            }
            #endregion
        }
 

  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #14 - Apr 16th, 2009 at 3:06pm
Print Post  
Code
Select All
public class FlowNodeShapeNode : MindFusion.Diagramming.ShapeNode
	  {
		#region Internal State
		private Node m_flowNode;
		private XmlNode m_stateNode = null;
		private eNodeType m_nodeType = eNodeType.standardNode;
		#endregion

		#region Constructors
		static FlowNodeShapeNode()
		{
		}
		public FlowNodeShapeNode(Diagram diagram, Node flowNode, eNodeType nodeType, XmlDocument statesXml) : base(diagram)
		{
		    PointF position = new PointF(m_random.Next(0, 400), m_random.Next(0, 400));
		    SizeF size = new SizeF(40, 10);
		    diagram.Nodes.Add(this);
		    this.Move(position.X, position.Y);
		    this.Resize(size.Width, size.Height);
		    this.TextFormat.Alignment = StringAlignment.Center;
		    this.NodeType = nodeType;

		    switch (nodeType)
		    {
			  case eNodeType.exitPointNode: this.Shape = Shape.FromId("Ellipse");
				this.Resize(20, 20);
				this.LayoutTraits[FlowLayoutTraits.LogicID] = "End";
				break;
			  case eNodeType.standardNode: this.Shape = Shape.FromId("RoundRect");
				this.LayoutTraits[FlowLayoutTraits.LogicID] = "NotSpecified";
				break;
			  case eNodeType.decisionNode: this.Shape = Shape.FromId("Decision");
				this.Resize(45, 20);
				this.LayoutTraits[FlowLayoutTraits.LogicID] = "NotSpecified";
				break;
			  case eNodeType.entryPointNode: this.Shape = Shape.FromId("Ellipse");
				this.Text = "Start";
				this.Resize(20, 20);
				this.LayoutTraits[FlowLayoutTraits.LogicID] = "Start";
				break;
		    }

		    if (flowNode != null)
		    {
			  this.FlowNode = flowNode;

			  XmlNode stateNode = null;
			  if (flowNode.State != null)
			  {
				stateNode = statesXml.SelectSingleNode("//*[@id='" + flowNode.State + "']");
			  }
			  else
			  {
				stateNode = statesXml.SelectSingleNode("//*[@id='" + this.Text + "']");
			  }

			  if (stateNode != null)
			  {
				this.StateNode = stateNode;
			  }
		    }
		}
		#endregion

		#region Override Shadow Rendering
		public override void DrawShadow(IGraphics graphics, RenderOptions options)
		{

		}
		#endregion

		#region Accessors
		public Node FlowNode
		{
		    set
		    {
			  m_flowNode = value;
			  this.Text = m_flowNode.ID.ToString();
		    }
		    get
		    {
			  return m_flowNode;
		    }
		}
		public XmlNode StateNode
		{
		    set
		    {
			  m_stateNode = value;
			  this.Text = this.Text + Environment.NewLine + "(State = " + m_stateNode.Name + ")";
		    }
		    get
		    {
			  return m_stateNode;
		    }
		}
		public eNodeType NodeType
		{
		    set
		    {
			  m_nodeType = value;
			  this.Brush = new MindFusion.Drawing.SolidBrush(Color.White);
			  switch (m_nodeType)
			  {
				case eNodeType.exitPointNode:
				    this.Pen = new MindFusion.Drawing.Pen(Color.Red);
				    this.TextColor = Color.Red;
				    break;
				case eNodeType.standardNode:
				    this.Pen = new MindFusion.Drawing.Pen(Color.Orange);
				    this.TextColor = Color.Black;
				    break;
				case eNodeType.decisionNode:
				    this.Pen = new MindFusion.Drawing.Pen(Color.Blue);
				    this.TextColor = Color.Blue;
				    break;
				case eNodeType.entryPointNode:
				    this.Pen = new MindFusion.Drawing.Pen(Color.Green);
				    this.TextColor = Color.Green;
				    break;
			  }
		    }
		    get
		    {
			  return m_nodeType;
		    }
		}
		#endregion
	  }
 


  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint