Skip to content

Commit

Permalink
Disabled stairway auto-fix for now due to major issues, pushed versio…
Browse files Browse the repository at this point in the history
…n to 1.6.5
  • Loading branch information
BlackTasty committed Feb 7, 2024
1 parent 16b0153 commit 13d20d3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 22 deletions.
29 changes: 15 additions & 14 deletions SLC_LayoutEditor/Controls/IssueTracker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
ShowProblems="{Binding ShowDuplicateSeatIssues}"/>

<Separator Margin="0,4"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="No duplicate doors"
<local:LayoutProblemText ValidText="No duplicate doors"
InvalidText="{Binding ActiveLayout.DuplicateDoors.Count, StringFormat={}{0} duplicate doors found!}"
IsValid="{Binding ActiveLayout.HasNoDuplicateDoors}"
InvalidSlots="{Binding ActiveLayout.DuplicateDoors}"
Expand All @@ -78,6 +78,7 @@
ShowProblemsChanged="StairwayPositions_ShowIssuesChanged"
ShowProblems="{Binding ShowStairwayIssues}"
ShowAutoFix="True"
IsAutoFixEnabled="False"
AutoFixApplying="StairwayPositions_AutoFixApplying"
AutoFixTarget="{Binding ActiveLayout}"
Description="When using multiple decks and adding stairways, make sure to align them on the same x/y coordinate"
Expand All @@ -87,7 +88,7 @@
<TextBlock Text="Issues per deck" FontSize="18" Margin="0,16,0,0"/>
<DataGrid ItemsSource="{Binding ActiveLayout.CabinDecks}"
PreviewMouseWheel="DeckProblemsList_PreviewMouseWheel"
Margin="0,0,0,0">
Margin="0,0,0,0" HorizontalScrollBarVisibility="Hidden">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
Expand All @@ -100,8 +101,8 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Visibility="{Binding CabinSlots, Converter={StaticResource NotNullToVisibilityConverter}}"
Margin="0,0,0,12" Width="297">
<TextBlock FontSize="16" DockPanel.Dock="Top" Margin="0,0,0,0"
Margin="0,0,0,12" HorizontalAlignment="Stretch" Width="318">
<TextBlock FontSize="16" Margin="0,0,0,0"
Foreground="{DynamicResource ForegroundSecondaryColorBrush}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
Expand All @@ -117,7 +118,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="All slots are reachable"
<local:LayoutProblemText ValidText="All slots are reachable"
Floor="{Binding Floor}"
IsValid="{Binding AllSlotsReachable}"
InvalidSlots="{Binding UnreachableSlots}"
Expand All @@ -136,7 +137,7 @@
</Style>
</local:LayoutProblemText.Style>
</local:LayoutProblemText>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Deck slots valid"
<local:LayoutProblemText ValidText="Deck slots valid"
Floor="{Binding Floor}"
InvalidText="Invalid amount of deck slots!"
IsValid="{Binding AreSlotsValid}"
Expand All @@ -145,14 +146,14 @@
AutoFixApplying="Slots_AutoFixApplying"
Description="This layout validator checks if your deck has &quot;holes&quot;, i.e. missing tiles"/>

<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Doors available"
<local:LayoutProblemText ValidText="Doors available"
Floor="{Binding Floor}"
InvalidText="No doors for this deck!"
IsValid="{Binding AreDoorsValid}"
Description="Each deck needs at least one door. Also make sure that each layout has at least one loading bay, catering doors are optional"/>

<Separator Margin="0,4"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="CAT/LB on correct side"
<local:LayoutProblemText ValidText="CAT/LB on correct side"
Floor="{Binding Floor}"
InvalidText="CAT/LB detected on the left side"
InvalidSlots="{Binding InvalidCateringDoorsAndLoadingBays}"
Expand Down Expand Up @@ -222,34 +223,34 @@
</local:LayoutProblemText.Style>
</local:LayoutProblemText>
<Separator Margin="0,4"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Service start- and endpoints are valid"
<local:LayoutProblemText ValidText="Service start- and endpoints are valid"
Floor="{Binding Floor}"
InvalidText="Invalid service points!"
IsValid="{Binding AreServicePointsValid}"
Description="Each service start point (&lt;) also requires an end point (&gt;) in the same column"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="All seat rows covered by service"
<local:LayoutProblemText ValidText="All seat rows covered by service"
Floor="{Binding Floor}"
InvalidText="Some rows aren't covered by service!"
IsValid="{Binding AreSeatsReachableByService}"
IsRequired="{Binding AreKitchensValid}"
NotRequiredText="No service coverage required (no kitchen)"
Description="In case you have a kitchen on this deck, make sure to cover all rows with the service start- and endpoints"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Enough galley seats available for crew"
<local:LayoutProblemText ValidText="Enough galley seats available for crew"
Floor="{Binding Floor}"
InvalidText="Insufficient galley seats for servicing!"
IsValid="{Binding AreGalleysValid}"
Description="Make sure to have at least as many galley seats on this deck as there are service areas"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Kitchen accessible (In-Flight services available)"
<local:LayoutProblemText ValidText="Kitchen accessible (In-Flight services available)"
Floor="{Binding Floor}"
InvalidText="No kitchen available! (No In-Flight services)"
IsValid="{Binding AreKitchensValid}" IsSevereProblem="False"
Description="If you wanna be able to offer in-flight services, make sure to place down a kitchen"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Intercom available"
<local:LayoutProblemText ValidText="Intercom available"
Floor="{Binding Floor}"
InvalidText="No intercom on this deck!"
IsValid="{Binding AreIntercomsValid}"
Description="Intercoms are used by your cabin crew to communicate to both the captain as well as the passengers"/>
<local:LayoutProblemText DockPanel.Dock="Top" ValidText="Toilets available"
<local:LayoutProblemText ValidText="Toilets available"
Floor="{Binding Floor}"
InvalidText="No toilets on this deck!"
IsValid="{Binding AreToiletsAvailable}" IsSevereProblem="False"
Expand Down
3 changes: 3 additions & 0 deletions SLC_LayoutEditor/Controls/LayoutProblemText.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledColorBrush}"/>
</Trigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=IsAutoFixEnabled}" Value="False">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
Expand Down
12 changes: 12 additions & 0 deletions SLC_LayoutEditor/Controls/LayoutProblemText.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ public object AutoFixTarget
DependencyProperty.Register("AutoFixTarget", typeof(object), typeof(LayoutProblemText), new PropertyMetadata(null));
#endregion

#region IsAutoFixEnabled property
public bool IsAutoFixEnabled
{
get { return (bool)GetValue(IsAutoFixEnabledProperty); }
set { SetValue(IsAutoFixEnabledProperty, value); }
}

// Using a DependencyProperty as the backing store for IsAutoFixEnabled. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsAutoFixEnabledProperty =
DependencyProperty.Register("IsAutoFixEnabled", typeof(bool), typeof(LayoutProblemText), new PropertyMetadata(true));
#endregion

#region Floor property
public int Floor
{
Expand Down
26 changes: 22 additions & 4 deletions SLC_LayoutEditor/Core/Cabin/CabinLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,36 @@ public void SaveLayout()

public AutoFixResult FixStairwayPositions()
{
CabinDeck deckWithStairs = CabinDecks.FirstOrDefault(x => x.CabinSlots.Any(y => y.Type == CabinSlotType.Stairway));
CabinDeck firstDeckWithStairs = CabinDecks.FirstOrDefault(x => x.CabinSlots.Any(y => y.Type == CabinSlotType.Stairway));

AutoFixResult autoFixResult = new AutoFixResult("Stairway fix applied.", "Amount of changed slots",
"Failed changes");

if (HasMultipleDecks)
{
Dictionary<CabinSlot, int> stairwayMapping = deckWithStairs.GetStairways();
// TODO: Rework stairway fix
int floors = CabinDecks.Count;
CabinDeck previousDeck = firstDeckWithStairs;


foreach (CabinDeck cabinDeck in CabinDecks.Where(x => x.Floor != firstDeckWithStairs.Floor))
{
foreach (CabinSlot stairway in cabinDeck.CabinSlots.Where(x => x.Type == CabinSlotType.Stairway))
{
CabinSlot connectedSlot = previousDeck.GetSlotAtPosition(stairway.Row, stairway.Column);
}
}

var stairGroups = CabinDecks.SelectMany(x => x.CabinSlots.Where(y => y.Type == CabinSlotType.Stairway).GroupBy(y => new { y.Row, y.Column }));




Dictionary<CabinSlot, int> stairwayMapping = firstDeckWithStairs.GetStairways();

foreach (CabinDeck cabinDeck in CabinDecks)
{
if (cabinDeck.Equals(deckWithStairs))
if (cabinDeck.Equals(firstDeckWithStairs))
{
continue;
}
Expand Down Expand Up @@ -571,7 +589,7 @@ public AutoFixResult FixStairwayPositions()
}
else
{
foreach (CabinSlot cabinSlot in deckWithStairs.CabinSlots.Where(x => x.Type == CabinSlotType.Stairway))
foreach (CabinSlot cabinSlot in firstDeckWithStairs.CabinSlots.Where(x => x.Type == CabinSlotType.Stairway))
{
cabinSlot.Type = CabinSlotType.Aisle;
cabinSlot.SlotIssues.ToggleIssue(CabinSlotIssueType.STAIRWAY, false);
Expand Down
4 changes: 2 additions & 2 deletions SLC_LayoutEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.4.0")]
[assembly: AssemblyFileVersion("1.6.4.0")]
[assembly: AssemblyVersion("1.6.5.0")]
[assembly: AssemblyFileVersion("1.6.5.0")]
5 changes: 3 additions & 2 deletions SLC_LayoutEditor/Resources/patchnotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
20.01.2024 m
Disabled: Temporarily disabled the stairway auto-fix button, since this part requires a rework
Added: You can now use keybinds to perform certain actions! For a complete list of keybinds, go to "Help" -> "Show keybinds" or press Ctrl+K
Added: Added a menu entry "Layout" for performing basic layout actions
Added: Added a new menu entry "Help" in the menu bar
Expand All @@ -8,13 +9,13 @@ Added: When selecting a template while creating a new layout, you can now let th
Added: Two new issue checks have been added for both cockpit and passenger door placement
Added: Unsaved changes to your settings can now be reverted
Updated: The cabin deck rendering got a major overhaul, resulting in faster loading times! This is especially noticeable with larger layouts
Updated: The default Windows title bar is gone, and has been replaced with a more fitting style
Updated: The setting for opening the layout folder after saving has been replaced with opening the layout file itself in your default editor
Updated: The "Return to editor" button is now hidden on the first startup
Updated: Moved some entries from the "Editor" menu item to "Help"
Updated: Reduced the show delay for issue card tooltips
Updated: When trying to close the editor with unsaved changes, the window will jump into the foreground (useful when closing the editor through the taskbar)
Updated: The setting for opening the layout folder after saving has been replaced with opening the layout file itself in your default editor
Updated: All entries for duplicate seats (duplicate economy, duplicate first class, etc) have been merged into one entry, since SLC requires unique seat numbers and -letters across all seats
Updated: The default Windows title bar is gone, and has been replaced with a more fitting replacement
Fixed: Fixed a small error in the select rows/columns animation
Fixed: When switching into slot automation mode while a single slot was selected, the slot details text was still shown
Fixed: Reloading a layout from disk without making any changes to it would crash the editor
Expand Down

0 comments on commit 13d20d3

Please sign in to comment.