Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ""Partition" line as dominant is case if all lines are "Partition" to prevent exception #92

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
public static List<RoomEdge> DeduplicateWallLines(List<InteriorPartitionCandidate> interiorPartitionCandidates)
{
return interiorPartitionCandidates.SelectMany(i => i.WallCandidateLines).Where(l => l.Type != null && interiorPartitionTypePriority.Keys.Contains(l.Type)).ToList();
var resultCandidates = new List<RoomEdge>();

Check warning on line 118 in LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected

Check warning on line 118 in LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected
var typedLines = interiorPartitionCandidates.SelectMany(c => c.WallCandidateLines)
.Where(l => l.Type != null && interiorPartitionTypePriority.Keys.Contains(l.Type));
var collinearLinesGroups = GroupCollinearLines(typedLines);
Expand Down Expand Up @@ -272,7 +272,13 @@
resultCandidates.Add(candidate);
continue;
}
var linesOrderedByLength = collinearLinesGroup.Value.Where(x => !x.Item2.Contains("Partition")).OrderByDescending(v => v.Line.Length());
var filteredLines = collinearLinesGroup.Value.Where(x => !x.Item2.Contains("Partition"));
if (!filteredLines.Any())
{
filteredLines = collinearLinesGroup.Value;
}

var linesOrderedByLength = filteredLines.OrderByDescending(v => v.Line.Length());

var dominantLineForGroup = linesOrderedByLength.FirstOrDefault(x => x.PrimaryEntryEdge == true);

Expand Down
Loading