private void AddCompulsaryLocation(Location loc, string locationKeySuffix)
        {
            string locationKey = loc.Id + locationKeySuffix;

            Log.Trace(CultureInfo.CurrentCulture, Resources.LogMessage_AddArrivalDepartureRow, locationKey);
            if (!Locations.Any(l => l.LocationKey == locationKey))
            {
                Locations.AddSorted(new LocationDisplayModel
                {
                    LocationKey           = locationKey,
                    LocationId            = loc.Id,
                    AlwaysDisplay         = true,
                    ArrivalDepartureLabel = locationKey.Substring(locationKey.Length - 1),
                    EditorDisplayName     = loc.EditorDisplayName,
                    ExportDisplayName     = loc.TimetableDisplayName,
                    Mileage                     = loc.Mileage,
                    FontType                    = loc.FontType,
                    IsRoutingCodeRow            = false,
                    DisplaySeparatorAbove       = loc.DisplaySeparatorAbove,
                    DisplaySeparatorBelow       = loc.DisplaySeparatorBelow,
                    ParentDisplaySeparatorAbove = loc.DisplaySeparatorAbove,
                    ParentDisplaySeparatorBelow = loc.DisplaySeparatorBelow,
                }, _locationDisplayModelComparer);
            }
        }
        private void AddCompulsaryRoutingCodeRow(Location loc, string keySuffix)
        {
            string locationKey = loc.Id + keySuffix;

            Log.Trace(CultureInfo.CurrentCulture, Resources.LogMessage_AddRoutingRow, locationKey);
            if (!Locations.Any(l => l.LocationKey == locationKey))
            {
                Locations.AddSorted(new LocationDisplayModel
                {
                    LocationKey           = locationKey,
                    LocationId            = loc.Id,
                    AlwaysDisplay         = true,
                    ArrivalDepartureLabel = string.Empty,
                    EditorDisplayName     = string.Empty,
                    ExportDisplayName     = string.Empty,
                    Mileage                     = loc.Mileage,
                    FontType                    = loc.FontType,
                    IsRoutingCodeRow            = true,
                    DisplaySeparatorAbove       = loc.DisplaySeparatorAbove,
                    DisplaySeparatorBelow       = loc.DisplaySeparatorBelow,
                    ParentDisplaySeparatorAbove = loc.DisplaySeparatorAbove,
                    ParentDisplaySeparatorBelow = loc.DisplaySeparatorBelow,
                }, _locationDisplayModelComparer);
            }
        }
        /// <summary>
        /// Add a column to the table.
        /// </summary>
        /// <param name="segment">The data in the column to be added.</param>
        public void Add(TrainSegmentModel segment)
        {
            if (segment is null)
            {
                throw new ArgumentNullException(nameof(segment));
            }

            foreach (string locationKey in TrainSegments.SelectMany(t => t.TimingsIndex).Select(t => t.Key).Union(segment.TimingsIndex.Select(t => t.Key)))
            {
                if (!Locations.Any(l => l.LocationKey == locationKey))
                {
                    string               strippedKey = locationKey.StripArrivalDepartureSuffix();
                    Location             loc         = LocationDict[strippedKey];
                    LocationDisplayModel ldm         = new LocationDisplayModel
                    {
                        LocationKey                 = locationKey,
                        LocationId                  = loc.Id,
                        Mileage                     = loc.Mileage,
                        FontType                    = loc.FontType,
                        DisplaySeparatorAbove       = loc.DisplaySeparatorAbove,
                        DisplaySeparatorBelow       = loc.DisplaySeparatorBelow,
                        ParentDisplaySeparatorBelow = loc.DisplaySeparatorBelow,
                        ParentDisplaySeparatorAbove = loc.DisplaySeparatorAbove,
                    };
                    if (locationKey.EndsWith(LocationIdSuffixes.Arrival, StringComparison.InvariantCulture) || locationKey.EndsWith(LocationIdSuffixes.Departure, StringComparison.InvariantCulture))
                    {
                        ldm.ArrivalDepartureLabel = locationKey.Substring(locationKey.Length - 1);
                        ldm.EditorDisplayName     = loc.EditorDisplayName;
                        ldm.ExportDisplayName     = loc.TimetableDisplayName;
                    }
                    else
                    {
                        ldm.EditorDisplayName = string.Empty;
                        ldm.ExportDisplayName = string.Empty;
                        ldm.IsRoutingCodeRow  = true;
                        if (locationKey.EndsWith(LocationIdSuffixes.Platform, StringComparison.InvariantCulture))
                        {
                            ldm.ArrivalDepartureLabel = Resources.LocationRow_Abbreviation_Platform;
                        }
                    }
                    Locations.AddSorted(ldm, _locationDisplayModelComparer);
                }
            }
            TrainSegments.AddSorted(segment, new TrainSegmentModelComparer(Locations));
        }