From 8949762c340ac53443e576c5a189fc34adad4a1b Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 17 Dec 2025 13:01:07 +0100 Subject: [PATCH] - Corretti nomi profili disponibili - Modifica tipi dimensione split - Modificati valori CalcUid e windowUid a valori random --- Test.UI/Components/Pages/EditJWD.razor.cs | 7 +- WebWindowComplex/Models/Area.cs | 51 ++++++++++- WebWindowComplex/Models/FrameDimension.cs | 29 +++---- WebWindowComplex/Models/Split.cs | 14 ++- WebWindowComplex/Models/SplitDimension.cs | 87 ++++++++++--------- WebWindowComplex/WebWindowComplex.csproj | 19 +++- .../WebWindowConfigurator.csproj | 20 ++++- 7 files changed, 158 insertions(+), 69 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index bb5d928..0932c07 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -87,9 +87,9 @@ namespace Test.UI.Components.Pages protected List AvailProfileList { get; set; } = new List() { - new string("Profilo60"), + new string("AlzanteScorrevole"), new string("Profilo78"), - new string("Profilo90") + new string("ProfiloSaomad") }; [Inject] @@ -127,6 +127,9 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); + Random random = new Random(); + CalcUid = Convert.ToString(random.Next(1000, 10000)); + windowUid = CalcUid; //InitialJwd = File.ReadAllText("Data\\FinestraSplitVert.jwd"); InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); //InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd"); diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index bf2e0a6..8925270 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -180,7 +180,54 @@ namespace WebWindowComplex.Models AreaList[0] = AreaList[1]; AreaList[1] = tempArea; } - //SearchAreaList(this, "Width"); + Frame f = ParentWindow.AreaList.First(); + switch (f.Shape) + { + case Shapes.RECTANGLE: + case Shapes.ARC_FULL: + case Shapes.TRIANGLE: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Height")).First().dDimension, "Height"); + break; + } + + case Shapes.RIGHTCHAMFER: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Left Height")).First().dDimension, "Left Height"); + break; + } + + case Shapes.LEFTCHAMFER: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Right Height")).First().dDimension, "Right Height"); + break; + } + + case Shapes.DOUBLECHAMFER: + case Shapes.ARC: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); + break; + } + + case Shapes.DOUBLEARC: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); + break; + } + + case Shapes.THREECENTERARC: + { + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, f.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); + break; + } + } } /// @@ -232,7 +279,7 @@ namespace WebWindowComplex.Models } } else - SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); + SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); } } } diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index d969a12..2235cef 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -54,11 +54,11 @@ namespace WebWindowComplex.Models } else { + var widthArea = (ParentFrame.DimensionList.First(x => x.sName.Equals("Width"))).m_dDimension; if (ParentFrame.SelShapeIndex == (int)Shapes.ARC_FULL) { - var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension; var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; - if (sName.Equals("Height") && value > 0.5 * width && value < MaxDim) + if (sName.Equals("Height") && value > 0.5 * widthArea && value < MaxDim) { m_dDimension = value; } @@ -69,32 +69,30 @@ namespace WebWindowComplex.Models } else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC) { - var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension; var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension; - if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim) + if (sName.Equals("Full Height") && (value - height) < 0.5 * widthArea && value < MaxDim) { - dDimension = value; + m_dDimension = value; } - else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim) + else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim) { - dDimension = value; + m_dDimension = value; } else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim) { - dDimension = value; + m_dDimension = value; } } else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC) { - var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension; - var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; + var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension; - if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim) + if (sName.Equals("Full Height") && (value - height) < 0.5 * widthArea && value < MaxDim) { m_dDimension = value; } - else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim) + else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim) { m_dDimension = value; } @@ -102,21 +100,20 @@ namespace WebWindowComplex.Models { m_dDimension = value; } - else if (sName.Equals("Radius") && value < 0.5 * width) + else if (sName.Equals("Radius") && value < 0.5 * widthArea) { m_dDimension = value; } } else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC) { - var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension; var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension; - if (sName.Equals("Full Height") && (value - height) > 0.5 * width && value < MaxDim) + if (sName.Equals("Full Height") && (value - height) > 0.5 * widthArea && value < MaxDim) { m_dDimension = value; } - else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * width && value < MaxDim) + else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * widthArea && value < MaxDim) { m_dDimension = value; } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 61eaf0e..617edd9 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -225,20 +225,18 @@ namespace WebWindowComplex.Models } if(SplitHorizList.Count > 0) { - int i = 0; - foreach (var item in AreaList) + for (int i = 0; i < AreaList.Count; i++) { - item.SearchAreaList(item, SplitHorizList.ElementAt(i).dDimension, "Width"); - i++; + if(i < SplitHorizList.Count) + AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitHorizList.ElementAt(i).dDimension, "Width"); } } if (SplitVertList.Count > 0) { - int i = 0; - foreach (var item in AreaList) + for (int i = 0; i < AreaList.Count; i++) { - item.SearchAreaList(item, SplitVertList.ElementAt(i).dDimension, "Height"); - i++; + if(i < SplitVertList.Count) + AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitVertList.ElementAt(i).dDimension, "Height"); } } } diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index cbea2e9..7348072 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -59,7 +59,7 @@ namespace WebWindowComplex.Models else { dimensions = m_Parent.SplitHorizList; - dimensionTot = CalculateHeightSplitGroup(m_Parent, HeightTot()); + dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new HeightFound(-1, false))).m_Height; } double valMinAbsolute = 100; double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1); @@ -217,24 +217,12 @@ namespace WebWindowComplex.Models item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot)); } } - foreach (var item in m_Parent.AreaList) + for (int i = 0; i < m_Parent.AreaList.Count; i++) { - if (m_Parent.SplitHorizList.Count > 0) - { - for (int i = 0; i < m_Parent.AreaList.Count(); i++) - { - item.SearchAreaList(item, m_Parent.SplitHorizList.ElementAt(i).dDimension, "Width"); - i++; - } - } - if (m_Parent.SplitVertList.Count > 0) - { - for (int i = 0; i < m_Parent.AreaList.Count(); i++) - { - item.SearchAreaList(item, m_Parent.SplitVertList.ElementAt(i).dDimension, "Height"); - i++; - } - } + if (m_Parent.SplitHorizList.Count > 0 && i < m_Parent.SplitHorizList.Count) + m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitHorizList.ElementAt(i).dDimension, "Height"); + if (m_Parent.SplitVertList.Count > 0 && i < m_Parent.SplitVertList.Count) + m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitVertList.ElementAt(i).dDimension, "Width"); } } } @@ -301,7 +289,7 @@ namespace WebWindowComplex.Models else { splitList = m_Parent.SplitHorizList; - tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot()); + tot = (CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot(), new HeightFound(-1, false))).m_Height; } AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); List adList = new List(); @@ -482,13 +470,19 @@ namespace WebWindowComplex.Models /// area di partenza /// altezza di partenza /// - internal double CalculateHeightSplitGroup(Area area, double height) + internal HeightFound CalculateHeightSplitGroup(Area area, double height, HeightFound res) { for (int i = 0; i < area.AreaList.Count; i++) { double risultato = -1; if (area.Equals(m_Parent)) - return height; + { + res.m_Height = height; + res.m_Found = true; + return res; + //foundObj = true; + //return height; + } Area item = area.AreaList[i]; if (area is Split) { @@ -499,7 +493,7 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUTE: { - risultato = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension); + res = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension, res); break; } case MeasureTypes.PROPORTIONAL: @@ -510,33 +504,35 @@ namespace WebWindowComplex.Models { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); } - risultato = CalculateHeightSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height)); + res = CalculateHeightSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height), res); break; } case MeasureTypes.PERCENTAGE: { - risultato = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100); + res = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100, res); break; } } - if (risultato != -1) - return risultato; + if (res.m_Height != -1 && res.m_Found) + return res; + //if (risultato != -1 && foundObj) + // return risultato; } else { - risultato = CalculateHeightSplitGroup(item, height); - if (risultato != -1) - return risultato; + res = CalculateHeightSplitGroup(item, height, res); + if (res.m_Height != -1 && res.m_Found) + return res; } } else { - risultato = CalculateHeightSplitGroup(item, height); - if (risultato != -1) - return risultato; + res = CalculateHeightSplitGroup(item, height, res); + if (res.m_Height != -1 && res.m_Found) + return res; } } - return height; + return res; } ///// @@ -757,7 +753,7 @@ namespace WebWindowComplex.Models } } else { - tot = CalculateHeightSplitGroup(m_Parent, HeightTot()); + tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new HeightFound(-1, false))).m_Height; AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); List newDimensions = new List(); foreach (var item in m_Parent.SplitHorizList) @@ -779,25 +775,26 @@ namespace WebWindowComplex.Models internal double HeightTot() { - switch (m_Parent.ParentWindow.AreaList.First().SelShapeIndex) + List frames = m_Parent.ParentWindow.AreaList; + switch (frames.First().SelShapeIndex) { case (int)Shapes.RECTANGLE: case (int)Shapes.TRIANGLE: case (int)Shapes.ARC_FULL: { - return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension); + return (CalculateHeightSplitGroup(frames.FirstOrDefault(), frames.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension, new HeightFound(-1, false))).m_Height; } case (int)Shapes.RIGHTCHAMFER: { - return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension); + return (CalculateHeightSplitGroup(frames.FirstOrDefault(), frames.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension, new HeightFound(-1, false))).m_Height; } case (int)Shapes.LEFTCHAMFER: { - return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension); + return (CalculateHeightSplitGroup(frames.FirstOrDefault(), frames.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension, new HeightFound(-1, false))).m_Height; } default: { - return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension); + return (CalculateHeightSplitGroup(frames.FirstOrDefault(), frames.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension, new HeightFound(-1, false))).m_Height; } } } @@ -826,4 +823,16 @@ namespace WebWindowComplex.Models #endregion Private Fields } + + public class HeightFound + { + public HeightFound(double height, bool found) + { + m_Height = height; + m_Found = found; + } + + public double m_Height { get; set; } = -1; + public bool m_Found { get; set; } = false; + } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 6ceb52a..3fa5e81 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.1518 + 2.7.12.1712 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -350,6 +350,23 @@ + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index fb8c56c..099158b 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.1518 + 2.7.12.1712 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -430,6 +430,24 @@ + + + + + + + + + + + + + + + + + +