diff --git a/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 b/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 index 8fd5a52..c6dc8e9 100644 Binary files a/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 and b/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/opdracht2/v16/.suo b/.vs/opdracht2/v16/.suo index 672b7b6..335b0c3 100644 Binary files a/.vs/opdracht2/v16/.suo and b/.vs/opdracht2/v16/.suo differ diff --git a/Datalaag/bin/Debug/Globals.dll b/Datalaag/bin/Debug/Globals.dll index e3f3923..dc7c916 100644 Binary files a/Datalaag/bin/Debug/Globals.dll and b/Datalaag/bin/Debug/Globals.dll differ diff --git a/Datalaag/bin/Debug/Globals.pdb b/Datalaag/bin/Debug/Globals.pdb index 04d3fad..aae197c 100644 Binary files a/Datalaag/bin/Debug/Globals.pdb and b/Datalaag/bin/Debug/Globals.pdb differ diff --git a/Datalaag/obj/Debug/Datalaag.csprojAssemblyReference.cache b/Datalaag/obj/Debug/Datalaag.csprojAssemblyReference.cache index 0425d5b..eb6f44c 100644 Binary files a/Datalaag/obj/Debug/Datalaag.csprojAssemblyReference.cache and b/Datalaag/obj/Debug/Datalaag.csprojAssemblyReference.cache differ diff --git a/Globals/PolygonPunten.cs b/Globals/PolygonPunten.cs index 8e2d938..e1e53e3 100644 --- a/Globals/PolygonPunten.cs +++ b/Globals/PolygonPunten.cs @@ -27,22 +27,18 @@ namespace Globals { Naam = naam; Punten = new List(); - MaximumX = double.MinValue; - MaximumY = double.MinValue; - MinimumX = double.MaxValue; - MinimumY = double.MaxValue; foreach (LineString l in p.Coordinates) { foreach (Position pos in l.Coordinates) { - if (pos.Longitude > MaximumX) MaximumX = pos.Longitude; - if (pos.Longitude < MinimumX) MinimumX = pos.Longitude; - if (pos.Latitude > MaximumY) MaximumY = pos.Latitude; - if (pos.Latitude < MinimumY) MinimumY = pos.Latitude; Punten.Add(new Punt(pos.Longitude, pos.Latitude, naam)); } } Punten.Reverse(); + MaximumX = Punten.Max(punt => punt.X); + MaximumY = Punten.Max(punt => punt.Y); + MinimumX = Punten.Min(punt => punt.X); + MinimumY = Punten.Min(punt => punt.Y); } public override string ToString() diff --git a/Globals/Punt.cs b/Globals/Punt.cs index 7907b0d..7557a06 100644 --- a/Globals/Punt.cs +++ b/Globals/Punt.cs @@ -14,8 +14,8 @@ namespace Globals public Punt(double x, double y, string naam = "") { Naam = naam; - X = x; - Y = y; + X = ConvertToRadians(x); + Y = ConvertToRadians(y); } public override string ToString() @@ -23,7 +23,12 @@ namespace Globals if (string.Equals(Naam, "", StringComparison.Ordinal)) return "UNKNOWN"; else return Naam; } - + + public double ConvertToRadians(double angle) + { + return (Math.PI / 180) * angle; + } + public Point ToPoint() { return new Point(X, Y); diff --git a/Globals/bin/Debug/Globals.dll b/Globals/bin/Debug/Globals.dll index e3f3923..dc7c916 100644 Binary files a/Globals/bin/Debug/Globals.dll and b/Globals/bin/Debug/Globals.dll differ diff --git a/Globals/bin/Debug/Globals.pdb b/Globals/bin/Debug/Globals.pdb index 04d3fad..aae197c 100644 Binary files a/Globals/bin/Debug/Globals.pdb and b/Globals/bin/Debug/Globals.pdb differ diff --git a/Globals/obj/Debug/Globals.csprojAssemblyReference.cache b/Globals/obj/Debug/Globals.csprojAssemblyReference.cache index aaff102..6f307db 100644 Binary files a/Globals/obj/Debug/Globals.csprojAssemblyReference.cache and b/Globals/obj/Debug/Globals.csprojAssemblyReference.cache differ diff --git a/Globals/obj/Debug/Globals.dll b/Globals/obj/Debug/Globals.dll index e3f3923..dc7c916 100644 Binary files a/Globals/obj/Debug/Globals.dll and b/Globals/obj/Debug/Globals.dll differ diff --git a/Globals/obj/Debug/Globals.pdb b/Globals/obj/Debug/Globals.pdb index 04d3fad..aae197c 100644 Binary files a/Globals/obj/Debug/Globals.pdb and b/Globals/obj/Debug/Globals.pdb differ diff --git a/Logica/PolygonManipulatie.cs b/Logica/PolygonManipulatie.cs index 5f35751..06d056f 100644 --- a/Logica/PolygonManipulatie.cs +++ b/Logica/PolygonManipulatie.cs @@ -43,31 +43,37 @@ namespace Logica return TriangulatePolygon(polygon); } - public PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY, double offsetX = 0, double offsetY = 0) + public PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY, double offsetX = 180, double offsetY = 180) { double maxX = polygon.MaximumX; double maxY = polygon.MaximumY; double minX = polygon.MinimumX; double minY = polygon.MinimumY; - maxX -= minX; - maxY -= minY; List returnWaarde = new List(); foreach (Punt punt in polygon.Punten) { - double x = punt.X - minX; - x /= maxX; - x *= scaleX; - x += offsetX; - double y = punt.Y - minY; - y /= maxY; - y *= scaleY; - y += offsetY; - returnWaarde.Add(new Punt(x, y, punt.Naam)); - + Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY); + x.Naam = punt.Naam; + returnWaarde.Add(x); } return new PolygonPunten(returnWaarde, polygon.Naam); } + //lat en long = graden, graden => coords (/360 * scale? + private static Punt ScalePoint(double scaleX, double scaleY, Punt punt, double maxX = 360, double maxY = 360, double offsetX = 180, double + offsetY = 180) + { + double x = punt.X; + x /= maxX; + x *= scaleX; + x += offsetX; + double y = punt.Y; + y /= maxY; + y *= scaleY; + y += offsetY; + return new Punt(x, y); + } + public MultiPolygonPunten ScaleMultiPolygon(MultiPolygonPunten multiPolygon, double scaleX, double scaleY, double offsetX = 0, double offsetY = 0) { double maxX = multiPolygon.MaximumX; @@ -82,6 +88,7 @@ namespace Logica List returnWaarde = new List(); foreach (Punt punt in polygon.Punten) { + /* double x = punt.X - minX; x /= maxX; x *= scaleX; @@ -90,7 +97,11 @@ namespace Logica y /= maxY; y *= scaleY; y += offsetY; - returnWaarde.Add(new Punt(x, y, punt.Naam)); + returnWaarde.Add(new Punt(x, y, punt.Naam));*/ + + Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY); + x.Naam = punt.Naam; + returnWaarde.Add(x); } pp.Add(new PolygonPunten(returnWaarde, polygon.Naam)); @@ -115,8 +126,11 @@ namespace Logica List punten = new List(); foreach (Punt punt in poly.Punten) { - - double x = punt.X - minX; + + Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY); + x.Naam = punt.Naam; + punten.Add(x); + /*double x = punt.X - minX; x /= maxX; x *= scaleX; x += offsetX; @@ -124,7 +138,7 @@ namespace Logica y /= maxY; y *= scaleY; y += offsetY; - punten.Add(new Punt(x, y, punt.Naam)); + punten.Add(new Punt(x, y, punt.Naam));*/ } pp.Add(new PolygonPunten(punten, poly.Naam)); } diff --git a/Logica/bin/Debug/Globals.dll b/Logica/bin/Debug/Globals.dll index e3f3923..dc7c916 100644 Binary files a/Logica/bin/Debug/Globals.dll and b/Logica/bin/Debug/Globals.dll differ diff --git a/Logica/bin/Debug/Globals.pdb b/Logica/bin/Debug/Globals.pdb index 04d3fad..aae197c 100644 Binary files a/Logica/bin/Debug/Globals.pdb and b/Logica/bin/Debug/Globals.pdb differ diff --git a/Logica/bin/Debug/Logica.dll b/Logica/bin/Debug/Logica.dll index 4233c0a..188a916 100644 Binary files a/Logica/bin/Debug/Logica.dll and b/Logica/bin/Debug/Logica.dll differ diff --git a/Logica/bin/Debug/Logica.pdb b/Logica/bin/Debug/Logica.pdb index 7ef1175..2cff323 100644 Binary files a/Logica/bin/Debug/Logica.pdb and b/Logica/bin/Debug/Logica.pdb differ diff --git a/Logica/obj/Debug/Logica.csprojAssemblyReference.cache b/Logica/obj/Debug/Logica.csprojAssemblyReference.cache index 4dbd928..1a0d717 100644 Binary files a/Logica/obj/Debug/Logica.csprojAssemblyReference.cache and b/Logica/obj/Debug/Logica.csprojAssemblyReference.cache differ diff --git a/Logica/obj/Debug/Logica.dll b/Logica/obj/Debug/Logica.dll index 4233c0a..188a916 100644 Binary files a/Logica/obj/Debug/Logica.dll and b/Logica/obj/Debug/Logica.dll differ diff --git a/Logica/obj/Debug/Logica.pdb b/Logica/obj/Debug/Logica.pdb index 7ef1175..2cff323 100644 Binary files a/Logica/obj/Debug/Logica.pdb and b/Logica/obj/Debug/Logica.pdb differ diff --git a/opdracht2/bin/Debug/netcoreapp3.1/Globals.dll b/opdracht2/bin/Debug/netcoreapp3.1/Globals.dll index e3f3923..dc7c916 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/Globals.dll and b/opdracht2/bin/Debug/netcoreapp3.1/Globals.dll differ diff --git a/opdracht2/bin/Debug/netcoreapp3.1/Globals.pdb b/opdracht2/bin/Debug/netcoreapp3.1/Globals.pdb index 04d3fad..aae197c 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/Globals.pdb and b/opdracht2/bin/Debug/netcoreapp3.1/Globals.pdb differ diff --git a/opdracht2/bin/Debug/netcoreapp3.1/Logica.dll b/opdracht2/bin/Debug/netcoreapp3.1/Logica.dll index 4233c0a..188a916 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/Logica.dll and b/opdracht2/bin/Debug/netcoreapp3.1/Logica.dll differ diff --git a/opdracht2/bin/Debug/netcoreapp3.1/Logica.pdb b/opdracht2/bin/Debug/netcoreapp3.1/Logica.pdb index 7ef1175..2cff323 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/Logica.pdb and b/opdracht2/bin/Debug/netcoreapp3.1/Logica.pdb differ diff --git a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.csprojAssemblyReference.cache b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.csprojAssemblyReference.cache index a638e34..dcead26 100644 Binary files a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.csprojAssemblyReference.cache and b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.csprojAssemblyReference.cache differ diff --git a/opdracht2/obj/opdracht2.csproj.nuget.dgspec.json b/opdracht2/obj/opdracht2.csproj.nuget.dgspec.json index 3340e16..178a586 100644 --- a/opdracht2/obj/opdracht2.csproj.nuget.dgspec.json +++ b/opdracht2/obj/opdracht2.csproj.nuget.dgspec.json @@ -5,6 +5,7 @@ }, "projects": { "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj": { + "version": "1.0.0", "restore": { "projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj", "projectName": "Datalaag", @@ -24,6 +25,7 @@ } }, "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj": { + "version": "1.0.0", "restore": { "projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj", "projectName": "Globals", @@ -34,6 +36,7 @@ } }, "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj": { + "version": "1.0.0", "restore": { "projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj", "projectName": "Logica", diff --git a/opdracht2/obj/opdracht2.csproj.nuget.g.props b/opdracht2/obj/opdracht2.csproj.nuget.g.props index f4394fb..06e0a7a 100644 --- a/opdracht2/obj/opdracht2.csproj.nuget.g.props +++ b/opdracht2/obj/opdracht2.csproj.nuget.g.props @@ -7,7 +7,7 @@ $(UserProfile)\.nuget\packages\ C:\Users\Beppe\.nuget\packages\ PackageReference - 5.6.0 + 5.5.0 $(MSBuildAllProjects);$(MSBuildThisFileFullPath) diff --git a/opdracht2/obj/project.nuget.cache b/opdracht2/obj/project.nuget.cache index c7b4006..dc4ba08 100644 --- a/opdracht2/obj/project.nuget.cache +++ b/opdracht2/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "Zy6jypDVLiSwLfNswZHvoD7ul/+NOG2AgIE/eLzWMMgAaQ+TzAjn3Or2nqa6RpIYT9zQrkp/4+yCHo1D0FoSMQ==", + "dgSpecHash": "p426YNxR+un7rXUpsV3S3g0htKyuFPUxB5pYHNl1fsHxje10LlIJDBLjupJb2IZCMEZ+Cv3TXWBEUMbbMYO5hA==", "success": true, "projectFilePath": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\opdracht2\\opdracht2.csproj", "expectedPackageFiles": [