diff --git a/GraphX.Controls/Controls/GraphArea.cs b/GraphX.Controls/Controls/GraphArea.cs index 7d280b83..4520bd98 100644 --- a/GraphX.Controls/Controls/GraphArea.cs +++ b/GraphX.Controls/Controls/GraphArea.cs @@ -855,6 +855,9 @@ await DispatcherHelper.CheckBeginInvokeOnUi(() => if (!localLogicCore.GenerateAlgorithmStorage(vertexSizes, vertexPositions)) return; + //clear routing info + localLogicCore.Graph.Edges.ForEach(a => a.RoutingPoints = null); + var resultCoords = localLogicCore.Compute(cancellationToken); #if WPF diff --git a/GraphX.Controls/Models/DefaultLabelFactory.cs b/GraphX.Controls/Models/DefaultLabelFactory.cs index 934e125e..1af6fdbb 100644 --- a/GraphX.Controls/Models/DefaultLabelFactory.cs +++ b/GraphX.Controls/Models/DefaultLabelFactory.cs @@ -1,5 +1,7 @@ - -using System.Windows; +using System.Windows; +#if METRO +using Windows.UI.Xaml; +#endif namespace GraphX.Controls.Models { diff --git a/GraphX.Controls/Models/Interfaces/ILabelFactory.cs b/GraphX.Controls/Models/Interfaces/ILabelFactory.cs index 7b55be5a..b2a4c598 100644 --- a/GraphX.Controls/Models/Interfaces/ILabelFactory.cs +++ b/GraphX.Controls/Models/Interfaces/ILabelFactory.cs @@ -1,4 +1,7 @@ using System.Windows; +#if METRO +using Windows.UI.Xaml; +#endif namespace GraphX.Controls.Models { diff --git a/GraphX.PCL.Logic/Algorithms/LayoutAlgorithms/Hierarchical/EfficientSugiyamaLayoutAlgorithm.HorizontalAssignment.cs b/GraphX.PCL.Logic/Algorithms/LayoutAlgorithms/Hierarchical/EfficientSugiyamaLayoutAlgorithm.HorizontalAssignment.cs index 77851142..71f90be6 100644 --- a/GraphX.PCL.Logic/Algorithms/LayoutAlgorithms/Hierarchical/EfficientSugiyamaLayoutAlgorithm.HorizontalAssignment.cs +++ b/GraphX.PCL.Logic/Algorithms/LayoutAlgorithms/Hierarchical/EfficientSugiyamaLayoutAlgorithm.HorizontalAssignment.cs @@ -83,58 +83,18 @@ private void DoOrthogonalEdgeRouting(double offsetY) new Point(0, 0) }; } - - if ((Parameters.Direction == LayoutDirection.LeftToRight || Parameters.Direction == LayoutDirection.RightToLeft) && sourcePosition.Y != targetPosition.Y) + else if ((Parameters.Direction == LayoutDirection.LeftToRight || Parameters.Direction == LayoutDirection.RightToLeft) && sourcePosition.Y != targetPosition.Y) { _edgeRoutingPoints[edge] = new[] { new Point(0, 0), - new Point(sourcePosition.X + sourceSize.Width /2, targetPosition.Y + targetSize.Height / 2), + new Point(sourcePosition.X + sourceSize.Width/2, targetPosition.Y + targetSize.Height/2), new Point(0, 0) }; } - - - } - /* foreach (var edge in VisitedGraph.Edges) - { - Point[] orthoRoutePoints = new Point[2]; - var sourceVertex = _vertexMap[edge.Source]; - var targetVertex = _vertexMap[edge.Target]; - bool notSwitched = (sourceVertex.LayerIndex < targetVertex.LayerIndex); - int sourceIndex = notSwitched ? 0 : 1; - int targetIndex = notSwitched ? 1 : 0; - orthoRoutePoints[sourceIndex] = new Point() - { - X = sourceVertex.HorizontalPosition, - Y = _layerPositions[sourceVertex.LayerIndex] + _layerHeights[sourceVertex.LayerIndex] + Parameters.LayerDistance / 2.0 - }; - orthoRoutePoints[targetIndex] = new Point() - { - X = targetVertex.HorizontalPosition, - Y = _layerPositions[targetVertex.LayerIndex] - Parameters.LayerDistance / 2.0 - }; - _edgeRoutingPoints[edge] = orthoRoutePoints; - } - - foreach (var kvp in _dummyVerticesOfEdges) - { - Point[] orthoRoutePoints = _edgeRoutingPoints[kvp.Key]; - - var routePoints = new Point[kvp.Value.Count + 4]; - routePoints[0] = orthoRoutePoints[0]; - routePoints[kvp.Value.Count + 3] = orthoRoutePoints[1]; - for (int i = 0; i < kvp.Value.Count; i++) - { - var vertex = kvp.Value[i]; - routePoints[i+2] = new Point(vertex.HorizontalPosition, vertex.VerticalPosition); - } - routePoints[1] = new Point(routePoints[2].X, routePoints[0].Y); - routePoints[kvp.Value.Count + 2] = new Point(routePoints[kvp.Value.Count + 1].X, routePoints[kvp.Value.Count + 3].Y); - _edgeRoutingPoints[kvp.Key] = routePoints; + else _edgeRoutingPoints[edge] = null; } - */ } private void DoTraditionalEdgeRouting()