From 8c59d127d9180cf98e2b1818c7b99cf9ec7bb218 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 12 Mar 2026 18:40:44 +0100 Subject: [PATCH] - Aggiunti bottoni aggiuni ed elimina nella tabella - Joint sash per archi gestiti in automatico di tipo Angled --- WebWindowComplex/Compo/CardTree.razor | 45 ++++- WebWindowComplex/Compo/CardTree.razor.cs | 165 ++++++++++++++++- WebWindowComplex/Models/Area.cs | 20 +- WebWindowComplex/Models/AreaDimension.cs | 14 +- WebWindowComplex/Models/Frame.cs | 15 ++ WebWindowComplex/Models/Sash.cs | 171 ++---------------- WebWindowComplex/TableComp.razor | 12 +- WebWindowComplex/TableComp.razor.cs | 2 +- WebWindowComplex/WebWindowComplex.csproj | 3 +- .../WebWindowConfigurator.csproj | 6 +- 10 files changed, 282 insertions(+), 171 deletions(-) diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index da9a186..d1a7a68 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -71,6 +71,49 @@ } + @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME && + ((SashList.Count == 0 && SplitList.Count == 0) || !(FrameWindow.AreaList.First() is Split))) + { + + } + @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL && SplittedList != null && SplittedList.Count > 0) + { + int currIndexFill = ItemTableList[i].IndexItem; + Splitted? currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currIndexFill])).FirstOrDefault(); + @if (currSplitted != null) + { + @if (currSplitted.ParentArea != null && currSplitted.ParentWindow != null) + { + + } + } + } @*
@@ -84,7 +127,7 @@ } else { - @* @FillTable(i, j) *@ + @* @FillTable(i, j) *@ } } diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index e4543b5..ab1a78c 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using WebWindowComplex.Models; using static WebWindowComplex.LayoutConst; namespace WebWindowComplex.Compo @@ -34,6 +30,36 @@ namespace WebWindowComplex.Compo [Parameter] public Dictionary ChildDict { get; set; } = new Dictionary(); + /// + /// Lista di sash + /// + [Parameter] + public List SashList { get; set; } = null!; + + /// + /// Lista di split + /// + [Parameter] + public List SplitList { get; set; } = null!; + + /// + /// Lista di splitted + /// + [Parameter] + public List SplittedList { get; set; } = null!; + + /// + /// Lista di fill + /// + [Parameter] + public List FillList { get; set; } = null!; + + /// + /// Lista di sash + /// + [Parameter] + public Frame FrameWindow { get; set; } = null!; + /// /// Evento richiesta prossimo step /// @@ -52,6 +78,44 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback> EC_Collapsed { get; set; } + /// + /// Evento per richiedere reset dizionari + /// + [Parameter] + public EventCallback EC_ReqResetDict { get; set; } + + /// + /// Evento per richiedere opzioni hardware + /// + [Parameter] + public EventCallback EC_ReqOptionHw { get; set; } + + /// + /// Evento per richiesta profili degli Element + /// + [Parameter] + public EventCallback EC_ReqElement { get; set; } + + /// + /// Evento per richiesta calcolo preview + /// + [Parameter] + public EventCallback EC_UpdateFrame { get; set; } + + /// + /// Evento per aggiungere Sash + /// + [Parameter] + public EventCallback EC_UpdateSplitted { get; set; } + + protected override void OnParametersSet() + { + for(int i = 0; i < FillList.Count; i++) + { + isOpenFill.Add(false); + } + } + /// /// Metodo per richiesta prossimo step /// @@ -82,7 +146,7 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per rimuovere area + /// Metodo per rimuovere area (sash group o split) /// /// /// @@ -97,6 +161,81 @@ namespace WebWindowComplex.Compo return EC_Remove.InvokeAsync(Args); } + /// + /// Chiamata per aggiungere sash al frame + /// + /// + private async Task RaiseAddSash() + { + FrameWindow.AddFirstSash(); + await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow, + svgNoHw = true + }; + await EC_ReqElement.InvokeAsync(FrameWindow); + await EC_UpdateFrame.InvokeAsync(args); + } + + /// + /// Chiamata per aggiungere split al frame + /// + /// + private async Task RaiseAddSplit() + { + FrameWindow.AddSplit(); + Split s = (Split)FrameWindow.AreaList[0]; + foreach(var item in s.AreaList) + { + if (item.AreaList.FirstOrDefault() is Fill) + isOpenFill.Add(false); + } + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow, + svgNoHw = true + }; + await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape }); + if (SashList.Count > 0) + await EC_ReqOptionHw.InvokeAsync(FrameWindow); + await EC_ReqElement.InvokeAsync(FrameWindow); + await EC_UpdateFrame.InvokeAsync(args); + } + + /// + /// Chiamata per aggiungere sash in un fill + /// + /// indice del fill + /// + private Task AddSashIntoFill(int currIndexFill) + { + Splitted? currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currIndexFill])).FirstOrDefault(); + if (currSplitted != null) + currSplitted.AddFirstSash(); + return EC_UpdateSplitted.InvokeAsync(currSplitted); + } + + /// + /// Chiamata per copiare sash in fill + /// + /// indice della sash da copiare + /// indice del fill + /// + private Task CopySashIntoFill(int indexCurrSash, int currIndexFill) + { + Splitted? currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currIndexFill])).FirstOrDefault(); + if (currSplitted != null) + { + currSplitted.AreaList.RemoveAll(i => i != null); + Area a = SashList[indexCurrSash].Copy(currSplitted); + a.SetParentArea(currSplitted); + currSplitted.AreaList.Add(a); + } + return EC_UpdateSplitted.InvokeAsync(currSplitted); + } + /// /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura /// @@ -201,6 +340,20 @@ namespace WebWindowComplex.Compo } return false; } + + private bool isOpenFrame = false; + + private void ToggleDropdownFrame() + { + isOpenFrame = !isOpenFrame; + } + + private List isOpenFill = new(); + + private void ToggleDropdownFill(int currIndexFill) + { + isOpenFill[currIndexFill] = !isOpenFill.ElementAt(currIndexFill); + } } /// diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index aa549ef..346afa0 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -1,4 +1,5 @@ -using WebWindowComplex.Json; +using System.Linq; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models @@ -100,9 +101,9 @@ namespace WebWindowComplex.Models public void AddFirstSash() { // Salvo il parent + Frame? f = null; if(this is Frame || ParentArea.AreaList.Last().Equals(this)) { - Frame? f = null; if (this is Frame) f = (Frame)this; else @@ -116,6 +117,21 @@ namespace WebWindowComplex.Models SashArea.SetSelFamilyHardware(""); // Inserisco hardware di default SashArea.SetSelHardwareFromId("000000"); + if(f != null && (f.SelShapeIndex == (int)Shapes.ARC + || f.SelShapeIndex == (int)Shapes.DOUBLEARC + || f.SelShapeIndex == (int)Shapes.ARC_FULL + || f.SelShapeIndex == (int)Shapes.THREECENTERARC)) + { + if(SashArea.SashList.FirstOrDefault() != null) + { + int joint = SashArea.SashList.FirstOrDefault()!.JointList.Count - 1; + SashArea.SashList.FirstOrDefault()!.JointList.ElementAt(joint).SelJointTypeIndex = (int) Joints.ANGLED; + } + if (SashArea.SashList.LastOrDefault() != null) + { + SashArea.SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED; + } + } //if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC || // ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC || // ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL || diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index 9cb4079..45135eb 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -220,7 +220,7 @@ namespace WebWindowComplex.Models else { for(int i = 0; i < itemList.Count; i++) - ans.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcdList.FirstOrDefault()); + ans.ElementAt(i).SetDimension(Math.Round(absoluteValue.ElementAt(i) / mcdList.FirstOrDefault())); } //int inedMin = absoluteValue.IndexOf(absoluteValue.Min()); @@ -238,14 +238,14 @@ namespace WebWindowComplex.Models if (absoluteValue.ElementAt(indexArea) <= absoluteValue.ElementAt(i)) { var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i)); - ans.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); - ans.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); + ans.ElementAt(i).SetDimension(Math.Round(absoluteValue.ElementAt(i) / mcd)); + ans.ElementAt(indexArea).SetDimension(Math.Round(absoluteValue.ElementAt(indexArea) / mcd)); } else { var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i)); - ans.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd); - ans.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd); + ans.ElementAt(i).SetDimension(Math.Round(absoluteValue.ElementAt(i) / mcd)); + ans.ElementAt(indexArea).SetDimension(Math.Round(absoluteValue.ElementAt(indexArea) / mcd)); } break; } @@ -351,11 +351,11 @@ namespace WebWindowComplex.Models if (sumPesi == 0) sumPesi = 1; if (newType.Equals(MeasureTypes.ABSOLUTE)) { - return res / sumPesi * dDimension; + return Math.Round(res / sumPesi * dDimension, 2); } else { - return (res / sumPesi * dDimension) / tot * 100; + return Math.Round((res / sumPesi * dDimension) / tot * 100); } } diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index f2ed452..a32c988 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -1,4 +1,5 @@ using Egw.Window.Data; +using System.ComponentModel.Design; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -323,6 +324,20 @@ namespace WebWindowComplex.Models JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType)); JointList.Add(new Joint(this, 3, Joints.ANGLED)); JointList.Add(new Joint(this, 4, Joints.ANGLED)); + Sash? SashArea = null; + if(AreaList.First() is Sash) + SashArea = (Sash)AreaList.First(); + else if (AreaList.First().AreaList.Last().AreaList.First() is Sash) + SashArea = (Sash)AreaList.First().AreaList.Last().AreaList.First(); + if (SashArea != null && SashArea.SashList.FirstOrDefault() != null) + { + int joint = SashArea.SashList.FirstOrDefault()!.JointList.Count - 1; + SashArea.SashList.FirstOrDefault()!.JointList.ElementAt(joint).SelJointTypeIndex = (int)Joints.ANGLED; + } + if (SashArea != null && SashArea.SashList.LastOrDefault() != null) + { + SashArea.SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED; + } break; } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index d422fb4..4af769d 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -99,157 +99,6 @@ namespace WebWindowComplex.Models } } - //public int nSashQty - //{ - // get - // { - // return m_SashList.Count > 0 ? m_SashList.Count : 1; - // } - // set - // { - // if (value > 0 && value <= 3) - // { - // double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension); - // if (value > m_SashList.Count) - // { - // // recupero larghezza ultimo - // double dLastDimension = widthTot; - // double dNewDimension = widthTot; - // if (m_SashList.Count > 0) - // { - // dLastDimension = m_SashList[m_SashList.Count - 1].dDimension; - // dNewDimension = dLastDimension / (value + 1 - nSashQty); - // if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) - // dNewDimension = 1; - // m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension); - // } - // else - // dNewDimension = dLastDimension / (value + 1 - nSashQty); - // // aggiungo area Sash di default - // for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++) - // { - // var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1); - // for(int i = 1; i <= 4; i++) - // { - // addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_V)); - // } - // SashList.Add(addSashDim); - // } - // } - // else if (value < m_SashList.Count) - // { - // if (value > 0) - // { - // double dLastDimension = 0; - // SashDimension itemDelete = null; - // double deleteDim; - // for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1) - // { - // //dLastDimension += m_SashList[SplitIndex].dDimension; - // itemDelete = m_SashList[SplitIndex]; - // SashList.RemoveAt(SplitIndex); - // } - // if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType)) - // { - // AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType); - // List adList = new List(); - // foreach (var it in SashList) - // { - // adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); - // } - // deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete)); - // } - // //deleteDim = Convert.ConvertDimension(itemDelete, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, itemDelete.dDimension, widthTot); - // else - // deleteDim = itemDelete.dDimension; - // //dLastDimension += m_SashList[SashList.Count - 1].dDimension; - // dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; - // SashList[SashList.Count - 1].SetDimension(dLastDimension); - // if (value == 1) - // SashList.First().SetHasHandle(true); - // } - // else - // { - // SashList.RemoveAt(0); - // } - // } - // if (m_SashList.Count == 0) - // { - // Area child = AreaList.First(); - // // Se nella singola anta ho uno split - // if (!(child is Fill)) - // { - // child = child.AreaList.First().AreaList.First(); - // } - // child.SetParentArea(this.ParentArea); - // this.ParentArea.AreaList.Remove(this); - // this.ParentArea.AreaList.Add(child); - // } - // // Se ho singola anta - // else if (m_SashList.Count == 1) - // { - // // Metto come padre dell'area nello splitted l'anta stessa - // List ContentArea = new List(); - // ContentArea.Add(AreaList.First().AreaList.First()); - // ContentArea.First().SetParentArea(this); - // AreaList.Clear(); - // AreaList.Add(ContentArea.First()); - // } - // else - // { - // // Se aggiungo ante - // if (SashList.Count > AreaList.Count) - // { - // List ContentArea = new List(); - // // Salvo in ContentArea il sottoalbero delle singole aree che mantengo - // if (AreaList.Count >= 1 & SashList.Count > AreaList.Count) - // { - // foreach (Area area in AreaList) - // { - // if (area is Splitted) - // ContentArea.Add(area.AreaList.First()); - // else - // ContentArea.Add(area); - // } - // AreaList.Clear(); - // } - // for (int SplitIndex = AreaList.Count; SplitIndex <= SashList.Count - 1; SplitIndex++) - // { - // AreaList.Add(Splitted.CreateSplitted(this)); - // } - // // Riaggiungo i sottoalberi che avevo salvato - // for (int i = 0; i < AreaList.Count - 1; i++) - // { - // if (AreaList.Count == 2) - // { - // ContentArea[i].SetParentArea(AreaList[i]); - // } - // AreaList[i].AreaList.Add(ContentArea[i]); - // } - // // Aggiungo all'ultimo Splitted l'area di vetro - // Fill newFill = Fill.CreateFill(AreaList[1], FillTypes.GLASS); - // newFill.SetAreaType(AreaTypes.FILL); - // AreaList[AreaList.Count - 1].AreaList.Add(newFill); - // } - // // Se tolgo anta - // else - // { - // for (int SplitIndex = SashList.Count; SplitIndex <= AreaList.Count() - 1; SplitIndex++) - // { - // AreaList.Remove(AreaList[AreaList.Count - 1]); - // break; - // } - // } - // } - // for (int i = 0; i < AreaList.Count; i++) - // AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SashList.ElementAt(i).dDimension, "Width"); - // } - // RefreshHardwareList(); - // ClearHardwareOptionList(); - // SetFirstHardware(); - // } - //} - public int nSashQty { get @@ -307,6 +156,16 @@ namespace WebWindowComplex.Models } SashList.Add(addSashDim); } + if (frame != null && (frame.SelShapeIndex == (int)Shapes.ARC + || frame.SelShapeIndex == (int)Shapes.DOUBLEARC + || frame.SelShapeIndex == (int)Shapes.ARC_FULL + || frame.SelShapeIndex == (int)Shapes.THREECENTERARC)) + { + if (SashList.ElementAt(value - 2) != null) + SashList.ElementAt(value - 2)!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.FULL_V; + if (SashList.LastOrDefault() != null) + SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED; + } } else if (value < m_SashList.Count) { @@ -356,6 +215,16 @@ namespace WebWindowComplex.Models { SashList.RemoveAt(0); } + if (frame != null && (frame.SelShapeIndex == (int)Shapes.ARC + || frame.SelShapeIndex == (int)Shapes.DOUBLEARC + || frame.SelShapeIndex == (int)Shapes.ARC_FULL + || frame.SelShapeIndex == (int)Shapes.THREECENTERARC)) + { + if (SashList.LastOrDefault() != null) + { + SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED; + } + } } if (m_SashList.Count == 0) { diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index eb7b669..1582d67 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -103,9 +103,19 @@ maxCol="m_maxCol" RowCollapsedDict="RowCollapsed" ChildDict="Child" + SashList="SashList" + SplitList="SplitList" + SplittedList="SplittedList" + FillList="FillList" + FrameWindow="FrameWindow" EC_NextStep="NextStepArgs" + EC_Remove="RemoveArea" EC_Collapsed="CollapsedRowTree" - EC_Remove="RemoveArea"> + EC_ReqResetDict="ReqResetDict" + EC_ReqOptionHw="UpdateHwOptionsFrame" + EC_ReqElement="UpdateElementFrame" + EC_UpdateFrame="UpdatePreviewFrame" + EC_UpdateSplitted="UpdatePreviewSplitted"> } else if (currStep == CompileStep.Frame) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index d1c6d2f..07bdd96 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -1758,7 +1758,7 @@ namespace WebWindowComplex } /// - /// Aggiornamento Element a casua di un cambiamento nel frame + /// Aggiornamento Element a causa di un cambiamento nel frame /// /// nuovo frame /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 1f4b9ce..5e47747 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1016 + 3.1.3.1218 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -332,5 +332,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index e1403c8..e34c3b1 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1016 + 3.1.3.1218 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -380,6 +380,10 @@ + + + +