Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Exception dragging a selection (Read 3912 times)
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Exception dragging a selection
Mar 12th, 2009 at 12:00pm
Print Post  
Hi,

I get this exception when I do a drag select over a self-linked node like this:



Code
Select All
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at MindFusion.Utilities.ApproxBezier(Point[] points, Int32 startIdx, Int32 quality)
   at MindFusion.Diagramming.Wpf.DiagramLink.x506928df783c0c72(Int32 x949108ddd7122fd3)
   at MindFusion.Diagramming.Wpf.DiagramLink.xa170bf38e993d468(Rect x26545669838eb36e)
   at MindFusion.Diagramming.Wpf.Diagram.x98d300fb770bf5ec(Rect x26545669838eb36e, Boolean x201ab38fe5644146)
   at MindFusion.Diagramming.Wpf.Selection.AllowCreate(Point current, InteractionState ist)
   at MindFusion.Diagramming.Wpf.InteractionState.ValidateAndSetCursor(Point point, Diagram diagram)
   at MindFusion.Diagramming.Wpf.Diagram.OnPreviewMouseMove(MouseEventArgs e)
   at System.Windows.UIElement.OnPreviewMouseMoveThunk(Object sender, MouseEventArgs e)
   at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(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.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
 



What is the problem? Any workaround?

I'd like sent you a XML with the diagram but is impossible save it as long I'm using pictures and non-serializable elements in the tags (would be nice have an option to ignore these elements).

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exception dragging a selection
Reply #1 - Mar 12th, 2009 at 1:15pm
Print Post  
Hi,

Does it happen if you draw the selection rectangle immediately after creating the self-loop link, or after you run your custom serialization code?

Stoyan
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Exception dragging a selection
Reply #2 - Mar 12th, 2009 at 4:20pm
Print Post  
Hi Stoyo,

1) I create a new empty diagram.
2) I add the self-linked table.
3) I apply the layout.
4) Close and save.
5) Open again.
6) I drag select over it.
7) crash.

If I omit the step 3 nothing happens.

If I omit the steps 4 and 5 nothing happens.

So seems like is something related with the layout and the deserialization with the self links.

Cheers.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exception dragging a selection
Reply #3 - Mar 13th, 2009 at 12:07pm
Print Post  
Hi,

OrthogonalRouter should set the link.Style to Cascading. Could you check why it is Bezier after deserialization? Also check if it has 3 * SegmentCount + 1 points in ControlPoints.

Stoyan
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Exception dragging a selection
Reply #4 - Mar 16th, 2009 at 5:35pm
Print Post  
It's a little bit strange. This is the obtained configuration for a self-loop link:

<Link Id="196">

<ControlPoints SegmentCount="3">

<Point X="262.5" Y="187.5" />

<Point X="262.5" Y="82.5" />

<Point X="262.5" Y="82.5" />

<Point X="262.5" Y="187.5" />

</ControlPoints>
</Link>

Makes sense for you?

I don't know where the Beizer stuff come from.

Find all "Bezier", Subfolders, Keep modified files open, Find Results 1, "Current Project", "*.vb;*.resx;*.xsd;*.wsdl;*.htm;*.html;*.aspx;*.ascx;*.asmx;*.svc;*.asax;*.confi
g;*.asp;*.asa;*.css;*.xml; *.xaml; *.cs;"
  Matching lines: 0    Matching files: 0    Total files searched: 20

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exception dragging a selection
Reply #5 - Mar 16th, 2009 at 6:56pm
Print Post  
CreateDiagramLink might automatically set the link.Style to Bezier if the origin and destination arguments are the same node. Could you set a breakpoint in your deserialization code and verify if that's what happens?
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Exception dragging a selection
Reply #6 - Mar 18th, 2009 at 12:41pm
Print Post  
Yes, something strange happens.

I create a link and is Bezier, I do:

link.Style = style;

Where "style" is "Polyline" ... but the property remains in "Bezier".

I hope this clue help you.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exception dragging a selection
Reply #7 - Mar 18th, 2009 at 2:48pm
Print Post  
There's this code in the Style setter:

if (value != LinkStyle.Bezier)
{
     if (IsReflexive() && segmentCount < 3)
           return;
}

Seems you'll have to set SegmentCount = 3 before changing the Style of a reflexive link.

Cheers.
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Exception dragging a selection
Reply #8 - Mar 18th, 2009 at 4:55pm
Print Post  
I've done:

Code
Select All
		link.Style = style;

		if ( link.Style == LinkStyle.Bezier )
		{
		    link.SegmentCount = 3;
		    link.Style = LinkStyle.Polyline;
		}
 



And seems to work.

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