mirror of
https://github.com/bvanroll/cs-map-project.git
synced 2025-08-29 11:52:44 +00:00
ik ben braindead. long en lat zijn graden fml
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,22 +27,18 @@ namespace Globals
|
||||
{
|
||||
Naam = naam;
|
||||
Punten = new List<Punt>();
|
||||
MaximumX = double.MinValue;
|
||||
MaximumY = double.MinValue;
|
||||
MinimumX = double.MaxValue;
|
||||
MinimumY = double.MaxValue;
|
||||
foreach (LineString l in p.Coordinates)
|
||||
{
|
||||
foreach (Position pos in l.Coordinates)
|
||||
{
|
||||
if (pos.Longitude > MaximumX) MaximumX = pos.Longitude;
|
||||
if (pos.Longitude < MinimumX) MinimumX = pos.Longitude;
|
||||
if (pos.Latitude > MaximumY) MaximumY = pos.Latitude;
|
||||
if (pos.Latitude < MinimumY) MinimumY = pos.Latitude;
|
||||
Punten.Add(new Punt(pos.Longitude, pos.Latitude, naam));
|
||||
}
|
||||
}
|
||||
Punten.Reverse();
|
||||
MaximumX = Punten.Max(punt => punt.X);
|
||||
MaximumY = Punten.Max(punt => punt.Y);
|
||||
MinimumX = Punten.Min(punt => punt.X);
|
||||
MinimumY = Punten.Min(punt => punt.Y);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -14,8 +14,8 @@ namespace Globals
|
||||
public Punt(double x, double y, string naam = "")
|
||||
{
|
||||
Naam = naam;
|
||||
X = x;
|
||||
Y = y;
|
||||
X = ConvertToRadians(x);
|
||||
Y = ConvertToRadians(y);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -24,6 +24,11 @@ namespace Globals
|
||||
else return Naam;
|
||||
}
|
||||
|
||||
public double ConvertToRadians(double angle)
|
||||
{
|
||||
return (Math.PI / 180) * angle;
|
||||
}
|
||||
|
||||
public Point ToPoint()
|
||||
{
|
||||
return new Point(X, Y);
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -43,31 +43,37 @@ namespace Logica
|
||||
return TriangulatePolygon(polygon);
|
||||
}
|
||||
|
||||
public PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY, double offsetX = 0, double offsetY = 0)
|
||||
public PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY, double offsetX = 180, double offsetY = 180)
|
||||
{
|
||||
double maxX = polygon.MaximumX;
|
||||
double maxY = polygon.MaximumY;
|
||||
double minX = polygon.MinimumX;
|
||||
double minY = polygon.MinimumY;
|
||||
maxX -= minX;
|
||||
maxY -= minY;
|
||||
List<Punt> returnWaarde = new List<Punt>();
|
||||
foreach (Punt punt in polygon.Punten)
|
||||
{
|
||||
double x = punt.X - minX;
|
||||
x /= maxX;
|
||||
x *= scaleX;
|
||||
x += offsetX;
|
||||
double y = punt.Y - minY;
|
||||
y /= maxY;
|
||||
y *= scaleY;
|
||||
y += offsetY;
|
||||
returnWaarde.Add(new Punt(x, y, punt.Naam));
|
||||
|
||||
Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY);
|
||||
x.Naam = punt.Naam;
|
||||
returnWaarde.Add(x);
|
||||
}
|
||||
return new PolygonPunten(returnWaarde, polygon.Naam);
|
||||
}
|
||||
|
||||
//lat en long = graden, graden => coords (/360 * scale?
|
||||
private static Punt ScalePoint(double scaleX, double scaleY, Punt punt, double maxX = 360, double maxY = 360, double offsetX = 180, double
|
||||
offsetY = 180)
|
||||
{
|
||||
double x = punt.X;
|
||||
x /= maxX;
|
||||
x *= scaleX;
|
||||
x += offsetX;
|
||||
double y = punt.Y;
|
||||
y /= maxY;
|
||||
y *= scaleY;
|
||||
y += offsetY;
|
||||
return new Punt(x, y);
|
||||
}
|
||||
|
||||
public MultiPolygonPunten ScaleMultiPolygon(MultiPolygonPunten multiPolygon, double scaleX, double scaleY, double offsetX = 0, double offsetY = 0)
|
||||
{
|
||||
double maxX = multiPolygon.MaximumX;
|
||||
@@ -82,6 +88,7 @@ namespace Logica
|
||||
List<Punt> returnWaarde = new List<Punt>();
|
||||
foreach (Punt punt in polygon.Punten)
|
||||
{
|
||||
/*
|
||||
double x = punt.X - minX;
|
||||
x /= maxX;
|
||||
x *= scaleX;
|
||||
@@ -90,7 +97,11 @@ namespace Logica
|
||||
y /= maxY;
|
||||
y *= scaleY;
|
||||
y += offsetY;
|
||||
returnWaarde.Add(new Punt(x, y, punt.Naam));
|
||||
returnWaarde.Add(new Punt(x, y, punt.Naam));*/
|
||||
|
||||
Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY);
|
||||
x.Naam = punt.Naam;
|
||||
returnWaarde.Add(x);
|
||||
|
||||
}
|
||||
pp.Add(new PolygonPunten(returnWaarde, polygon.Naam));
|
||||
@@ -116,7 +127,10 @@ namespace Logica
|
||||
foreach (Punt punt in poly.Punten)
|
||||
{
|
||||
|
||||
double x = punt.X - minX;
|
||||
Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY);
|
||||
x.Naam = punt.Naam;
|
||||
punten.Add(x);
|
||||
/*double x = punt.X - minX;
|
||||
x /= maxX;
|
||||
x *= scaleX;
|
||||
x += offsetX;
|
||||
@@ -124,7 +138,7 @@ namespace Logica
|
||||
y /= maxY;
|
||||
y *= scaleY;
|
||||
y += offsetY;
|
||||
punten.Add(new Punt(x, y, punt.Naam));
|
||||
punten.Add(new Punt(x, y, punt.Naam));*/
|
||||
}
|
||||
pp.Add(new PolygonPunten(punten, poly.Naam));
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj",
|
||||
"projectName": "Datalaag",
|
||||
@@ -24,6 +25,7 @@
|
||||
}
|
||||
},
|
||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj",
|
||||
"projectName": "Globals",
|
||||
@@ -34,6 +36,7 @@
|
||||
}
|
||||
},
|
||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj",
|
||||
"projectName": "Logica",
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Beppe\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.6.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.5.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "Zy6jypDVLiSwLfNswZHvoD7ul/+NOG2AgIE/eLzWMMgAaQ+TzAjn3Or2nqa6RpIYT9zQrkp/4+yCHo1D0FoSMQ==",
|
||||
"dgSpecHash": "p426YNxR+un7rXUpsV3S3g0htKyuFPUxB5pYHNl1fsHxje10LlIJDBLjupJb2IZCMEZ+Cv3TXWBEUMbbMYO5hA==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\opdracht2\\opdracht2.csproj",
|
||||
"expectedPackageFiles": [
|
||||
|
Reference in New Issue
Block a user