diff --git a/.vs/opdracht2/v16/.suo b/.vs/opdracht2/v16/.suo index 77d43ad..625e69d 100644 Binary files a/.vs/opdracht2/v16/.suo and b/.vs/opdracht2/v16/.suo differ diff --git a/Globals/PolygonPunten.cs b/Globals/PolygonPunten.cs index 20ab643..c68ff8a 100644 --- a/Globals/PolygonPunten.cs +++ b/Globals/PolygonPunten.cs @@ -49,6 +49,11 @@ namespace Globals if (string.Equals(Naam, "", StringComparison.Ordinal)) return "UNKNOWN"; else return Naam; } + + public MultiPolygonPunten ToMultiPolygonPunten() + { + return new MultiPolygonPunten(new List() { this }, this.Naam); + } } } diff --git a/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache index a8085e8..a8ec8df 100644 Binary files a/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Globals/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Logica/PolygonManipulatie.cs b/Logica/PolygonManipulatie.cs index 7f70a98..0f9d322 100644 --- a/Logica/PolygonManipulatie.cs +++ b/Logica/PolygonManipulatie.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Text; using Datalaag; using Globals; @@ -94,6 +95,37 @@ namespace Logica return new MultiPolygonPunten(pp, multiPolygon.Naam); } + public List ScaleMultiPolygons(List multiPolygons, double scaleX, double scaleY) + { + double maxX = multiPolygons.Max(m => m.MaximumX); + double maxY = multiPolygons.Max(m => m.MaximumY); + double minX = multiPolygons.Min(m => m.MinimumX); + double minY = multiPolygons.Min(m => m.MinimumY); + List mpps = new List(); + foreach (MultiPolygonPunten mp in multiPolygons) + { + List pp = new List(); + foreach (PolygonPunten poly in mp.PolygonPunten) + { + List punten = new List(); + foreach (Punt punt in poly.Punten) + { + + double x = punt.X - minX; + x /= maxX; + x *= scaleX; + double y = punt.Y - minY; + y /= maxY; + y *= scaleY; + punten.Add(new Punt(x, y, punt.Naam)); + } + pp.Add(new PolygonPunten(punten, poly.Naam)); + } + mpps.Add(new MultiPolygonPunten(pp, mp.Naam)); + } + return mpps; + + } public List GetAllPolygons() { List lijst = new List(); diff --git a/opdracht2/MainWindow.xaml b/opdracht2/MainWindow.xaml index 56ce69b..21c5c38 100644 --- a/opdracht2/MainWindow.xaml +++ b/opdracht2/MainWindow.xaml @@ -21,6 +21,7 @@