diff --git a/opdracht2/GeoJsonParser.cs b/opdracht2/GeoJsonParser.cs index bc5bf03..de86386 100644 --- a/opdracht2/GeoJsonParser.cs +++ b/opdracht2/GeoJsonParser.cs @@ -100,6 +100,7 @@ namespace opdracht2 polygonLijst[punt3Index])); break; } + // TODO HIER MOET DE FOUT ZITTEN, KAN NIE ANDERS!!!! double hoek = GetAngle(polygonLijst[punt1Index], polygonLijst[punt2Index], polygonLijst[punt3Index]); if (hoek < 180) { @@ -192,8 +193,6 @@ namespace opdracht2 }*/ } - maximumXWaarde -= minimumXWaarde; - maximumYWaarde -= minimumYWaarde; return polygonAlsPuntenLijst; } @@ -253,8 +252,9 @@ namespace opdracht2 { if (i >= normalizedPoly.Count) i -= normalizedPoly.Count; returnWaarde.Add(normalizedPoly[i]); + i++; - } while (i != check); + } while (normalizedPoly.Count != returnWaarde.Count); return returnWaarde; } @@ -262,6 +262,8 @@ namespace opdracht2 //TODO refactor dit zodat het alle polygons normalized aan het einde van de formule. private static List NormalizePolygon(List polygons) { + maximumXWaarde -= minimumXWaarde; + maximumYWaarde -= minimumYWaarde; //mss deze fn hermaken zodat deze ook ramer douglas peucker List returnWaarde = new List(); foreach (System.Windows.Shapes.Polygon p in polygons) @@ -271,15 +273,13 @@ namespace opdracht2 { double x = (punt.X - minimumXWaarde); x = (x / maximumXWaarde); - x = (x * 200); + x = (x * schaalXWaarde); double y = (punt.Y - minimumYWaarde); y = (y / maximumYWaarde); - y = (y * 200); + y = (y * schaalYWaarde); puntCollectie.Add(new Point(x, y)); } - Polygon pol = new Polygon(); - pol.Points = puntCollectie; - returnWaarde.Add(pol); + returnWaarde.Add(CreateNewPolygon(puntCollectie[0], puntCollectie[1], puntCollectie[2])); } //List iets = DP(returnWaarde); return returnWaarde; diff --git a/opdracht2/MainWindow.xaml b/opdracht2/MainWindow.xaml index eb255e6..7d0905b 100644 --- a/opdracht2/MainWindow.xaml +++ b/opdracht2/MainWindow.xaml @@ -9,7 +9,7 @@ - + diff --git a/opdracht2/MainWindow.xaml.cs b/opdracht2/MainWindow.xaml.cs index 87680a5..d9ce228 100644 --- a/opdracht2/MainWindow.xaml.cs +++ b/opdracht2/MainWindow.xaml.cs @@ -43,7 +43,7 @@ namespace opdracht2 { //TODO remove //Tuple, List> t = GeoJsonParser.TriangulateJsonData(File.ReadAllText(openFileDialog.FileName), c.Width, c.Height); - f = GeoJsonParser.TriangulateJsonData(File.ReadAllText(openFileDialog.FileName), c.Width, c.Height); + f = GeoJsonParser.TriangulateJsonData(File.ReadAllText(openFileDialog.FileName), 800, 800); el = new List(); } var st = new ScaleTransform(); @@ -54,11 +54,7 @@ namespace opdracht2 } c.MouseWheel += (sender, e) => { - if (f.Count > 0) - { - buffer.Add(f[0]); - f.RemoveAt(0); - } + if (e.Delta > 0) { st.ScaleX *= 2; @@ -78,9 +74,13 @@ namespace opdracht2 { if (f.Count > 0) { + Debug.WriteLine("--- ADDING NEW POLYGON FROM LIST (COUNT: " + f.Count + ")"); + Debug.WriteLine(f[0].ToString()); c.Children.Add(f[0]); + Debug.WriteLine(("ADDED POLYGON")); f.RemoveAt(0); - Thread.Sleep(50); + Debug.WriteLine(("REMOVED POLYGON")); + Thread.Sleep(80); } } diff --git a/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.dll b/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.dll index ae5fed2..94a5658 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.dll and b/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.dll differ diff --git a/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.pdb b/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.pdb index 3b4ccba..4234adc 100644 Binary files a/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.pdb and b/opdracht2/bin/Debug/netcoreapp3.1/opdracht2.pdb differ diff --git a/opdracht2/obj/Debug/netcoreapp3.1/MainWindow.g.cs b/opdracht2/obj/Debug/netcoreapp3.1/MainWindow.g.cs index dc07c71..5572bee 100644 --- a/opdracht2/obj/Debug/netcoreapp3.1/MainWindow.g.cs +++ b/opdracht2/obj/Debug/netcoreapp3.1/MainWindow.g.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3A443E7ED9F57FEF7727DBB7F494EFF32BD95ECA" +#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6DEC4786911BE0BC61F1D6B9699E8EC0FFFE5DFE" //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.dll b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.dll index ae5fed2..94a5658 100644 Binary files a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.dll and b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.dll differ diff --git a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.g.resources b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.g.resources index fb94220..4bdd5c0 100644 Binary files a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.g.resources and b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.g.resources differ diff --git a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.pdb b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.pdb index 3b4ccba..4234adc 100644 Binary files a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.pdb and b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2.pdb differ diff --git a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2_MarkupCompile.cache b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2_MarkupCompile.cache index 4e2a083..a7c5bcc 100644 --- a/opdracht2/obj/Debug/netcoreapp3.1/opdracht2_MarkupCompile.cache +++ b/opdracht2/obj/Debug/netcoreapp3.1/opdracht2_MarkupCompile.cache @@ -10,11 +10,11 @@ none false TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1 C:\Users\Beppe\source\repos\opdracht2\opdracht2\App.xaml -1-1315075995 +1-673581283 -41252897694 -195-1941964533 +4543106357 +195-2120402724 MainWindow.xaml; -True +False