From b2ad2d461110a81418f6f53aef6040158c6532f0 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 26 Jul 2020 20:28:32 +0200 Subject: [PATCH] momenteel geen errors, begonnen nieuwe items toe te voegen op ui --- .vs/opdracht2/DesignTimeBuild/.dtbcache.v2 | Bin 147752 -> 147752 bytes .vs/opdracht2/v16/.suo | Bin 99840 -> 115200 bytes .../Datalaag.csprojAssemblyReference.cache | Bin 424 -> 424 bytes Globals/PolygonPunten.cs | 5 +- Globals/Punt.cs | 2 +- .../DesignTimeResolveAssemblyReferences.cache | Bin 0 -> 424 bytes .../Globals.csprojAssemblyReference.cache | Bin 424 -> 40783 bytes Logica/Logica.csproj | 2 +- Logica/{Class1.cs => PolygonManipulatie.cs} | 121 +++++++++++++++--- .../Logica.csprojAssemblyReference.cache | Bin 424 -> 424 bytes opdracht2/MainWindow.xaml | 6 +- opdracht2/MainWindow.xaml.cs | 30 +++++ .../obj/Debug/netcoreapp3.1/MainWindow.g.cs | 13 +- .../obj/Debug/netcoreapp3.1/MainWindow.g.i.cs | 13 +- .../opdracht2.csprojAssemblyReference.cache | Bin 186486 -> 424 bytes .../opdracht2_MarkupCompile.cache | 2 +- .../obj/opdracht2.csproj.nuget.dgspec.json | 66 +++++++++- opdracht2/obj/opdracht2.csproj.nuget.g.props | 2 +- opdracht2/obj/project.assets.json | 64 ++++++++- opdracht2/obj/project.nuget.cache | 2 +- opdracht2/obj/project.packagespec.json | 12 +- opdracht2/opdracht2.csproj | 6 + 22 files changed, 312 insertions(+), 34 deletions(-) create mode 100644 Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache rename Logica/{Class1.cs => PolygonManipulatie.cs} (50%) diff --git a/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 b/.vs/opdracht2/DesignTimeBuild/.dtbcache.v2 index 0987f7f342af1a4a514ab85ff902e7873c7088c2..d9bb8351857b5cd600d7a1c2f1c4b6ea7e8997d6 100644 GIT binary patch delta 918 zcma*jNpI6Y6bJ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J#z!@Ii3Mct^GrX;xZ3RyV|NaP^lojR} z<$GR-{XDA$^0a&HFd4$1X$O<`K_{#+VzXx*&P?=ZJ!{}d*mxiK0lOf1Gc zKlmkX9{~Tn#hxpLH$fD)=!5GM=We~b@rLs+t-Et?v^3$RoH*RE{;$|v*^JjSn@1}k wcl;E%Lm!bL`OXelj>oI>I6nvJls`{> punt.Y); } - public PolygonPunten(Polygon p, string naam = "") + public PolygonPunten(GeoJSON.Net.Geometry.Polygon p, string naam = "") { Naam = naam; Punten = new List(); @@ -45,6 +43,7 @@ namespace Globals } } } + } } diff --git a/Globals/Punt.cs b/Globals/Punt.cs index da20ea7..7907b0d 100644 --- a/Globals/Punt.cs +++ b/Globals/Punt.cs @@ -24,7 +24,7 @@ namespace Globals else return Naam; } - public Point GetPoint() + public Point ToPoint() { return new Point(X, Y); } diff --git a/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000000000000000000000000000000000000..a7bdf91612271316a725622f87c408ecc8c7d9e7 GIT binary patch literal 424 zcmaJ-u};G<5OqjW8p6Fem7XM-$ON(p!}ZhWy@zN}?sQ=w!ku8xbSsbpLU4KJRTY77N^v(&bQ(H1o_uCcTt zFd{H2P*&z2QL0oZ4g_|EJdE15L{bgcCY7WL6$=DIs`e}Q()6F`DncREm!wNbc&96g z=A_aXQgPKRmrNea|0s2mz&$&v_@^qqWHj!|+)n{rZgn&qQ{rkoALp$Nu2%ENG2yIJ zLMb(2v*p?xj)MH&nd_Jv_Xi_NDC_6_`J*Qc!)4@=8HE2hU=Um$oI3D_yDVr3Hbp3M ztCfUmv)hZ{u{(X7E;6mvW9#R|qfK!oTs)OxBT+nf)##B!>KCX1HLgZ{YVo8*LJd=l ztBLw-q}ER*y}B|QZ>jgzOj&sTS8Jtrl()P-a}$%5q~e9CRg+UzCDjPfCcOSo$eB-J zH+N;&HEPm3J(-MYp)m?A(j}qIi>nDWLJt((Sv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clPSVuvWH6dMz1()|+})_YF4$J)*fU3ZR_xhglwt!HsnkwQ zdgHa`kc(966r`?>qy>VsTSw9&LF(y9+Dnl3?nv5KmuBO&Uq{mZg0#3JDOP_r#w(VB zmPQuVBQ{F0II&cU#c_>NtduL2VwqM=n!PQo*(#M{g-zpGvD~IqilrVkY4$}9)_sJu z{fnH!DqWg=2(jj%^sLhaDOSOgN@ojFEXgL7&KIOuB1|f+6Qo$QN-A9{NU?~LREkA> zjPZ&UeWX$>D`S*mjTxyFE1YQ3ELbdeB9&sf4dYp{_J&l7#UG4PtOOyIVif}81z<@6 zsT4EejZ#dDmr5}++js$(rY)6Xp0H7hNyAbpX095gn8qrVV%DTliYb&*DW>olrI^nr zm10VnQHuFxQYj`m8Ks!G^rFXag0*D(UD5=Ho+*xs|BePUE4+}`njc2^s^eJ=ya7z(Z^?$ zqQg%rMW2&ViVi5L6ulruDY`_YQnbm9QZ&$|QZx>YQnVDMQnXSuX*R*2$s&^${5SEC BUmO4c delta 38 ncmX@Vk7)(-27g8_83qOhP8J{`I60Ehkq^jV5MTq5K)?+Eke3A9 diff --git a/Logica/Logica.csproj b/Logica/Logica.csproj index cef4a9c..47d5b4a 100644 --- a/Logica/Logica.csproj +++ b/Logica/Logica.csproj @@ -41,7 +41,7 @@ - + diff --git a/Logica/Class1.cs b/Logica/PolygonManipulatie.cs similarity index 50% rename from Logica/Class1.cs rename to Logica/PolygonManipulatie.cs index 25a0957..5b29148 100644 --- a/Logica/Class1.cs +++ b/Logica/PolygonManipulatie.cs @@ -16,28 +16,67 @@ namespace Logica JsonReader = jsonReader; } - public List getPolygons() + public List GetPolygons() { return JsonReader._polygons; } - public List getMultiPolygons() + public List GetMultiPolygons() { return JsonReader._multiPolygons; } - public List getAllPolygons() + public PolygonPunten GetPolygonByName(string naam) + { + return JsonReader._polygons.Find(punten => punten.Naam == naam); + } + + public List GetTrianglesPolygon(PolygonPunten polygon, double scaleX + = 1, double scaleY = 1, double epsilonPercet = 0) + { + double grootsteAfstandX = Math.Abs(polygon.MaximumX - polygon.MinimumX); + double grootsteAfstandY = Math.Abs(polygon.MaximumY - polygon.MinimumY); + double epsilon = ((grootsteAfstandX + grootsteAfstandY) / 2) * epsilonPercet; + polygon.Punten = Peuker(polygon.Punten, epsilon); + polygon = ScalePolygon(polygon, scaleX, scaleY); + return TriangulatePolygon(polygon); + } + + private PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY) + { + 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; + double y = punt.Y - minY; + y /= maxY; + y *= scaleY; + returnWaarde.Add(new Punt(x, y, punt.Naam)); + + } + return new PolygonPunten(returnWaarde, polygon.Naam); + } + + public List GetAllPolygons() { List lijst = new List(); - lijst.AddRange(getPolygons()); - foreach (MultiPolygonPunten multiPolygonPunten in getMultiPolygons()) + lijst.AddRange(GetPolygons()); + foreach (MultiPolygonPunten multiPolygonPunten in GetMultiPolygons()) { lijst.AddRange(multiPolygonPunten.PolygonPunten); } return lijst; } - public List triangulatePolygon(List punten) + public List TriangulatePolygon(List punten) { List returnWaarde = new List(); int i = 0; @@ -45,7 +84,6 @@ namespace Logica int BACKBACKUP = punten.Count; while (true) { - if (i >= punten.Count) { i = 0; @@ -56,13 +94,11 @@ namespace Logica BACKBACKUP = punten.Count; } - int punt1Index = i; int punt2Index = i + 1; if (punt2Index >= punten.Count) punt2Index -= punten.Count; int punt3Index = i + 2; if (punt3Index >= punten.Count) punt3Index -= punten.Count; - if (punten.Count < 3) { break; @@ -71,20 +107,14 @@ namespace Logica if (hoek < 180) { returnWaarde.Add(MaakNieuweDriehoek(punten[punt2Index], punten[punt3Index], - punten[punt1Index])); + punten[punt1Index], punten[punt1Index].Naam)); punten.RemoveAt(punt2Index); Debug.WriteLine("added a triangle, polygonLijst count " + punten.Count); i = punt1Index; BACKUP = 0; continue; - - } Debug.WriteLine(hoek); - - - - i++; if (BACKUP >= punten.Count) { @@ -92,10 +122,61 @@ namespace Logica break; } } - return returnWaarde; } + public List TriangulatePolygon(PolygonPunten polygon) + { + List punten = polygon.Punten; + List returnWaarde = new List(); + int i = 0; + int BACKUP = 0; + int BACKBACKUP = punten.Count; + while (true) + { + if (i >= punten.Count) + { + i = 0; + if (punten.Count == BACKBACKUP) + { + BACKUP++; + } + + BACKBACKUP = punten.Count; + } + int punt1Index = i; + int punt2Index = i + 1; + if (punt2Index >= punten.Count) punt2Index -= punten.Count; + int punt3Index = i + 2; + if (punt3Index >= punten.Count) punt3Index -= punten.Count; + if (punten.Count < 3) + { + break; + } + double hoek = VindHoek(punten[punt2Index], punten[punt1Index], punten[punt3Index]); + if (hoek < 180) + { + returnWaarde.Add(MaakNieuweDriehoek(punten[punt2Index], punten[punt3Index], + punten[punt1Index], punten[punt1Index].Naam)); + punten.RemoveAt(punt2Index); + Debug.WriteLine("added a triangle, polygonLijst count " + punten.Count); + i = punt1Index; + BACKUP = 0; + continue; + } + Debug.WriteLine(hoek); + i++; + if (BACKUP >= punten.Count) + { + Debug.WriteLine("FUCK, couldnt parse " + punten.Count + " points"); + break; + } + } + return returnWaarde; + } + + + private PolygonPunten MaakNieuweDriehoek(Punt punt, Punt punt1, Punt punt2, string naam = "") { return new PolygonPunten(new List() { punt, punt1, punt2 }, naam); @@ -111,7 +192,7 @@ namespace Logica return hoek; } - private List peuker(List punten, double epsilon) + private List Peuker(List punten, double epsilon) { double dmax = -1; int index = 0; @@ -132,8 +213,8 @@ namespace Logica if (dmax > epsilon) { - List recResults1 = peuker(punten.GetRange(0, index), epsilon); - List recResults2 = peuker(punten.GetRange(index, end - 1 - index), epsilon); + List recResults1 = Peuker(punten.GetRange(0, index), epsilon); + List recResults2 = Peuker(punten.GetRange(index, end - 1 - index), epsilon); returnWaarde.AddRange(recResults1); diff --git a/Logica/obj/Debug/Logica.csprojAssemblyReference.cache b/Logica/obj/Debug/Logica.csprojAssemblyReference.cache index 24df8ab71c7fe300bafe3814e087f18338735c85..8b2ee1980e62de6fe0bf62bf57ba140bfa6ea1db 100644 GIT binary patch delta 13 UcmZ3%yn=ayKO>{s{a - + @@ -17,6 +17,10 @@ + +