Skip to content

Commit

Permalink
Merge pull request #127 from AndyTWF/126-ground-networks
Browse files Browse the repository at this point in the history
feat(groundnetwork): allow ground networks to be modelled
  • Loading branch information
AndyTWF authored Feb 17, 2021
2 parents 4962247 + 3c6a569 commit fba244b
Show file tree
Hide file tree
Showing 136 changed files with 2,378 additions and 1,086 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Valid keys in each airports object are as follows:
"basic": {},
"fixes": {},
"freetext": {},
"ground_network": {},
"ownership": {},
"positions": {},
"positions_mentor": {},
Expand Down
47 changes: 24 additions & 23 deletions src/Compiler/Collector/CompilableElementCollectorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,32 @@ public ICompilableElementCollector GetCollectorForOutputSection(OutputSectionKey
return section switch
{
// Headers
OutputSectionKeys.FILE_HEADER => new HeaderCollector(this.sectorElements),
OutputSectionKeys.FILE_HEADER => new HeaderCollector(sectorElements),
// SCT Sections
OutputSectionKeys.SCT_COLOUR_DEFS => new ColoursCollector(this.sectorElements),
OutputSectionKeys.SCT_INFO => new InfoCollector(this.sectorElements),
OutputSectionKeys.SCT_AIRPORT => new AirportsCollector(this.sectorElements),
OutputSectionKeys.SCT_RUNWAY => new RunwaysCollector(this.sectorElements),
OutputSectionKeys.SCT_VOR => new VorsCollector(this.sectorElements),
OutputSectionKeys.SCT_NDB => new NdbsCollector(this.sectorElements),
OutputSectionKeys.SCT_FIXES => new FixesCollector(this.sectorElements),
OutputSectionKeys.SCT_GEO => new GeoCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.SCT_LOW_AIRWAY => new LowAirwaysCollector(this.sectorElements),
OutputSectionKeys.SCT_HIGH_AIRWAY => new HighAirwaysCollector(this.sectorElements),
OutputSectionKeys.SCT_ARTCC => new ArtccCollector(this.sectorElements),
OutputSectionKeys.SCT_ARTCC_LOW => new LowArtccCollector(this.sectorElements),
OutputSectionKeys.SCT_ARTCC_HIGH => new HighArtccCollector(this.sectorElements),
OutputSectionKeys.SCT_SID => new SidsCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.SCT_STAR => new StarsCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.SCT_LABELS => new LabelsCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.SCT_REGIONS => new RegionsCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.SCT_COLOUR_DEFS => new ColoursCollector(sectorElements),
OutputSectionKeys.SCT_INFO => new InfoCollector(sectorElements),
OutputSectionKeys.SCT_AIRPORT => new AirportsCollector(sectorElements),
OutputSectionKeys.SCT_RUNWAY => new RunwaysCollector(sectorElements),
OutputSectionKeys.SCT_VOR => new VorsCollector(sectorElements),
OutputSectionKeys.SCT_NDB => new NdbsCollector(sectorElements),
OutputSectionKeys.SCT_FIXES => new FixesCollector(sectorElements),
OutputSectionKeys.SCT_GEO => new GeoCollector(sectorElements, outputGroups),
OutputSectionKeys.SCT_LOW_AIRWAY => new LowAirwaysCollector(sectorElements),
OutputSectionKeys.SCT_HIGH_AIRWAY => new HighAirwaysCollector(sectorElements),
OutputSectionKeys.SCT_ARTCC => new ArtccCollector(sectorElements),
OutputSectionKeys.SCT_ARTCC_LOW => new LowArtccCollector(sectorElements),
OutputSectionKeys.SCT_ARTCC_HIGH => new HighArtccCollector(sectorElements),
OutputSectionKeys.SCT_SID => new SidsCollector(sectorElements, outputGroups),
OutputSectionKeys.SCT_STAR => new StarsCollector(sectorElements, outputGroups),
OutputSectionKeys.SCT_LABELS => new LabelsCollector(sectorElements, outputGroups),
OutputSectionKeys.SCT_REGIONS => new RegionsCollector(sectorElements, outputGroups),
// ESE sections.
OutputSectionKeys.ESE_POSITIONS => new PositionsCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.ESE_FREETEXT => new FreetextCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.ESE_SIDSSTARS => new SidStarsCollector(this.sectorElements),
OutputSectionKeys.ESE_AIRSPACE => new AirspaceCollector(this.sectorElements, this.outputGroups),
OutputSectionKeys.RWY_ACTIVE_RUNWAYS => new ActiveRunwaysCollector(this.sectorElements),
OutputSectionKeys.ESE_POSITIONS => new PositionsCollector(sectorElements, outputGroups),
OutputSectionKeys.ESE_FREETEXT => new FreetextCollector(sectorElements, outputGroups),
OutputSectionKeys.ESE_SIDSSTARS => new SidStarsCollector(sectorElements),
OutputSectionKeys.ESE_AIRSPACE => new AirspaceCollector(sectorElements, outputGroups),
OutputSectionKeys.ESE_GROUND_NETWORK => new GroundNetworkCollector(sectorElements),
OutputSectionKeys.RWY_ACTIVE_RUNWAYS => new ActiveRunwaysCollector(sectorElements),
_ => throw new ArgumentException("No element collector for section " + section)
};
}
Expand Down
21 changes: 21 additions & 0 deletions src/Compiler/Collector/GroundNetworkCollector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Linq;
using Compiler.Model;

namespace Compiler.Collector
{
public class GroundNetworkCollector : ICompilableElementCollector
{
private readonly SectorElementCollection sectorElements;

public GroundNetworkCollector(SectorElementCollection sectorElements)
{
this.sectorElements = sectorElements;
}

public IEnumerable<ICompilableElementProvider> GetCompilableElements()
{
return sectorElements.GroundNetworks.OrderBy(network => network.Airport);
}
}
}
1 change: 1 addition & 0 deletions src/Compiler/Config/AirfieldConfigFileSections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class AirfieldConfigFileSections
new ConfigFileSection("ground_map.regions", InputDataType.SCT_REGIONS, "Ground Map Regions"),
new ConfigFileSection("ground_map.labels", InputDataType.SCT_LABELS, "Ground Map Labels"),
new ConfigFileSection("vrps", InputDataType.ESE_VRPS, "VRPs"),
new ConfigFileSection("ground_network", InputDataType.ESE_GROUND_NETWORK, "Ground Network"),
};
}
}
1 change: 1 addition & 0 deletions src/Compiler/Input/InputDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum InputDataType
ESE_SIDS,
ESE_STARS,
ESE_VRPS,
ESE_GROUND_NETWORK,

// EuroScope RWY file
RWY_ACTIVE_RUNWAY,
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Input/SectorDataReaderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static AbstractSectorDataReader Create(InputDataType dataType)
{
InputDataType.ESE_AGREEMENTS => new EseSectorDataReader(),
InputDataType.ESE_FREETEXT => new EseSectorDataReader(),
InputDataType.ESE_GROUND_NETWORK => new EseSectorDataReader(),
InputDataType.ESE_POSITIONS_MENTOR => new EseSectorDataReader(),
InputDataType.ESE_OWNERSHIP => new EseSectorDataReader(),
InputDataType.ESE_POSITIONS => new EseSectorDataReader(),
Expand Down
31 changes: 31 additions & 0 deletions src/Compiler/Model/GroundNetwork.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Linq;

namespace Compiler.Model
{
/**
* Container for all the ground network elements related to an airport
*/
public class GroundNetwork: ICompilableElementProvider
{
public string Airport { get; }
public List<GroundNetworkTaxiway> Taxiways { get; }
public List<GroundNetworkRunwayExit> RunwayExits { get; }

public GroundNetwork(
string airport,
List<GroundNetworkTaxiway> taxiways,
List<GroundNetworkRunwayExit> runwayExits
)
{
Airport = airport;
Taxiways = taxiways;
RunwayExits = runwayExits;
}

public IEnumerable<ICompilableElement> GetCompilableElements()
{
return Taxiways.Concat<ICompilableElement>(RunwayExits);
}
}
}
22 changes: 22 additions & 0 deletions src/Compiler/Model/GroundNetworkCoordinate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Compiler.Model
{
public class GroundNetworkCoordinate: AbstractCompilableElement
{
public Coordinate Coordinate { get; }

public GroundNetworkCoordinate(
Coordinate coordinate,
Definition definition,
Docblock docblock,
Comment inlineComment
) : base(definition, docblock, inlineComment)
{
Coordinate = coordinate;
}

public override string GetCompileData(SectorElementCollection elements)
{
return $"COORD:{Coordinate.latitude}:{Coordinate.longitude}";
}
}
}
43 changes: 43 additions & 0 deletions src/Compiler/Model/GroundNetworkRunwayExit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Linq;

namespace Compiler.Model
{
public class GroundNetworkRunwayExit: AbstractCompilableElement
{
public string Runway { get; }
public string ExitName { get; }
public string Direction { get; }
public List<GroundNetworkCoordinate> Coordinates { get; }
public int MaximumSpeed { get; }

public GroundNetworkRunwayExit(
string runway,
string exitName,
string direction,
int maximumSpeed,
List<GroundNetworkCoordinate> coordinates,
Definition definition,
Docblock docblock,
Comment inlineComment
) : base(definition, docblock, inlineComment)
{
Runway = runway;
ExitName = exitName;
Direction = direction;
Coordinates = coordinates;
MaximumSpeed = maximumSpeed;
}

public override IEnumerable<ICompilableElement> GetCompilableElements()
{
return new List<ICompilableElement> {this}
.Concat(this.Coordinates);
}

public override string GetCompileData(SectorElementCollection elements)
{
return $"EXIT:{Runway}:{ExitName}:{Direction}:{MaximumSpeed}";
}
}
}
43 changes: 43 additions & 0 deletions src/Compiler/Model/GroundNetworkTaxiway.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Linq;

namespace Compiler.Model
{
public class GroundNetworkTaxiway: AbstractCompilableElement
{
public string Name { get; }
public List<GroundNetworkCoordinate> Coordinates { get; }
public int MaximumSpeed { get; }
public int? UsageFlag { get; }
public string GateName { get; }

public GroundNetworkTaxiway(
string name,
int maximumSpeed,
int? usageFlag,
string gateName,
List<GroundNetworkCoordinate> coordinates,
Definition definition,
Docblock docblock,
Comment inlineComment
) : base(definition, docblock, inlineComment)
{
Name = name;
Coordinates = coordinates;
MaximumSpeed = maximumSpeed;
UsageFlag = usageFlag;
GateName = gateName;
}

public override IEnumerable<ICompilableElement> GetCompilableElements()
{
return new List<ICompilableElement> {this}
.Concat(this.Coordinates);
}

public override string GetCompileData(SectorElementCollection elements)
{
return $"TAXI:{Name}:{MaximumSpeed}:{UsageFlag}:{GateName}";
}
}
}
7 changes: 7 additions & 0 deletions src/Compiler/Model/SectorElementCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class SectorElementCollection
public List<RunwayCentreline> RunwayCentrelines { get; } = new();

public List<RunwayCentreline> FixedColourRunwayCentrelines { get; } = new();

public List<GroundNetwork> GroundNetworks { get; } = new();

public void Add(Airport airport)
{
Expand Down Expand Up @@ -197,5 +199,10 @@ public void Add(FixedColourRunwayCentreline centreline)
{
FixedColourRunwayCentrelines.Add(centreline);
}

public void Add(GroundNetwork network)
{
GroundNetworks.Add(network);
}
}
}
1 change: 1 addition & 0 deletions src/Compiler/Output/EseOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public override OutputSectionKeys[] GetOutputSections()
OutputSectionKeys.ESE_FREETEXT,
OutputSectionKeys.ESE_SIDSSTARS,
OutputSectionKeys.ESE_AIRSPACE,
OutputSectionKeys.ESE_GROUND_NETWORK
};
}

Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Output/OutputSectionKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum OutputSectionKeys
ESE_FREETEXT,
ESE_SIDSSTARS,
ESE_AIRSPACE,
ESE_GROUND_NETWORK,

// RWY
RWY_ACTIVE_RUNWAYS
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/Output/OutputSectionsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public class OutputSectionsConfig
true,
"[AIRSPACE]"
),
new(
OutputSectionKeys.ESE_GROUND_NETWORK,
true,
"[GROUND]"
),
new(
OutputSectionKeys.RWY_ACTIVE_RUNWAYS,
false,
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Parser/DataParserFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public ISectorDataParser GetParserForFile(AbstractSectorDataFile file)
PositionOrder.PRE_POSITION
),
InputDataType.ESE_VRPS => new VrpParser(sectorElements, logger),
InputDataType.ESE_GROUND_NETWORK => new GroundNetworkParser(sectorElements, logger),
_ => throw new NotImplementedException(
$"Parser not not implemented for input data type {file.DataType.ToString()}")
};
Expand Down
Loading

0 comments on commit fba244b

Please sign in to comment.