From 5e4907479b3eaea58e4c68cfdca16d0e44bb0b8d Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 14 Apr 2026 13:08:38 +0200 Subject: [PATCH] - Aggiunta Copy per Inglesina - Iniziato a sistemare per converisone dimensione Inglesina --- Test.UI/Components/Pages/EditJWD.razor.cs | 2 +- Test.UI/Data/AntaDoppiaInglesine.jwd | 6 +- WebWindowComplex/Compo/AreaSash.razor | 3 + WebWindowComplex/Compo/CardInglesina.razor | 12 +- WebWindowComplex/Compo/CardSplit.razor.cs | 28 ++-- WebWindowComplex/Models/Area.cs | 139 +++++++++++++++--- WebWindowComplex/Models/Fill.cs | 8 + WebWindowComplex/Models/Inglesina.cs | 34 +++++ WebWindowComplex/Models/Split.cs | 34 ++--- WebWindowComplex/WebWindowComplex.csproj | 10 +- .../WebWindowConfigurator.csproj | 42 +++++- 11 files changed, 259 insertions(+), 59 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 4d38066..05ca811 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -250,7 +250,7 @@ namespace Test.UI.Components.Pages { string fullPath = Path.Combine("Data", "AntaDoppia.jwd"); return File.ReadAllText(fullPath); - //return File.ReadAllText("Data\\AntaDoppia.jwd"); + //return File.ReadAllText("Data\\AntaDoppiaInglesine.jwd"); } } } diff --git a/Test.UI/Data/AntaDoppiaInglesine.jwd b/Test.UI/Data/AntaDoppiaInglesine.jwd index 6e18c07..a4aafdd 100644 --- a/Test.UI/Data/AntaDoppiaInglesine.jwd +++ b/Test.UI/Data/AntaDoppiaInglesine.jwd @@ -167,6 +167,7 @@ "GroupId": 4, "AreaList": [ { + "Side": "BOTH", "SplitShape": "HORIZONTAL", "SplitStartVert": false, "SplitVertList": [], @@ -192,7 +193,7 @@ ], "GroupId": 7, "AreaList": [], - "AreaType": "SPLIT" + "AreaType": "INGLESINA" } ], "AreaType": "FILL" @@ -208,6 +209,7 @@ "GroupId": 6, "AreaList": [ { + "Side": "BOTH", "SplitShape": "HORIZONTAL", "SplitStartVert": false, "SplitVertList": [], @@ -233,7 +235,7 @@ ], "GroupId": 8, "AreaList": [], - "AreaType": "SPLIT" + "AreaType": "INGLESINA" } ], "AreaType": "FILL" diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index b81e1a8..a062fd5 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -111,6 +111,9 @@
+ } + @if (!User && CurrAnta.AreaList[0].AreaList.Count == 0) + {
diff --git a/WebWindowComplex/Compo/CardInglesina.razor b/WebWindowComplex/Compo/CardInglesina.razor index 141aca2..7da9fe2 100644 --- a/WebWindowComplex/Compo/CardInglesina.razor +++ b/WebWindowComplex/Compo/CardInglesina.razor @@ -26,12 +26,16 @@ -
-
Inglesina
+
+
+
Inglesina
+
@if (!User) { -
- +
+
+ +
}
diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 7df3a77..cd84723 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -264,20 +264,20 @@ namespace WebWindowComplex.Compo } } - protected async Task UpdateSplit(DataUpdateSplit updRec) - { - if (updRec.currSplit != null) - { - CurrSplit = updRec.currSplit; - var args = new DataUpdateSplit() - { - currSplit = CurrSplit, - noSvg = updRec.noSvg - }; - //await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape }); - await EC_UpdateSplit.InvokeAsync(args); - } - } + //protected async Task UpdateSplit(DataUpdateSplit updRec) + //{ + // if (updRec.currSplit != null) + // { + // CurrSplit = updRec.currSplit; + // var args = new DataUpdateSplit() + // { + // currSplit = CurrSplit, + // noSvg = updRec.noSvg + // }; + // //await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape }); + // await EC_UpdateSplit.InvokeAsync(args); + // } + //} /// /// Metodo per cambiare la dimensione principale diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 868d5b6..eccd541 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -1,4 +1,5 @@ using System.Linq; +using WebWindowComplex.Compo; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -281,9 +282,11 @@ namespace WebWindowComplex.Models if (node != null) { if (node.AreaType.Equals(AreaTypes.SASH)) - UpdateDimSubArea((Sash)node, dim, nameDim); + UpdateSash((Sash)node, dim, nameDim); else if (node.AreaType.Equals(AreaTypes.SPLIT)) - UpdateDimSubArea((Split)node, dim, nameDim); + UpdateSplit((Split)node, dim, nameDim); + else if (node.AreaType.Equals(AreaTypes.INGLESINA)) + UpdateSplit((Inglesina)node, dim, nameDim); for (int i = 0; i < node.AreaList.Count; i++) { if (node.AreaType.Equals(AreaTypes.SASH)) @@ -295,36 +298,36 @@ namespace WebWindowComplex.Models dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if (nameDim.Equals("Width") && s.SashList.First().ElementDimensionList.Count > 0) { - + if (s.ParentArea.ParentArea is Split) - dimTot = dim + s.SashList.First().ElementDimensionList.Last().dOverlap + dimTot = dim + s.SashList.First().ElementDimensionList.Last().dOverlap + s.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap; double widthAnta = s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dimTot); - if(s.bIsDimensionLight || s.AreaList.ElementAt(i) is Split) + if (s.bIsDimensionLight || s.AreaList.ElementAt(i) is Split) widthAnta = widthAnta - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - else if(s.AreaList.ElementAt(i).AreaList != null || s.AreaList.ElementAt(i).AreaList.Count > 0) + - s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else if (s.AreaList.ElementAt(i).AreaList != null || s.AreaList.ElementAt(i).AreaList.Count > 0) { - if(s.AreaList.ElementAt(i).AreaList.FirstOrDefault() is Split) + if (s.AreaList.ElementAt(i).AreaList.FirstOrDefault() is Split) widthAnta = widthAnta - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + - s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; } SearchAreaList(node.AreaList.ElementAt(i), widthAnta, nameDim); } - else if(s.SashList.First().ElementDimensionList.Count > 0) + else if (s.SashList.First().ElementDimensionList.Count > 0) { - if(s.ParentArea is Split split && split.SplitHorizList.Count > 0) + if (s.ParentArea is Split split && split.SplitHorizList.Count > 0) dimTot = dimTot + s.SashList.ElementAt(i).ElementDimensionList.First().dOverlap - + s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap; - if(s.SashBottomRailQty > 0) + + s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap; + if (s.SashBottomRailQty > 0) { foreach (var bottomRail in s.BottomRailElemDimList) dimTot = dimTot - bottomRail.dDimension - + bottomRail.dOverlap; + + bottomRail.dOverlap; } dimTot = dimTot - s.SashList.ElementAt(i).ElementDimensionList.First().dDimension - - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension; + - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension; SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim); } } @@ -339,9 +342,9 @@ namespace WebWindowComplex.Models dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if (nameDim.Equals("Width")) { - if(s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null) + if (s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null) dimTot = dimTot + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap - + sash.SashList.First().ElementDimensionList.Last().dOverlap; + + sash.SashList.First().ElementDimensionList.Last().dOverlap; SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim); } else @@ -369,6 +372,108 @@ namespace WebWindowComplex.Models } } + public void UpdateSash(Sash sash, double dim, string nameDim) + { + if (nameDim.Equals("Width")) + { + int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count(); + int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count(); + int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count(); + List dimList = new(); + Split split = new Split(null, null); + if (sash.ParentArea.ParentArea is Split) + split = (Split)sash.ParentArea.ParentArea; + if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) + { + Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) + { + foreach (var i in frame.DimensionList) + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); + } + } + else + { + foreach (var i in split.SplitVertList) + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); + } + if (countAbsolute == sash.SashList.Count) + { + double sum = sash.SashList.Sum(x => x.dDimension); + if ((sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) + { + for (int i = 1; i < sash.SashList.Count; i++) + dim = dim + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + else if (sash.ParentArea.ParentArea is Split && split.SplitVertList.Count > 0) + { + dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap + + sash.SashList.First().ElementDimensionList.Last().dOverlap; + } + if (sash.bIsDimensionLight) + { + dim = dim - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.First().ElementDimensionList.Last().dDimension; + for (int i = 1; i < sash.SashList.Count; i++) + dim = dim - sash.SashList[i].ElementDimensionList.ElementAt(1).dDimension + - sash.SashList[i].ElementDimensionList.Last().dDimension + + sash.SashList[i].ElementDimensionList.Last().dOverlap; + } + else if (sash.SashList.Count > 1) + { + for (int i = 1; i < sash.SashList.Count; i++) + dim = dim + sash.SashList[i].ElementDimensionList.Last().dOverlap; + } + double res = dim - sum; + foreach (var sashDim in sash.SashList) + sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); + } + else if (countAbsolute < sash.SashList.Count && countPercentage != sash.SashList.Count && countProportional != sash.SashList.Count) + { + if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0) + { + double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension); + var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList(); + foreach (var i in percentageList) + i.SetDimension(i.ConvertAbsoluteIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim)); + } + } + } + } + + public void UpdateSplit(Split split, double dim, string nameDim) + { + List splitList = new(); + List elemList = new(); + double sum = 0; + if (nameDim.Equals("Width")) + { + splitList = split.SplitVertList; + elemList = split.ElemDimVertList; + } + else + { + splitList = split.SplitHorizList; + elemList = split.ElemDimHorizList; + } + int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count(); + if (countAbsolute != 0 && countAbsolute == splitList.Count) + { + sum = sum + splitList.Sum(x => x.dDimension); + List dimensionList = new(); + foreach (var i in splitList) + dimensionList.Add(new AreaDimension(i.dDimension, i.MeasureType, i.Parent)); + double widthGlass = dim; + foreach (var item in elemList) + widthGlass = widthGlass - item.dDimension; + foreach (var item in splitList) + { + double widthPerc = item.ConvertDimension(dimensionList, item.MeasureType, MeasureTypes.PERCENTAGE, sum, splitList.IndexOf(item)); + item.SetDimension(widthGlass * widthPerc / 100); + } + } + } + public void UpdateDimSubArea(Area area, double dim, string nameDim) { if (area is Sash sash && nameDim.Equals("Width")) diff --git a/WebWindowComplex/Models/Fill.cs b/WebWindowComplex/Models/Fill.cs index 83de8ac..29e9e4a 100644 --- a/WebWindowComplex/Models/Fill.cs +++ b/WebWindowComplex/Models/Fill.cs @@ -65,6 +65,14 @@ namespace WebWindowComplex.Models newFill.SetGroupId(nCounterGroup); newFill.SetFillType(SelFillType); newFill.SetAreaType(AreaType); + if(AreaList != null && AreaList.Count > 0) + { + foreach (var item in AreaList) + { + Area newArea = item.Copy(newFill); + newFill.AreaList.Add(newArea); + } + } return newFill; } diff --git a/WebWindowComplex/Models/Inglesina.cs b/WebWindowComplex/Models/Inglesina.cs index 10518c6..37dbd54 100644 --- a/WebWindowComplex/Models/Inglesina.cs +++ b/WebWindowComplex/Models/Inglesina.cs @@ -60,6 +60,40 @@ namespace WebWindowComplex.Models return inglesina; } + public override Inglesina Copy(Area newParentArea) + { + Inglesina newInglesina = new Inglesina(newParentArea, m_ParentWindow); + AddCounterGroup(); + newInglesina.SetGroupId(nCounterGroup); + newInglesina.SetSelSide(m_SelSide); + newInglesina.SetSplitStartVert(bSplitStartVert); + for (int i = 0; i < SplitVertList.Count; i++) + newInglesina.SplitVertList.Add(SplitVertList[i].Copy()); + for (int i = 0; i < SplitHorizList.Count; i++) + newInglesina.SplitHorizList.Add(SplitHorizList[i].Copy()); + newInglesina.SetSplitShape(SelSplitShape); + newInglesina.SetAreaType(AreaType); + foreach (var item in ElemDimHorizList) + { + SplitElementDimension newElementDimension = item.Copy(); + newInglesina.ElemDimHorizList.Add(newElementDimension); + } + foreach (var item in ElemDimVertList) + { + SplitElementDimension newElementDimension = item.Copy(); + newInglesina.ElemDimVertList.Add(newElementDimension); + } + if (AreaList != null && AreaList.Count > 0) + { + foreach (var item in AreaList) + { + Area a = item.Copy(newInglesina); + newInglesina.AreaList.Add(a); + } + } + return newInglesina; + } + internal void SetSelSide(SideInglesina side) { m_SelSide = side; diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index c72e795..d9b5fc8 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -630,14 +630,14 @@ namespace WebWindowComplex.Models /// internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res) { + if (area.Equals(this)) + { + res.m_Dimension = height; + res.m_Found = true; + return res; + } for (int i = 0; i < area.AreaList.Count; i++) { - if (area.Equals(this)) - { - res.m_Dimension = height; - res.m_Found = true; - return res; - } Area item = area.AreaList[i]; if (area is Split split) { @@ -733,14 +733,14 @@ namespace WebWindowComplex.Models /// internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res) { + if (area.Equals(this)) + { + res.m_Dimension = width; + res.m_Found = true; + return res; + } for (int i = 0; i < area.AreaList.Count; i++) { - if (area.Equals(this)) - { - res.m_Dimension = width; - res.m_Found = true; - return res; - } Area item = area.AreaList[i]; if (area is Split split) { @@ -791,17 +791,13 @@ namespace WebWindowComplex.Models double widthTot = width; double dim = 0; if (sash.ParentArea.ParentArea is Split) - widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap - + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; if (sash.bIsDimensionLight) { - widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.First().ElementDimensionList.Last().dDimension; + widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension - sash.SashList.First().ElementDimensionList.Last().dDimension; for (int anta = 1; anta < sash.SashList.Count; anta++) { - widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension - + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; + widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; } } else diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 9524038..c6af589 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.4.1313 + 3.1.4.1413 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -122,6 +122,14 @@ + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index f1741c2..6115a5d 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.4.1313 + 3.1.4.1413 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -171,6 +171,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +