@model FloorPlanEditorViewModel
@{
ViewData["Title"] = Model.FloorPlan.FloorPlanID == 0 ? "New Floor Plan" : Model.FloorPlan.Name;
ViewData["ProjectSection"] = "Floor Plans";
var activeFloor = Model.Floors.OrderBy(x => x.SortOrder).ThenBy(x => x.Name).FirstOrDefault();
var blocksByFloor = Model.Blocks.GroupBy(x => x.FloorPlanFloorID).ToDictionary(x => x.Key, x => x.ToList());
var transitionsByFloor = Model.Transitions.GroupBy(x => x.FloorPlanFloorID).ToDictionary(x => x.Key, x => x.ToList());
var selectedBlockId = int.TryParse(Context.Request.Query["selectedBlockId"], out var parsedSelectedBlockId) ? parsedSelectedBlockId : 0;
string BlockClass(string blockType) => $"floor-plan-block floor-plan-block--{blockType.ToLowerInvariant()}";
string CssNumber(decimal value) => value.ToString("0.###", System.Globalization.CultureInfo.InvariantCulture);
string TransitionDetails(FloorPlanTransitionEditViewModel transition)
{
var details = $"{transition.FromLocationName} -> {transition.ToLocationName}\n{transition.TransitionType}";
return string.IsNullOrWhiteSpace(transition.DisplayLabel) ? details : $"{details}\n{transition.DisplayLabel}";
}
string TransitionMarkerType(string? transitionType)
{
var normalized = (transitionType ?? string.Empty)
.Trim()
.Replace(" ", string.Empty, StringComparison.OrdinalIgnoreCase)
.Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase)
.ToLowerInvariant();
return normalized switch
{
"door" => "door",
"doubledoor" => "double-door",
"window" => "window",
"archway" or "opening" => "archway",
"secretdoor" or "hiddendoor" => "secret-door",
"blockeddoor" => "blocked-door",
"exteriordoor" => "exterior-door",
"stairs" or "stair" or "stairsup" or "stairsdown" => "stairs",
"passage" => "passage",
_ => "other"
};
}
string TransitionMarkerSvg(string markerType) => markerType switch
{
"door" => @"",
"double-door" => @"",
"window" => @"",
"archway" => @"",
"secret-door" => @"",
"blocked-door" => @"",
"exterior-door" => @"",
"stairs" => @"",
"passage" => @"",
_ => @"x"
};
var transitionPositions = FloorPlanTransitionPositions.All
.Select(x => new SelectListItem(x, x))
.ToList();
}
Location floor plan
Add a floor to start arranging linked locations.
Used to order floors and later to connect stairs up/down.