khaat dees

This commit is contained in:
BuildTools
2020-08-01 16:33:08 +02:00
parent ee06557675
commit e6de36e7bb
14 changed files with 22 additions and 22 deletions

Binary file not shown.

View File

@@ -51,19 +51,19 @@ namespace Logica
List<Punt> returnWaarde = new List<Punt>(); List<Punt> returnWaarde = new List<Punt>();
foreach (Punt punt in polygon.Punten) foreach (Punt punt in polygon.Punten)
{ {
//Punt x = ScalePoint(scaleX, scaleY, punt, maxX, maxY, offsetX, offsetY); Punt x = ScalePoint(scaleX, scaleY, punt, maxX, maxY, offsetX, offsetY);
double x = punt.X - minX; //double x = punt.X - minX;
x /= maxX; //x /= maxX;
x *= scaleX; //x *= scaleX;
x += offsetX; //x += offsetX;
double y = punt.Y - minY; //double y = punt.Y - minY;
y /= maxY; //y /= maxY;
y *= scaleY; //y *= scaleY;
y += offsetY; //y += offsetY;
returnWaarde.Add(new Punt(x, y, punt.Naam)); //returnWaarde.Add(new Punt(x, y, punt.Naam));
//x.Naam = punt.Naam; x.Naam = punt.Naam;
//returnWaarde.Add(x); returnWaarde.Add(x);
} }
return new PolygonPunten(returnWaarde, polygon.Naam); return new PolygonPunten(returnWaarde, polygon.Naam);
} }
@@ -72,14 +72,14 @@ namespace Logica
private static Punt ScalePoint(double scaleX, double scaleY, Punt punt, double maxX = 360, double maxY = 360, double offsetX = 180, double private static Punt ScalePoint(double scaleX, double scaleY, Punt punt, double maxX = 360, double maxY = 360, double offsetX = 180, double
offsetY = 180) offsetY = 180)
{ {
double x = punt.X; double x = punt.X + 1;
x /= maxX; //x /= maxX;
x *= scaleX; x *= (scaleX / 2);
x += offsetX; //x += offsetX;
double y = punt.Y; double y = punt.Y;
y /= maxY; //y /= maxY;
y *= scaleY; y *= (scaleY / 2);
y += offsetY; //y += offsetY;
return new Punt(x, y); return new Punt(x, y);
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -174,7 +174,7 @@ namespace opdracht2
} }
} }
//peuker implementatie moet ook nog gebeuren, code is er al, maar wanneer moet deze aangeroepen worden //peuker implementatie moet ook nog gebeuren, code is er al, maar wanneer moet deze aangeroepen worden
if (scale.IsChecked == true) mpps = pm.ScaleMultiPolygons(mpps, c.Width/2, c.Height/2, c.Width/2, c.Height/2); if (scale.IsChecked == true) mpps = pm.ScaleMultiPolygons(mpps, c.ActualWidth / 2, c.ActualHeight / 2, c.ActualWidth / 2, c.ActualHeight / 2);
foreach(MultiPolygonPunten mp in mpps) foreach(MultiPolygonPunten mp in mpps)
{ {
@@ -208,7 +208,7 @@ namespace opdracht2
Debug.WriteLine(lb.SelectedItem.GetType().Name); Debug.WriteLine(lb.SelectedItem.GetType().Name);
c.Children.Clear(); c.Children.Clear();
MultiPolygonPunten mp = (MultiPolygonPunten)lb.SelectedItem; MultiPolygonPunten mp = (MultiPolygonPunten)lb.SelectedItem;
if (scale.IsChecked == true) mp = pm.ScaleMultiPolygon(mp, 100, 100, 0, 0); if (scale.IsChecked == true) mp = pm.ScaleMultiPolygon(mp, c.ActualWidth / 2, c.ActualHeight / 2, c.ActualWidth / 2, c.Height / 2);
if (peuker.IsChecked == true) mp = pm.Peuker(mp, peukerPercent.Value/1000); if (peuker.IsChecked == true) mp = pm.Peuker(mp, peukerPercent.Value/1000);
//hier ervoor zorgen dat scaling, triangulation etc gebeurt door gebruik van logica layer functies te callen //hier ervoor zorgen dat scaling, triangulation etc gebeurt door gebruik van logica layer functies te callen
foreach (PolygonPunten pp in mp.PolygonPunten) foreach (PolygonPunten pp in mp.PolygonPunten)
@@ -231,7 +231,7 @@ namespace opdracht2
Debug.WriteLine(lb.SelectedItem.GetType().Name); Debug.WriteLine(lb.SelectedItem.GetType().Name);
c.Children.Clear(); c.Children.Clear();
PolygonPunten p = (PolygonPunten)lb.SelectedItem; PolygonPunten p = (PolygonPunten)lb.SelectedItem;
if (scale.IsChecked == true) p = pm.ScalePolygon(p, 10000, 10000, 0, 0); if (scale.IsChecked == true) p = pm.ScalePolygon(p, c.ActualWidth / 2 * 100, c.ActualHeight / 2 * 100, c.ActualWidth / 2 * 100, c.ActualHeight / 2 * 100);
if (peuker.IsChecked == true) p = pm.Peuker(p, peukerPercent.Value / 1000); if (peuker.IsChecked == true) p = pm.Peuker(p, peukerPercent.Value / 1000);
if (triangulate.IsChecked == true) if (triangulate.IsChecked == true)
{ {