From 1c2880cf2c92f6a1fcfd2961eb1461377f9540e6 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Sun, 24 May 2015 00:54:28 +0300 Subject: [PATCH] + Added new property GrphArea::ControlsDrawOrder which defines vertex or edges should be drawn topmost [WPF, METRO] --- Documents/CHANGELOG.txt | 1 + Examples/METRO.SimpleGraph/MainPage.xaml.cs | 2 ++ Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs | 1 - GraphX.Controls/Controls/GraphArea.cs | 8 +++++++- GraphX.Controls/Controls/Misc/ControlDrawOrder.cs | 11 +++++++++++ GraphX.Controls/GraphX.WPF.Controls.csproj | 1 + GraphX.METRO.Controls/Controls/GraphArea.cs | 9 ++++++++- .../Controls/Misc/ControlDrawOrder.cs | 11 +++++++++++ GraphX.METRO.Controls/GraphX.METRO.Controls.csproj | 1 + 9 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 GraphX.Controls/Controls/Misc/ControlDrawOrder.cs create mode 100644 GraphX.METRO.Controls/Controls/Misc/ControlDrawOrder.cs diff --git a/Documents/CHANGELOG.txt b/Documents/CHANGELOG.txt index 99d41be..58420aa 100644 --- a/Documents/CHANGELOG.txt +++ b/Documents/CHANGELOG.txt @@ -20,6 +20,7 @@ DETAILED CHANGELOG: + Added VertexShape::None enum option, currently affecting only VCP logic [ALL] + Added different layout options to EfficientSugiyama algorithm using new Direction param [ALL] + Added true orthogonal edge routing for EfficientSugiyama algorithm using EdgeRouting param [ALL] ++ Added new property GrphArea::ControlsDrawOrder which defines vertex or edges should be drawn topmost [WPF, METRO] + Fixed layout algorithm calculations to always receive actual vertex positions as input parameter This will fix VAESPS for default algorithms. [WPF, METRO] + Fixed edge pointer positioning bug [METRO] diff --git a/Examples/METRO.SimpleGraph/MainPage.xaml.cs b/Examples/METRO.SimpleGraph/MainPage.xaml.cs index d3d0cce..939bf3b 100644 --- a/Examples/METRO.SimpleGraph/MainPage.xaml.cs +++ b/Examples/METRO.SimpleGraph/MainPage.xaml.cs @@ -6,6 +6,7 @@ using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Navigation; +using GraphX.METRO.Controls; using GraphX.METRO.Controls.Animations; using GraphX.METRO.Controls.Models; using GraphX.PCL.Common.Enums; @@ -41,6 +42,7 @@ namespace METRO.SimpleGraph graph.GenerateGraphFinished += OnFinishedLayout; graph.RelayoutFinished += OnFinishedLayout; graph.AlignAllEdgesLabels(); + graph.ControlsDrawOrder = ControlDrawOrder.EdgesOnTop; Loaded += MainPage_Loaded; } diff --git a/Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs b/Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs index da59e1d..80a474c 100644 --- a/Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs +++ b/Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using GraphX; using GraphX.PCL.Common.Enums; using GraphX.WPF.Controls; using Microsoft.Win32; diff --git a/GraphX.Controls/Controls/GraphArea.cs b/GraphX.Controls/Controls/GraphArea.cs index 75c7df8..b6fb2ff 100644 --- a/GraphX.Controls/Controls/GraphArea.cs +++ b/GraphX.Controls/Controls/GraphArea.cs @@ -33,6 +33,10 @@ namespace GraphX.WPF.Controls #region My properties + /// + /// Gets or sets in which order GraphX controls are drawn + /// + public ControlDrawOrder ControlsDrawOrder { get; set; } public static readonly DependencyProperty LogicCoreProperty = DependencyProperty.Register("LogicCore", typeof(IGXLogicCore), typeof(GraphArea), new UIPropertyMetadata(null, logic_core_changed)); @@ -418,7 +422,9 @@ namespace GraphX.WPF.Controls _edgeslist.Add(edgeData, edgeControl); try { - base.Children.Insert(num, edgeControl); + if (ControlsDrawOrder == ControlDrawOrder.VerticesOnTop || num != 0) + base.Children.Insert(num, edgeControl); + else base.Children.Add(edgeControl); } catch (Exception ex) { diff --git a/GraphX.Controls/Controls/Misc/ControlDrawOrder.cs b/GraphX.Controls/Controls/Misc/ControlDrawOrder.cs new file mode 100644 index 0000000..de2c34f --- /dev/null +++ b/GraphX.Controls/Controls/Misc/ControlDrawOrder.cs @@ -0,0 +1,11 @@ +namespace GraphX.WPF.Controls +{ + /// + /// Defines in which order GraphX controls are drawn + /// + public enum ControlDrawOrder + { + VerticesOnTop = 1, + EdgesOnTop + } +} diff --git a/GraphX.Controls/GraphX.WPF.Controls.csproj b/GraphX.Controls/GraphX.WPF.Controls.csproj index b02a3b9..c8d23a9 100644 --- a/GraphX.Controls/GraphX.WPF.Controls.csproj +++ b/GraphX.Controls/GraphX.WPF.Controls.csproj @@ -95,6 +95,7 @@ + diff --git a/GraphX.METRO.Controls/Controls/GraphArea.cs b/GraphX.METRO.Controls/Controls/GraphArea.cs index 7305acd..7529017 100644 --- a/GraphX.METRO.Controls/Controls/GraphArea.cs +++ b/GraphX.METRO.Controls/Controls/GraphArea.cs @@ -29,6 +29,11 @@ namespace GraphX.METRO.Controls #region My properties + /// + /// Gets or sets in which order GraphX controls are drawn + /// + public ControlDrawOrder ControlsDrawOrder { get; set; } + public static readonly DependencyProperty LogicCoreProperty = DependencyProperty.Register("LogicCore", typeof(IGXLogicCore), typeof(GraphArea), new PropertyMetadata(null, logic_core_changed)); @@ -401,7 +406,9 @@ namespace GraphX.METRO.Controls _edgeslist.Add(edgeData, edgeControl); try { - base.Children.Insert(num, edgeControl); + if (ControlsDrawOrder == ControlDrawOrder.VerticesOnTop || num != 0) + base.Children.Insert(num, edgeControl); + else base.Children.Add(edgeControl); } catch (Exception ex) { diff --git a/GraphX.METRO.Controls/Controls/Misc/ControlDrawOrder.cs b/GraphX.METRO.Controls/Controls/Misc/ControlDrawOrder.cs new file mode 100644 index 0000000..977fe96 --- /dev/null +++ b/GraphX.METRO.Controls/Controls/Misc/ControlDrawOrder.cs @@ -0,0 +1,11 @@ +namespace GraphX.METRO.Controls +{ + /// + /// Defines in which order GraphX controls are drawn + /// + public enum ControlDrawOrder + { + VerticesOnTop = 1, + EdgesOnTop + } +} diff --git a/GraphX.METRO.Controls/GraphX.METRO.Controls.csproj b/GraphX.METRO.Controls/GraphX.METRO.Controls.csproj index da789ec..79731a5 100644 --- a/GraphX.METRO.Controls/GraphX.METRO.Controls.csproj +++ b/GraphX.METRO.Controls/GraphX.METRO.Controls.csproj @@ -132,6 +132,7 @@ +