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;
|
Naam = naam;
|
||||||
Punten = new List<Punt>();
|
Punten = new List<Punt>();
|
||||||
MaximumX = double.MinValue;
|
|
||||||
MaximumY = double.MinValue;
|
|
||||||
MinimumX = double.MaxValue;
|
|
||||||
MinimumY = double.MaxValue;
|
|
||||||
foreach (LineString l in p.Coordinates)
|
foreach (LineString l in p.Coordinates)
|
||||||
{
|
{
|
||||||
foreach (Position pos in l.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.Add(new Punt(pos.Longitude, pos.Latitude, naam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Punten.Reverse();
|
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()
|
public override string ToString()
|
||||||
|
@@ -14,8 +14,8 @@ namespace Globals
|
|||||||
public Punt(double x, double y, string naam = "")
|
public Punt(double x, double y, string naam = "")
|
||||||
{
|
{
|
||||||
Naam = naam;
|
Naam = naam;
|
||||||
X = x;
|
X = ConvertToRadians(x);
|
||||||
Y = y;
|
Y = ConvertToRadians(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
@@ -23,7 +23,12 @@ namespace Globals
|
|||||||
if (string.Equals(Naam, "", StringComparison.Ordinal)) return "UNKNOWN";
|
if (string.Equals(Naam, "", StringComparison.Ordinal)) return "UNKNOWN";
|
||||||
else return Naam;
|
else return Naam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double ConvertToRadians(double angle)
|
||||||
|
{
|
||||||
|
return (Math.PI / 180) * angle;
|
||||||
|
}
|
||||||
|
|
||||||
public Point ToPoint()
|
public Point ToPoint()
|
||||||
{
|
{
|
||||||
return new Point(X, Y);
|
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);
|
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 maxX = polygon.MaximumX;
|
||||||
double maxY = polygon.MaximumY;
|
double maxY = polygon.MaximumY;
|
||||||
double minX = polygon.MinimumX;
|
double minX = polygon.MinimumX;
|
||||||
double minY = polygon.MinimumY;
|
double minY = polygon.MinimumY;
|
||||||
maxX -= minX;
|
|
||||||
maxY -= minY;
|
|
||||||
List<Punt> returnWaarde = new List<Punt>();
|
List<Punt> returnWaarde = new List<Punt>();
|
||||||
foreach (Punt punt in polygon.Punten)
|
foreach (Punt punt in polygon.Punten)
|
||||||
{
|
{
|
||||||
double x = punt.X - minX;
|
Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY);
|
||||||
x /= maxX;
|
x.Naam = punt.Naam;
|
||||||
x *= scaleX;
|
returnWaarde.Add(x);
|
||||||
x += offsetX;
|
|
||||||
double y = punt.Y - minY;
|
|
||||||
y /= maxY;
|
|
||||||
y *= scaleY;
|
|
||||||
y += offsetY;
|
|
||||||
returnWaarde.Add(new Punt(x, y, punt.Naam));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return new PolygonPunten(returnWaarde, polygon.Naam);
|
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)
|
public MultiPolygonPunten ScaleMultiPolygon(MultiPolygonPunten multiPolygon, double scaleX, double scaleY, double offsetX = 0, double offsetY = 0)
|
||||||
{
|
{
|
||||||
double maxX = multiPolygon.MaximumX;
|
double maxX = multiPolygon.MaximumX;
|
||||||
@@ -82,6 +88,7 @@ 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)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
double x = punt.X - minX;
|
double x = punt.X - minX;
|
||||||
x /= maxX;
|
x /= maxX;
|
||||||
x *= scaleX;
|
x *= scaleX;
|
||||||
@@ -90,7 +97,11 @@ namespace Logica
|
|||||||
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));*/
|
||||||
|
|
||||||
|
Punt x = ScalePoint(scaleX, scaleY,punt, maxX, maxY, offsetX, offsetY);
|
||||||
|
x.Naam = punt.Naam;
|
||||||
|
returnWaarde.Add(x);
|
||||||
|
|
||||||
}
|
}
|
||||||
pp.Add(new PolygonPunten(returnWaarde, polygon.Naam));
|
pp.Add(new PolygonPunten(returnWaarde, polygon.Naam));
|
||||||
@@ -115,8 +126,11 @@ namespace Logica
|
|||||||
List<Punt> punten = new List<Punt>();
|
List<Punt> punten = new List<Punt>();
|
||||||
foreach (Punt punt in poly.Punten)
|
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 /= maxX;
|
||||||
x *= scaleX;
|
x *= scaleX;
|
||||||
x += offsetX;
|
x += offsetX;
|
||||||
@@ -124,7 +138,7 @@ namespace Logica
|
|||||||
y /= maxY;
|
y /= maxY;
|
||||||
y *= scaleY;
|
y *= scaleY;
|
||||||
y += offsetY;
|
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));
|
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": {
|
"projects": {
|
||||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj": {
|
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj",
|
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Datalaag\\Datalaag.csproj",
|
||||||
"projectName": "Datalaag",
|
"projectName": "Datalaag",
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj": {
|
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj",
|
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Globals\\Globals.csproj",
|
||||||
"projectName": "Globals",
|
"projectName": "Globals",
|
||||||
@@ -34,6 +36,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj": {
|
"C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj",
|
"projectUniqueName": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\Logica\\Logica.csproj",
|
||||||
"projectName": "Logica",
|
"projectName": "Logica",
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Beppe\.nuget\packages\</NuGetPackageFolders>
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Beppe\.nuget\packages\</NuGetPackageFolders>
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.6.0</NuGetToolVersion>
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.5.0</NuGetToolVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "Zy6jypDVLiSwLfNswZHvoD7ul/+NOG2AgIE/eLzWMMgAaQ+TzAjn3Or2nqa6RpIYT9zQrkp/4+yCHo1D0FoSMQ==",
|
"dgSpecHash": "p426YNxR+un7rXUpsV3S3g0htKyuFPUxB5pYHNl1fsHxje10LlIJDBLjupJb2IZCMEZ+Cv3TXWBEUMbbMYO5hA==",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\opdracht2\\opdracht2.csproj",
|
"projectFilePath": "C:\\Users\\Beppe\\source\\repos\\opdracht2\\opdracht2\\opdracht2.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
|
Reference in New Issue
Block a user