+ refactoring
This commit is contained in:
panthernet 2016-08-16 21:22:35 +03:00
Родитель 6ed923d617
Коммит a138a6a3d0
5 изменённых файлов: 68 добавлений и 12 удалений

Двоичные данные
GraphX.METRO.Controls/GRaphX.METRO.Controls.pfx Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -340,6 +340,7 @@
<Content Include="Images\help_black.png" />
</ItemGroup>
<ItemGroup>
<None Include="GRaphX.METRO.Controls.pfx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@ -353,6 +354,12 @@
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>GRaphX.METRO.Controls.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Просмотреть файл

@ -14,7 +14,15 @@ namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
{
protected IEdgeRoutingParameters Parameters;
protected TGraph Graph;
/// <summary>
/// Gets or sets visual vertices sizes (autofilled before Compute() call)
/// </summary>
public IDictionary<TVertex, Rect> VertexSizes { get; set; }
/// <summary>
/// Gets or sets visual vertices positions (autofilled before Compute() call)
/// </summary>
public IDictionary<TVertex, Point> VertexPositions { get; set; }
/// <summary>
@ -26,6 +34,13 @@ namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
private set;
}
/// <summary>
/// Base class for edge routing algorithms
/// </summary>
/// <param name="graph">Graph</param>
/// <param name="vertexPositions">Vertex positions dictionary</param>
/// <param name="vertexSizes">Vertex sizes dictionary</param>
/// <param name="parameters">Algorithm parameters</param>
protected EdgeRoutingAlgorithmBase(TGraph graph, IDictionary<TVertex, Point> vertexPositions, IDictionary<TVertex, Rect> vertexSizes, IEdgeRoutingParameters parameters = null)
{
Graph = graph;
@ -35,19 +50,34 @@ namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
EdgeRoutes = new Dictionary<TEdge, Point[]>();
}
/// <summary>
/// Returns algorithm parameters as specified type
/// </summary>
/// <typeparam name="T">Type</typeparam>
public T GetParameters<T>()
where T: class
{
return Parameters as T;
}
/// <summary>
/// Run algorithm calculation
/// </summary>
public virtual void Compute(CancellationToken cancellationToken)
{
}
public abstract void Compute(CancellationToken cancellationToken);
public virtual Point[] ComputeSingle(TEdge edge)
{
return null;
}
/// <summary>
/// Compute edge routing for single edge
/// </summary>
/// <param name="edge">Supplied edge data</param>
public abstract Point[] ComputeSingle(TEdge edge);
/// <summary>
/// Update data stored in algorithm for specified vertex
/// </summary>
/// <param name="vertex">Data vertex</param>
/// <param name="position">Vertex position</param>
/// <param name="size">Vertex size</param>
public virtual void UpdateVertexData(TVertex vertex, Point position, Rect size)
{
VertexPositions[vertex] = position;
@ -59,6 +89,9 @@ namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
/// </summary>
public Rect AreaRectangle { get; set; }
/// <summary>
/// Dispose resources
/// </summary>
public void Dispose()
{
Graph = null;

Просмотреть файл

@ -2,19 +2,32 @@
namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
{
/// <summary>
/// Base class for edge routing parameters
/// </summary>
public class EdgeRoutingParameters : IEdgeRoutingParameters
{
/// <summary>
/// Clone parameters
/// </summary>
/// <returns></returns>
public object Clone()
{
return this.MemberwiseClone();
return MemberwiseClone();
}
protected void NotifyChanged( string propertyName )
/// <summary>
/// Calls OnPropertyChange event notification
/// </summary>
/// <param name="propertyName"></param>
protected void NotifyChanged( string propertyName )
{
if ( PropertyChanged != null )
PropertyChanged( this, new System.ComponentModel.PropertyChangedEventArgs( propertyName ) );
PropertyChanged?.Invoke( this, new System.ComponentModel.PropertyChangedEventArgs( propertyName ) );
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// PropertyChange event notification
/// </summary>
protected event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
}
}

Просмотреть файл

@ -23,6 +23,9 @@ namespace GraphX.PCL.Logic.Algorithms.LayoutAlgorithms
}
/// <summary>
/// Vertex data class
/// </summary>
protected class VertexData
{
public TVertex Parent;