ok, refactor gedaan, fout wss gevonden

This commit is contained in:
BuildTools
2020-07-21 01:51:04 +02:00
parent dce5a885c3
commit 9073d73f7f
10 changed files with 21 additions and 21 deletions

View File

@@ -100,6 +100,7 @@ namespace opdracht2
polygonLijst[punt3Index])); polygonLijst[punt3Index]));
break; break;
} }
// TODO HIER MOET DE FOUT ZITTEN, KAN NIE ANDERS!!!!
double hoek = GetAngle(polygonLijst[punt1Index], polygonLijst[punt2Index], polygonLijst[punt3Index]); double hoek = GetAngle(polygonLijst[punt1Index], polygonLijst[punt2Index], polygonLijst[punt3Index]);
if (hoek < 180) if (hoek < 180)
{ {
@@ -192,8 +193,6 @@ namespace opdracht2
}*/ }*/
} }
maximumXWaarde -= minimumXWaarde;
maximumYWaarde -= minimumYWaarde;
return polygonAlsPuntenLijst; return polygonAlsPuntenLijst;
} }
@@ -253,8 +252,9 @@ namespace opdracht2
{ {
if (i >= normalizedPoly.Count) i -= normalizedPoly.Count; if (i >= normalizedPoly.Count) i -= normalizedPoly.Count;
returnWaarde.Add(normalizedPoly[i]); returnWaarde.Add(normalizedPoly[i]);
i++; i++;
} while (i != check); } while (normalizedPoly.Count != returnWaarde.Count);
return returnWaarde; return returnWaarde;
} }
@@ -262,6 +262,8 @@ namespace opdracht2
//TODO refactor dit zodat het alle polygons normalized aan het einde van de formule. //TODO refactor dit zodat het alle polygons normalized aan het einde van de formule.
private static List<System.Windows.Shapes.Polygon> NormalizePolygon(List<System.Windows.Shapes.Polygon> polygons) private static List<System.Windows.Shapes.Polygon> NormalizePolygon(List<System.Windows.Shapes.Polygon> polygons)
{ {
maximumXWaarde -= minimumXWaarde;
maximumYWaarde -= minimumYWaarde;
//mss deze fn hermaken zodat deze ook ramer douglas peucker //mss deze fn hermaken zodat deze ook ramer douglas peucker
List<System.Windows.Shapes.Polygon> returnWaarde = new List<System.Windows.Shapes.Polygon>(); List<System.Windows.Shapes.Polygon> returnWaarde = new List<System.Windows.Shapes.Polygon>();
foreach (System.Windows.Shapes.Polygon p in polygons) foreach (System.Windows.Shapes.Polygon p in polygons)
@@ -271,15 +273,13 @@ namespace opdracht2
{ {
double x = (punt.X - minimumXWaarde); double x = (punt.X - minimumXWaarde);
x = (x / maximumXWaarde); x = (x / maximumXWaarde);
x = (x * 200); x = (x * schaalXWaarde);
double y = (punt.Y - minimumYWaarde); double y = (punt.Y - minimumYWaarde);
y = (y / maximumYWaarde); y = (y / maximumYWaarde);
y = (y * 200); y = (y * schaalYWaarde);
puntCollectie.Add(new Point(x, y)); puntCollectie.Add(new Point(x, y));
} }
Polygon pol = new Polygon(); returnWaarde.Add(CreateNewPolygon(puntCollectie[0], puntCollectie[1], puntCollectie[2]));
pol.Points = puntCollectie;
returnWaarde.Add(pol);
} }
//List<Point> iets = DP(returnWaarde); //List<Point> iets = DP(returnWaarde);
return returnWaarde; return returnWaarde;

View File

@@ -9,7 +9,7 @@
<Grid> <Grid>
<Button HorizontalAlignment="Left" Margin="52,34,0,0" VerticalAlignment="Top" RenderTransformOrigin="1.215,0.64" Click="Button_Click" Height="25" Width="55"> <Button HorizontalAlignment="Left" Margin="52,34,0,0" VerticalAlignment="Top" RenderTransformOrigin="1.215,0.64" Click="Button_Click" Height="25" Width="55">
</Button> </Button>
<Canvas x:Name="someCanvas" Margin="165,61,119,60"/> <Canvas x:Name="someCanvas" Height="1080" Width="1920"/>
</Grid> </Grid>
</Window> </Window>

View File

@@ -43,7 +43,7 @@ namespace opdracht2
{ {
//TODO remove //TODO remove
//Tuple<List<Polygon>, List<Ellipse>> t = GeoJsonParser.TriangulateJsonData(File.ReadAllText(openFileDialog.FileName), c.Width, c.Height); //Tuple<List<Polygon>, List<Ellipse>> 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<Ellipse>(); el = new List<Ellipse>();
} }
var st = new ScaleTransform(); var st = new ScaleTransform();
@@ -54,11 +54,7 @@ namespace opdracht2
} }
c.MouseWheel += (sender, e) => c.MouseWheel += (sender, e) =>
{ {
if (f.Count > 0)
{
buffer.Add(f[0]);
f.RemoveAt(0);
}
if (e.Delta > 0) if (e.Delta > 0)
{ {
st.ScaleX *= 2; st.ScaleX *= 2;
@@ -78,9 +74,13 @@ namespace opdracht2
{ {
if (f.Count > 0) if (f.Count > 0)
{ {
Debug.WriteLine("--- ADDING NEW POLYGON FROM LIST (COUNT: " + f.Count + ")");
Debug.WriteLine(f[0].ToString());
c.Children.Add(f[0]); c.Children.Add(f[0]);
Debug.WriteLine(("ADDED POLYGON"));
f.RemoveAt(0); f.RemoveAt(0);
Thread.Sleep(50); Debug.WriteLine(("REMOVED POLYGON"));
Thread.Sleep(80);
} }
} }

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3A443E7ED9F57FEF7727DBB7F494EFF32BD95ECA" #pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6DEC4786911BE0BC61F1D6B9699E8EC0FFFE5DFE"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.

View File

@@ -10,11 +10,11 @@ none
false false
TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1 TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1
C:\Users\Beppe\source\repos\opdracht2\opdracht2\App.xaml C:\Users\Beppe\source\repos\opdracht2\opdracht2\App.xaml
1-1315075995 1-673581283
41252897694 4543106357
195-1941964533 195-2120402724
MainWindow.xaml; MainWindow.xaml;
True False