Skip to content

Commit

Permalink
Merge pull request #133 from Nikolai558/development
Browse files Browse the repository at this point in the history
Releasing 2.6.0
  • Loading branch information
Nikolai558 authored Feb 22, 2023
2 parents 75df6d1 + bb8e7fd commit deefc5f
Show file tree
Hide file tree
Showing 25 changed files with 1,065 additions and 166 deletions.
18 changes: 18 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# CHANGELOG

---
- ## Version 2.6.0
- Added feature: CRC AIRAC Data Geojsons
- The output for this feature will be located in
FE-BUDDY_Output -> CRC with the following data:
- APT Symbols and Text
- ARTCC Boundaries (High and Low) Lines
- AWY High Lines, Symbols, and Text
- AWY Low Lines, Symbols, and Text
- FIX Symbols and Text
- NDB Symbols and Text
- VOR Symbols and Text
- RUNWAY Lines
- WX STATIONS Symbols and Text
- DPs Lines
- STARs Lines
- NOTE: AWY Symbols are the only files that have Overriding
Properties in the geojson.

- ## Version 2.5.0
- Added feature: SCT2 to GeoJson
- Data from the following headers will be included
Expand Down
7 changes: 7 additions & 0 deletions DEL_FEB_FLDRS.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off

cd /d "%userprofile%/Desktop"

ECHO DELETED:

FOR /D %%X IN (*FE-BUDDY_Output*) DO RMDIR /S /Q "%%~fX" && ECHO - "%%~fX"
89 changes: 13 additions & 76 deletions FeBuddyLibrary/DataAccess/GeoJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void WriteSidStarGeo(string dirPath, List<SctSidStarModel> sctSidSection
endLon = LatLonHelpers.CorrectIlleagleLon(double.Parse(LatLonHelpers.CreateDecFormat(lineSeg.EndLon, false)));

bool crossesAM = false;
var coords = CheckAMCrossing(startLat, startLon, endLat, endLon);
var coords = LatLonHelpers.CheckAMCrossing(startLat, startLon, endLat, endLon);
if (coords.Count() == 4)
{
crossesAM = true;
Expand Down Expand Up @@ -278,7 +278,7 @@ private void WriteSidStarGeo(string dirPath, List<SctSidStarModel> sctSidSection
}
if (geojson.features.Count() >= 1)
{
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(outputFile, json);
}

Expand Down Expand Up @@ -340,7 +340,7 @@ private void WriteRegionGeo(string dirPath, List<SctRegionModel> sctRegionsSecti

if (geojson.features.Count() >= 1)
{
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(outputFile, json);
}
}
Expand Down Expand Up @@ -374,7 +374,7 @@ private void WriteLabelsGeo(string dirPath, List<SctLabelModel> labelModels, str

if (geojson.features.Count() >= 1)
{
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(outputFile, json);
}
}
Expand All @@ -401,7 +401,7 @@ private void WriteArtccGeo<T>(string dirPath, List<T> artccModel, string fileNam
double EndLon = LatLonHelpers.CorrectIlleagleLon(double.Parse(LatLonHelpers.CreateDecFormat(model.EndLon, false)));

bool crossesAM = false;
var coords = CheckAMCrossing(startLat, startLon, EndLat, EndLon);
var coords = LatLonHelpers.CheckAMCrossing(startLat, startLon, EndLat, EndLon);
if (coords.Count() == 4)
{
crossesAM = true;
Expand Down Expand Up @@ -461,7 +461,7 @@ private void WriteArtccGeo<T>(string dirPath, List<T> artccModel, string fileNam

if (geojson.features.Count() >= 1)
{
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string json = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(outputFile, json);
}
}
Expand Down Expand Up @@ -559,7 +559,7 @@ public void WriteVideoMapGeoJson(string dirPath, VideoMaps videoMaps, string vid

geojson.features.AddRange(allFeatures);

string jsonString = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string jsonString = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(file.FullName, jsonString);
}
}
Expand Down Expand Up @@ -723,7 +723,7 @@ private List<Feature> CreateAsdexVideoMap(List<vmElement> vmElements, Dictionary
// }

// asdexOtherFeatureCollection.features.AddRange(otherFeatures);
// string jsonString = JsonConvert.SerializeObject(asdexOtherFeatureCollection, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
// string jsonString = JsonConvert.SerializeObject(asdexOtherFeatureCollection, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });
// string fullFilePath = fileName.Split('.')[0] + "-OtherFeatures.geojson";
// File.WriteAllText(fullFilePath, jsonString);
//}
Expand All @@ -750,7 +750,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
}

bool crossesAM = false;
var coords = CheckAMCrossing(item.StartLat, item.StartLon, item.EndLat, item.EndLon);
var coords = LatLonHelpers.CheckAMCrossing(item.StartLat, item.StartLon, item.EndLat, item.EndLon);
if (coords.Count() == 4)
{
crossesAM = true;
Expand Down Expand Up @@ -876,70 +876,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
return allFeatures;
}

private List<dynamic> CheckAMCrossing(double startLat, double startLon, double endLat, double endLon)
{
startLon = LatLonHelpers.CorrectIlleagleLon(startLon);
endLon = LatLonHelpers.CorrectIlleagleLon(endLon);

List<dynamic> dynamicList = new List<dynamic>();

if (!((startLon < 0 && endLon > 0) || (startLon > 0 && endLon < 0)))
{
// Lon does not cross the AM in any way. Just return our Coordinates.
dynamicList.Add(new List<double>() { startLon, startLat });
dynamicList.Add(new List<double>() { endLon, endLat });
return dynamicList;
}

// Lon DOES cross the AM.
Loc startLoc = new Loc() { Latitude = startLat, Longitude = startLon };
Loc endLoc = new Loc() { Latitude = endLat, Longitude = endLon };
Loc midPointStartLoc = new Loc();
Loc midPointEndLoc = new Loc();
var bearing = LatLonHelpers.HaversineGreatCircleBearing(startLoc, endLoc);

//if ((startLoc.Longitude < 0 && (bearing > 180 && bearing < 360)) || (startLoc.Longitude > 0 && (bearing > 0 && bearing < 180)))
if ((startLoc.Longitude < 0 && (bearing > 0 && bearing < 180)) || (startLoc.Longitude > 0 && (bearing > 180 && bearing < 360)))
{
// Dont need to split
dynamicList.Add(new List<double>() { startLon, startLat });
dynamicList.Add(new List<double>() { endLon, endLat });
return dynamicList;
}

if (startLoc.Longitude < 0)
{
startLoc.Longitude = startLoc.Longitude + 180;
// See if this works, If needed change to the limit -179.99999999999
midPointStartLoc.Longitude = -180;
}
else
{
startLoc.Longitude = startLoc.Longitude - 180;
midPointStartLoc.Longitude = 180;
}

if (endLoc.Longitude < 0)
{
endLoc.Longitude = endLoc.Longitude + 180;
midPointEndLoc.Longitude = -180;
}
else
{
endLoc.Longitude = endLoc.Longitude - 180;
midPointEndLoc.Longitude = 180;
}

var slope = (startLat - endLat) / (startLoc.Longitude - endLoc.Longitude);
var midPointLat = startLat - (slope * startLoc.Longitude);

dynamicList.Add(new List<double>() { startLon, startLat });
dynamicList.Add(new List<double>() { midPointStartLoc.Longitude, midPointLat });
dynamicList.Add(new List<double>() { midPointEndLoc.Longitude, midPointLat });
dynamicList.Add(new List<double>() { endLon, endLat });
return dynamicList;

}


private int[] getFilters(GeoMapObject geoMapObject, string xsiType)
{
Expand Down Expand Up @@ -1175,7 +1112,7 @@ public void WriteCombinedGeoMapGeoJson(string dirPath, GeoMapSet geo)
FileInfo file = new FileInfo(fullFilePath);
file.Directory.Create(); // If the directory already exists, this method does nothing.

string jsonString = JsonConvert.SerializeObject(FileFeatures[fullFilePath], new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string jsonString = JsonConvert.SerializeObject(FileFeatures[fullFilePath], new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });

File.WriteAllText(fullFilePath, jsonString);
}
Expand Down Expand Up @@ -1269,7 +1206,7 @@ public void WriteGeoMapGeoJson(string dirPath, GeoMapSet geo)
}
}

string jsonString = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore });
string jsonString = JsonConvert.SerializeObject(geojson, new JsonSerializerSettings { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore });

//jsonString = PostProcess(jsonString);

Expand Down Expand Up @@ -1360,7 +1297,7 @@ private List<Feature> CreateLineFeature(List<Element> elements)
foreach (Element element in elements)
{
bool crossesAM = false;
var coords = CheckAMCrossing(element.StartLat, element.StartLon, element.EndLat, element.EndLon);
var coords = LatLonHelpers.CheckAMCrossing(element.StartLat, element.StartLon, element.EndLat, element.EndLon);
if (coords.Count() == 4) { crossesAM = true; }

if (prevElement == null)
Expand Down
Loading

0 comments on commit deefc5f

Please sign in to comment.