Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Library version 3.4.1 and freeform nodes problem (Read 3393 times)
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
Library version 3.4.1 and freeform nodes problem
Aug 29th, 2016 at 10:17am
Print Post  
Hi,

with the latest version of the library 3.4.1 we're experiencing the following issue:

when we create a Freeform node by specifying a convex hull and then we call the updatefrompoints in the constructor, the height and the width of the node is no longer set (NaN). So, when the node is added to the diagram, it crashes. Even trying to specify the bounds by manually set valid coordinates leaves the Width and the Height at NaN.

With the previous version of the library the same code was working, do currently we had to drop the latest version.

Can you provide a fix?

Code
Select All
Points = new StylusPointCollection(hullPoints);
this.UpdateFromPoints();
 



S.

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Library version 3.4.1 and freeform nodes problem
Reply #1 - Aug 30th, 2016 at 8:56am
Print Post  
Hi,

There are no changes in FreeFormNode code since the 3.4 release. Are you running that code from constructor of your own derived class?

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Library version 3.4.1 and freeform nodes problem
Reply #2 - Aug 30th, 2016 at 9:03am
Print Post  
Actually there's one change where we added support for color attributes for you a bit after the 3.4 release - have you ever tried the build from http://mindfusion.eu/Forum/YaBB.pl?num=1457942173/2#2 ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Library version 3.4.1 and freeform nodes problem
Reply #3 - Sep 1st, 2016 at 6:32am
Print Post  
Hi,

This works in our test, please let me know what we should change to reproduce -

Code
Select All
void TestHullPoints()
{
	var coords = new[] { 90, 110, 105, 100, 120, 105, 125, 140, 120, 160, 105, 140 };
	var hullPoints = new Point[coords.Length / 2];
	for (int i = 0; i < hullPoints.Length; i++)
		hullPoints[i] = new Point(coords[i * 2], coords[i * 2 + 1]);

	var node1 = new FreeFormNode();
	node1.Points = new StylusPointCollection(hullPoints);
	node1.UpdateFromPoints();
	node1.Closed = true;
	diagram.Nodes.Add(node1);

	var node2 = new FreeFormNode();
	node2.Points = new StylusPointCollection(hullPoints);
	node2.UpdateFromPoints();
	node2.Closed = false;
	node2.Bounds = Rect.Offset(node2.Bounds, 120, 0);
	diagram.Nodes.Add(node2);

	var node3 = new FreeFormNode2(hullPoints);
	node3.Closed = true;
	node3.Bounds = Rect.Offset(node3.Bounds, 0, 120);
	diagram.Nodes.Add(node3);

	var node4 = new FreeFormNode2(hullPoints);
	node4.Closed = false;
	node4.Bounds = Rect.Offset(node4.Bounds, 120, 120);
	diagram.Nodes.Add(node4);
}

class FreeFormNode2 : FreeFormNode
{
	public FreeFormNode2(Point[] hullPoints)
	{
		Points = new StylusPointCollection(hullPoints);
		this.UpdateFromPoints();
	}
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
Re: Library version 3.4.1 and freeform nodes problem
Reply #4 - Sep 5th, 2016 at 9:51am
Print Post  
Hi,

if we try to use the latest version 3.4.1, we deterministically obtain the following exception.
If we revert back to the previous we've no problems.

This is the constructor of our derived FreeformNode:
Code
Select All
      public ClusterNode(string id, Point[] hullPoints, Cluster data, List<ClusterCompanyNode> nodes)
        {
            EnabledHandles = AdjustmentHandles.None;
            Obstacle = false;
            IsEnabled = false;
            Focusable = false;
            HandlesStyle = MindFusion.Diagramming.Wpf.HandlesStyle.Invisible;

            Points = new StylusPointCollection(hullPoints);
            this.UpdateFromPoints();

            ZIndex = 0;
            Closed = true;

            Stroke = Brushes.Transparent;
            StrokeThickness = 0f;
            Id = CLUST_NODE_ID_PREFIX + id;
            IncludedNodes = nodes;


            UpdateStyles(data);

            (this as IHighlightable).Highlight(false, 95, false);
        }
 



Another relative little problem in the 3.4.0 version, was that the stroke of the node, when set, was never taken into account, but always rendered in black

System.ArgumentOutOfRangeException' occurred in PresentationCore.dll

Height must be greater than or equal to DrawingAttributes.MinHeight and less than or equal to DrawingAttribute.MaxHeight.
Parameter name: Height


Code
Select All
  at System.Windows.Ink.DrawingAttributes.set_Height(Double value)
   at MindFusion.Diagramming.Wpf.FreeFormNode.DrawLocal(DrawingContext graphics, RenderOptions options)
   at MindFusion.Diagramming.Wpf.DiagramNode.Draw(DrawingContext graphics, RenderOptions options)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at A.S.W(Visual S)
   at MindFusion.Diagramming.Wpf.Diagram.WJ(Visual S)
   at MindFusion.Diagramming.Wpf.Diagram.AJ(DiagramItem S)
   at MindFusion.Diagramming.Wpf.Commands.AddItemCmd.Execute(Boolean undoEnabled)
   at MindFusion.Diagramming.Wpf.UndoManager.C(Command S)
   at MindFusion.Diagramming.Wpf.Diagram.DJ(DiagramItem S, Boolean O)
   at MindFusion.Diagramming.Wpf.Diagram.OnAddingItem(Object sender, ItemEventArgs e)
   at MindFusion.Diagramming.Wpf.ItemCollectionBase`1.RaiseAdding(UIElement item)
   at ITSB2B.RepSys.Diagrams.Intercompany.Helpers.ClusterAnalysisHelper.AddClusters(Diagram diagram, IEnumerable`1 companies, ClusterDataCollection clustersData, IEnumerable`1 clusterFilters) in D:\DEV\RepSys\1000_RepsysMovements\Routing\Helpers\ClusterAnalysisHelper.cs:line 663
   at ITSB2B.RepSys.Diagrams.Intercompany.Controls.ClustersViewer.RebuildClusterNodes() in D:\DEV\RepSys\1000_RepsysMovements\Routing\Controls\ClustersViewer.xaml.cs:line 1395
   at ITSB2B.RepSys.Diagrams.Intercompany.Controls.ClustersViewer.clusterTimerTick(Object sender, EventArgs e) in D:\DEV\RepSys\1000_RepsysMovements\Routing\Controls\ClustersViewer.xaml.cs:line 364
   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(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, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at ITSB2B.RepSys.Diagrams.Intercompany.App.Main() in D:\DEV\RepSys\1000_RepsysMovements\Routing\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart() 

  
Back to top
 
IP Logged
 
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
Re: Library version 3.4.1 and freeform nodes problem
Reply #5 - Sep 5th, 2016 at 9:57am
Print Post  
Additional information are:

- The highlight function changes the opacity of the node (never 0), while the UpdateStyle works on the Brush property which can be set to null.

The Stroke has been set to transparent because in the 3.4.0 version was not taken into account and we don't want it black.

S.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Library version 3.4.1 and freeform nodes problem
Reply #6 - Sep 5th, 2016 at 10:09am
Print Post  
Remove the "StrokeThickness = 0f" assignment and it should work.
  
Back to top
 
IP Logged
 
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
Re: Library version 3.4.1 and freeform nodes problem
Reply #7 - Sep 5th, 2016 at 10:29am
Print Post  
Yes, it did.

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