Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 6f1beb22 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

[VECTO] Upgrade to NET5.0

parent 91610cc1
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<Configurations>Debug;Release;Deploy</Configurations> <Configurations>Debug;Release;Deploy</Configurations>
<DefineDebug>false</DefineDebug> <DefineDebug>false</DefineDebug>
<DefineTrace>false</DefineTrace> <DefineTrace>false</DefineTrace>
<TargetFrameworks>net45;net48;net5.0-windows</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
...@@ -28,17 +29,38 @@ ...@@ -28,17 +29,38 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj" /> <ItemGroup Condition="'$(TargetFramework)'=='net45'">
<ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj" /> <Reference Include="Microsoft.Build.Framework" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Condition="'$(TargetFramework)'=='net48'">
<Reference Include="Microsoft.Build.Framework" /> <Reference Include="Microsoft.Build.Framework" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Windows.Forms.DataVisualization" /> <Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net5.0-windows'">
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<Reference Include="System.Windows.Forms">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms.DataVisualization">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.DataVisualization.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VectoCommon\VectoCommon\VectoCommon.csproj" />
<ProjectReference Include="..\VectoCore\VectoCore\VectoCore.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Import Include="Microsoft.VisualBasic" /> <Import Include="Microsoft.VisualBasic" />
<Import Include="System" /> <Import Include="System" />
......
...@@ -31,8 +31,12 @@ ...@@ -31,8 +31,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows.Forms.DataVisualization.Charting;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
...@@ -126,6 +130,7 @@ namespace TUGraz.VectoCore.Utils ...@@ -126,6 +130,7 @@ namespace TUGraz.VectoCore.Utils
triangles.AddRange(newTriangles); triangles.AddRange(newTriangles);
//DrawGraph(pointCount, triangles, superTriangle, xmin, xmax, ymin, ymax, point);
pointCount++; pointCount++;
// check invariant: m = 2n-2-k // check invariant: m = 2n-2-k
...@@ -138,6 +143,9 @@ namespace TUGraz.VectoCore.Utils ...@@ -138,6 +143,9 @@ namespace TUGraz.VectoCore.Utils
} }
} }
#if TRACE
DrawGraph(pointCount, triangles, superTriangle, points);
#endif
_convexHull = triangles.FindAll(t => t.SharesVertexWith(superTriangle)). _convexHull = triangles.FindAll(t => t.SharesVertexWith(superTriangle)).
SelectMany(t => t.GetEdges()). SelectMany(t => t.GetEdges()).
Where(e => !(superTriangle.Contains(e.P1) || superTriangle.Contains(e.P2))).ToArray(); Where(e => !(superTriangle.Contains(e.P1) || superTriangle.Contains(e.P2))).ToArray();
...@@ -158,6 +166,67 @@ namespace TUGraz.VectoCore.Utils ...@@ -158,6 +166,67 @@ namespace TUGraz.VectoCore.Utils
} }
} }
public void DrawGraph()
{
var superTriangle = new Triangle(new Point(-1, -1), new Point(4, -1), new Point(-1, 4));
DrawGraph(0, _triangles, superTriangle, _points.ToArray());
}
/// <summary>
/// Draws the delaunay map (except supertriangle).
/// </summary>
private static void DrawGraph(int i, IEnumerable<Triangle> triangles, Triangle superTriangle, Point[] points,
Point lastPoint = null)
{
var xmin = Math.Min(points.Min(p => p.X), lastPoint?.X ?? double.NaN);
var xmax = Math.Max(points.Max(p => p.X), lastPoint?.X ?? double.NaN);
var ymin = Math.Min(points.Min(p => p.Y), lastPoint?.Y ?? double.NaN);
var ymax = Math.Max(points.Max(p => p.Y), lastPoint?.Y ?? double.NaN);
using (var chart = new Chart { Width = 1000, Height = 1000 }) {
chart.ChartAreas.Add(new ChartArea("main") {
AxisX = new Axis { Minimum = Math.Min(xmin, xmin), Maximum = Math.Max(xmax, xmax) },
AxisY = new Axis { Minimum = Math.Min(ymin, ymin), Maximum = Math.Max(ymax, ymax) }
});
foreach (var tr in triangles) {
if (tr.SharesVertexWith(superTriangle)) {
continue;
}
var series = new Series {
ChartType = SeriesChartType.FastLine,
Color = lastPoint != null && tr.Contains(lastPoint) ? Color.Red : Color.Blue
};
series.Points.AddXY(tr.P1.X, tr.P1.Y);
series.Points.AddXY(tr.P2.X, tr.P2.Y);
series.Points.AddXY(tr.P3.X, tr.P3.Y);
series.Points.AddXY(tr.P1.X, tr.P1.Y);
chart.Series.Add(series);
}
if (lastPoint != null) {
var series = new Series {
ChartType = SeriesChartType.Point,
Color = Color.Red,
MarkerSize = 5,
MarkerStyle = MarkerStyle.Circle
};
series.Points.AddXY(lastPoint.X, lastPoint.Y);
chart.Series.Add(series);
}
var frame = new StackFrame(2);
var method = frame.GetMethod();
System.Diagnostics.Debug.Assert(method.DeclaringType != null, "method.DeclaringType != null");
var type = method.DeclaringType.Name.Split(Path.GetInvalidFileNameChars()).Join("");
var methodName = method.Name.Split(Path.GetInvalidFileNameChars()).Join("");
Directory.CreateDirectory("delaunay");
chart.SaveImage($"delaunay\\{type}_{methodName}_{superTriangle.GetHashCode()}_{i}.png",
ChartImageFormat.Png);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public double Interpolate(SI x, SI y) public double Interpolate(SI x, SI y)
{ {
......
...@@ -12,19 +12,33 @@ ...@@ -12,19 +12,33 @@
<PackageReference Include="Ninject.Extensions.Factory" Version="3.3.3" /> <PackageReference Include="Ninject.Extensions.Factory" Version="3.3.3" />
<PackageReference Include="NLog" Version="4.7.13" /> <PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net45'" > <ItemGroup Condition="'$(TargetFramework)'=='net45'">
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" /> <PackageReference Include="System.ValueTuple" Version="4.5.0" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net48'" > <ItemGroup Condition="'$(TargetFramework)'=='net48'">
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<Reference Include="System.Windows.Forms">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms.DataVisualization">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.DataVisualization.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<InternalsVisibleTo Include="VectoAPI" /> <InternalsVisibleTo Include="VectoAPI" />
...@@ -292,16 +306,13 @@ ...@@ -292,16 +306,13 @@
<ItemGroup> <ItemGroup>
<Compile Update="JSONKeys.Designer.cs"> <Compile Update="JSONKeys.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>JSONKeys.resx</DependentUpon> <DependentUpon>JSONKeys.resx</DependentUpon>
</Compile> </Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="JSONKeys.resx"> <EmbeddedResource Update="JSONKeys.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>JSONKeys.Designer.cs</LastGenOutput> <LastGenOutput>JSONKeys.Designer.cs</LastGenOutput>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<TargetFrameworks>net5.0</TargetFrameworks> <TargetFrameworks>net5.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /> <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
...@@ -18,11 +17,6 @@ ...@@ -18,11 +17,6 @@
<PackageReference Include="NLog" Version="4.7.13" /> <PackageReference Include="NLog" Version="4.7.13" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'net48'">
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj" /> <ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj" />
<ProjectReference Include="..\..\VectoCommon\VectoHashing\VectoHashing.csproj" /> <ProjectReference Include="..\..\VectoCommon\VectoHashing\VectoHashing.csproj" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment