Skip to content

Commit

Permalink
Merge pull request #94 from Nikolai558/development
Browse files Browse the repository at this point in the history
releasing v2.3.1
  • Loading branch information
Nikolai558 authored Aug 10, 2022
2 parents e4582cb + f1da1e1 commit 6e44fae
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 19 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# CHANGELOG

---
- ## Version 2.3.1
- #92: Corrected ASDEX properties in the geojson output files
- #93: Default property settings are not included in "feature-level" properties

- ## Version 2.3.0
- New Feature: vSTARS/vERAM Maps to GeoJson (CRC) format

Expand Down
72 changes: 54 additions & 18 deletions FeBuddyLibrary/DataAccess/GeoJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class GeoJson

private StringBuilder _errorLog = new StringBuilder();

private bool isDefaultObject()
{
return false;
}

public VideoMaps ReadVideoMap(string filepath)
{
var tempFile = Path.Combine(Path.GetTempPath(), "FE-BUDDY", "tempGeoMap.xml");
Expand Down Expand Up @@ -227,7 +232,7 @@ private List<Feature> CreateAsdexVideoMap(List<vmElement> vmElements, Dictionary
{
properties = new Properties()
{
style = elementItem.Style,
style = Char.ToLowerInvariant(elementItem.Style[0]) + elementItem.Style[1..],
thickness = elementItem.Thickness,
},
geometry = new Geometry()
Expand All @@ -252,6 +257,8 @@ private List<Feature> CreateAsdexVideoMap(List<vmElement> vmElements, Dictionary
if (asdexColorDef[asdexColorKey].Contains(elementItem.Color.ToLower()) && asdexColorKey != "UNKNOWN")
{
currentFeature.properties.asdex = asdexColorKey;
currentFeature.properties.thickness = null;
currentFeature.properties.style = null;
}
}

Expand Down Expand Up @@ -303,7 +310,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
currentFeature.properties = new Properties()
{
color = colors?[item.Color.ToLower()] ?? null,
style = item.Style,
style = Char.ToLowerInvariant(item.Style[0]) + item.Style[1..],
thickness = item.Thickness,
};

Expand All @@ -317,7 +324,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
properties = new Properties()
{
color = colors?[item.Color.ToLower()] ?? null,
style = item.Style,
style = Char.ToLowerInvariant(item.Style[0]) + item.Style[1..],
thickness = item.Thickness,
},
geometry = new Geometry() { type = "LineString" }
Expand Down Expand Up @@ -346,7 +353,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
{
properties = new Properties()
{
style = item.Style,
style = Char.ToLowerInvariant(item.Style[0]) + item.Style[1..],
thickness = item.Thickness,
color = colors?[item.Color.ToLower()] ?? null
},
Expand All @@ -366,7 +373,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
properties = new Properties()
{
color = colors?[item.Color.ToLower()] ?? null,
style = item.Style,
style = Char.ToLowerInvariant(item.Style[0]) + item.Style[1..],
thickness = item.Thickness,
},
geometry = new Geometry() { type = "LineString" }
Expand All @@ -393,7 +400,7 @@ private List<Feature> CreateLineStringVideoMap(List<vmElement> vmElements, Dicti
properties = new Properties()
{
color = colors?[item.Color.ToLower()] ?? null,
style = item.Style,
style = Char.ToLowerInvariant(item.Style[0]) + item.Style[1..],
thickness = item.Thickness,
},
geometry = new Geometry() { type = "LineString" }
Expand Down Expand Up @@ -567,7 +574,7 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
Expand All @@ -579,6 +586,10 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
}
};

if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }

foreach (Element element in elements)
{
bool crossesAM = false;
Expand All @@ -600,14 +611,17 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
zIndex = null,
},
geometry = new Geometry() { type = "LineString" }
};
if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }
currentFeature.geometry.coordinates.Add(coords[2]);
currentFeature.geometry.coordinates.Add(coords[3]);
}
Expand All @@ -633,14 +647,17 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
zIndex = null,
},
geometry = new Geometry() { type = "LineString" }
};
if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }
}

currentFeature.geometry.coordinates.Add(coords[0]);
Expand All @@ -652,15 +669,18 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
zIndex = null,
},
geometry = new Geometry() { type = "LineString" }
};

if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }

currentFeature.geometry.coordinates.Add(coords[2]);
currentFeature.geometry.coordinates.Add(coords[3]);
}
Expand All @@ -677,7 +697,7 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
Expand All @@ -688,6 +708,9 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
type = "LineString",
}
};
if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }
currentFeature.geometry.coordinates = coords;
}
}
Expand All @@ -705,14 +728,17 @@ private List<Feature> CreateLineFeature(List<Element> elements, LineDefaults lin
properties = new Properties()
{
bcg = lineDefaults.Bcg,
style = lineDefaults.Style,
style = Char.ToLowerInvariant(lineDefaults.Style[0]) + lineDefaults.Style[1..],
thickness = lineDefaults.Thickness,

color = null,
zIndex = null,
},
geometry = new Geometry() { type = "LineString" }
};
if (currentFeature.properties.thickness == 1) { currentFeature.properties.thickness = null; }
if (currentFeature.properties.style == "solid") { currentFeature.properties.style = null; }
if (currentFeature.properties.bcg == 1) { currentFeature.properties.bcg = null; }
currentFeature.geometry.coordinates.Add(coords[2]);
currentFeature.geometry.coordinates.Add(coords[3]);
}
Expand Down Expand Up @@ -751,11 +777,17 @@ private Feature CreateTextFeature(Element element, TextDefaults textDefaults)
opaque = textDefaults.Opaque,
xOffset = textDefaults.XOffset,
yOffset = textDefaults.YOffset,
color = null,
zIndex = null
}
};

// CRC Defaults. If any of these are true we don't need to include them in the geojson file.
if (output.properties.size == 0) { output.properties.size = null; }
if (output.properties.bcg == 1) { output.properties.bcg = null; }
if (output.properties.xOffset == 0) { output.properties.xOffset = null; }
if (output.properties.yOffset == 0) { output.properties.yOffset = null; }
if (output.properties.opaque == false) { output.properties.bcg = null; }
if (output.properties.underline == false) { output.properties.bcg = null; }

try
{
output.properties.filters = Array.ConvertAll(textDefaults.Filters.Replace(" ", string.Empty).Replace("\t", string.Empty).Split(','), s => int.Parse(s));
Expand Down Expand Up @@ -783,12 +815,16 @@ private Feature CreateSymbolFeature(Element element, SymbolDefaults symbolDefaul
},
properties = new Properties()
{
style = symbolDefaults.Style,
style = Char.ToLowerInvariant(symbolDefaults.Style[0]) + symbolDefaults.Style[1..],
size = symbolDefaults.Size,
bcg = symbolDefaults.Bcg,
zIndex = null,
color = null,
}};

// CRC Defaults. If any of these are true we don't need to include them in the geojson file.
if (output.properties.style == "VOR") { output.properties.style = null; }
if (output.properties.size == 0) { output.properties.size = null; }
if (output.properties.bcg == 1) { output.properties.bcg = null; }

try
{
output.properties.filters = Array.ConvertAll(symbolDefaults.Filters.Replace(" ", string.Empty).Replace("\t", string.Empty).Split(','), s => int.Parse(s));
Expand Down
2 changes: 1 addition & 1 deletion FeBuddyWinFormUI/FeBuddyWinFormUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<AssemblyName>FE-BUDDY</AssemblyName>
<Version>2.3.0</Version>
<Version>2.3.1</Version>
<Copyright>Copyright © 2022 Nikolas Boling, Kyle Sanders</Copyright>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>FE_BUDDY_icon.ico</ApplicationIcon>
Expand Down
3 changes: 3 additions & 0 deletions FeBuddyWinFormUI/WinForms/GeoJsonFrom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public GeoJsonForm(string currentVersion)
this.Text = $"FE-BUDDY - V{currentVersion}";

GlobalConfig.outputDirBase = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

GlobalConfig.outputDirBase = Path.Combine(GlobalConfig.outputDirBase, "FE-BUDDY-GeoJSONs");

outputPathLabel.Text = GlobalConfig.outputDirBase;
outputPathLabel.Visible = true;
outputPathLabel.MaximumSize = new Size(257, 82);
Expand Down

0 comments on commit 6e44fae

Please sign in to comment.