From 83161fd2c4ffd0be408b84024367aaf7a8889805 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 16 Mar 2026 17:02:49 +0100 Subject: [PATCH] =?UTF-8?q?-=20Eliminazioni=20commenti=20-=20Eliminazione?= =?UTF-8?q?=20funzioni=20non=20pi=C3=B9=20usate=20-=20Eliminazione=20pagin?= =?UTF-8?q?e=20razor=20sostituite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebWindowComplex/Compo/AreaFrame.razor | 2 +- WebWindowComplex/Compo/AreaFrame.razor.cs | 4 +- WebWindowComplex/Compo/AreaSash.razor.cs | 34 +- WebWindowComplex/Compo/AreaSplit.razor | 4 +- WebWindowComplex/Compo/AreaSplit.razor.cs | 4 +- WebWindowComplex/Compo/CardFrame.razor | 23 +- WebWindowComplex/Compo/CardFrame.razor.cs | 19 +- WebWindowComplex/Compo/CardSashGroup.razor | 2 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 6 +- WebWindowComplex/Compo/CardSplit.razor.cs | 14 +- WebWindowComplex/Compo/CardTree.razor | 8 +- WebWindowComplex/Compo/CardTree.razor.cs | 6 +- WebWindowComplex/Compo/FrameBottomRail.razor | 20 - .../Compo/FrameBottomRail.razor.cs | 42 -- WebWindowComplex/Compo/SashBottomRail.razor | 20 - .../Compo/SashBottomRail.razor.cs | 42 -- WebWindowComplex/Models/Area.cs | 139 +---- WebWindowComplex/Models/AreaDimension.cs | 5 +- WebWindowComplex/Models/ElementDimension.cs | 11 +- WebWindowComplex/Models/Fill.cs | 37 +- WebWindowComplex/Models/Frame.cs | 23 +- WebWindowComplex/Models/FrameDimension.cs | 31 -- WebWindowComplex/Models/Sash.cs | 111 ++-- WebWindowComplex/Models/SashDimension.cs | 138 ++--- WebWindowComplex/Models/Split.cs | 312 ++++++++--- WebWindowComplex/Models/SplitDimension.cs | 491 +++++++++--------- WebWindowComplex/TableComp.razor | 19 +- WebWindowComplex/TableComp.razor.cs | 120 ++--- WebWindowComplex/WebWindowComplex.csproj | 4 +- .../WebWindowConfigurator.csproj | 9 +- 30 files changed, 781 insertions(+), 919 deletions(-) delete mode 100644 WebWindowComplex/Compo/FrameBottomRail.razor delete mode 100644 WebWindowComplex/Compo/FrameBottomRail.razor.cs delete mode 100644 WebWindowComplex/Compo/SashBottomRail.razor delete mode 100644 WebWindowComplex/Compo/SashBottomRail.razor.cs diff --git a/WebWindowComplex/Compo/AreaFrame.razor b/WebWindowComplex/Compo/AreaFrame.razor index ccb0c97..38788d6 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor +++ b/WebWindowComplex/Compo/AreaFrame.razor @@ -5,7 +5,7 @@
Area frame
- @if (SashList.Count == 0 && SplitList.Count == 0) + @if (SashGroupList.Count == 0 && SplitList.Count == 0) {
diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index 48180ac..5e39ecf 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -16,8 +16,8 @@ namespace WebWindowComplex.Compo /// /// Lista sash /// - [CascadingParameter(Name = "SashList")] - public List SashList { get; set; } = null!; + [CascadingParameter(Name = "SashGroupList")] + public List SashGroupList { get; set; } = null!; /// /// Lista split diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index baeef8f..37b6dcf 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -30,8 +30,8 @@ namespace WebWindowComplex.Compo /// /// Lista delle sash /// - [CascadingParameter(Name = "SashList")] - public List SashList { get; set; } = null!; + [CascadingParameter(Name = "SashGroupList")] + public List SashGroupList { get; set; } = null!; /// /// Livello di accesso (utente base) @@ -196,8 +196,32 @@ namespace WebWindowComplex.Compo /// private Task ChangeAllJoints(Json.WindowConst.Joints JointType) { - foreach (var item in CurrSashDim.JointList) - item.SelJointType = JointType; + for (int i = 0; i < CurrSashDim.JointList.Count; i++) + { + Frame? frame = CurrSashGroup.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null && (frame.Shape is Json.WindowConst.Shapes.ARC || + frame.Shape is Json.WindowConst.Shapes.ARC_FULL || + frame.Shape is Json.WindowConst.Shapes.DOUBLEARC || + frame.Shape is Json.WindowConst.Shapes.THREECENTERARC)) + { + if(CurrSashGroup.SashList.Count == 1) + { + if(i == 2 || i == CurrSashDim.JointList.Count - 1) + CurrSashDim.JointList.ElementAt(i).SelJointType = Joints.ANGLED; + else + CurrSashDim.JointList.ElementAt(i).SelJointType = JointType; + } + else + { + if (IndexSash == 0 && i == CurrSashDim.JointList.Count - 1) + CurrSashDim.JointList.ElementAt(i).SelJointType = Joints.ANGLED; + else if(IndexSash == CurrSashGroup.SashList.Count - 1 && i == 2) + CurrSashDim.JointList.ElementAt(i).SelJointType = Joints.ANGLED; + else + CurrSashDim.JointList.ElementAt(i).SelJointType = JointType; + } + } + } return EC_UpdateSashDim.InvokeAsync(CurrSashDim); } @@ -242,7 +266,7 @@ namespace WebWindowComplex.Compo private Task ChangeHandle() { // Cerco la Sash che si sta considerando nella lista Sash - var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault(); + var s = SashGroupList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault(); if (s != null) { // Setto la presenza o meno della maniglia per ogni anta diff --git a/WebWindowComplex/Compo/AreaSplit.razor b/WebWindowComplex/Compo/AreaSplit.razor index 2ec3b05..7d42284 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor +++ b/WebWindowComplex/Compo/AreaSplit.razor @@ -10,11 +10,11 @@
- @for (int j = 0; j < SashList.Count; j++) + @for (int j = 0; j < SashGroupList.Count; j++) { int Index = j;
- +
}
diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index a272dfa..e8178e8 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -12,7 +12,7 @@ namespace WebWindowComplex.Compo /// Lista delle sash /// [Parameter] - public List SashList { get; set; } = null!; + public List SashGroupList { get; set; } = null!; /// /// Oggetto splitted corrente @@ -44,7 +44,7 @@ namespace WebWindowComplex.Compo private Task RaiseCopySash(int indexCurrSash) { CurrSplitted.AreaList.RemoveAll(i => i != null); - Area a = SashList[indexCurrSash].Copy(CurrSplitted); + Area a = SashGroupList[indexCurrSash].Copy(CurrSplitted); a.SetParentArea(CurrSplitted); CurrSplitted.AreaList.Add(a); return EC_UpdateSplitted.InvokeAsync(CurrSplitted); diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index d55f2c0..749aa48 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -73,7 +73,7 @@
- @if (SashList.Count == 0) + @if (SashGroupList.Count == 0) {
Bottom rail
@@ -112,25 +112,6 @@
- @*
- -
- @if (ForceChangeAll) - { -
-
- -
-
- -
-
- -
-
- } *@ @*
[Parameter] - public List SashList { get; set; } = null!; + public List SashGroupList { get; set; } = null!; /// /// Lista di split @@ -198,7 +198,7 @@ namespace WebWindowComplex.Compo svgNoHw = true }; await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape }); - if (SashList.Count > 0) + if (SashGroupList.Count > 0) await EC_ReqOptionHw.InvokeAsync(FrameWindow); await EC_ReqElement.InvokeAsync(FrameWindow); await EC_UpdateFrame.InvokeAsync(args); @@ -229,7 +229,7 @@ namespace WebWindowComplex.Compo if (currSplitted != null) { currSplitted.AreaList.RemoveAll(i => i != null); - Area a = SashList[indexCurrSash].Copy(currSplitted); + Area a = SashGroupList[indexCurrSash].Copy(currSplitted); a.SetParentArea(currSplitted); currSplitted.AreaList.Add(a); } diff --git a/WebWindowComplex/Compo/FrameBottomRail.razor b/WebWindowComplex/Compo/FrameBottomRail.razor deleted file mode 100644 index 41ea75c..0000000 --- a/WebWindowComplex/Compo/FrameBottomRail.razor +++ /dev/null @@ -1,20 +0,0 @@ - - - \ No newline at end of file diff --git a/WebWindowComplex/Compo/FrameBottomRail.razor.cs b/WebWindowComplex/Compo/FrameBottomRail.razor.cs deleted file mode 100644 index ff50155..0000000 --- a/WebWindowComplex/Compo/FrameBottomRail.razor.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Components; -using WebWindowComplex.Models; - -namespace WebWindowComplex.Compo -{ - public partial class FrameBottomRail - { - #region Public Properties - - /// - /// Frame corrente - /// - [CascadingParameter(Name = "CurrFrameWindow")] - public Frame CurrFrame { get; set; } = null!; - - [Parameter] - public EventCallback EC_UpdateFrame { get; set; } - - #endregion Public Properties - - #region Private Properties - - /// - /// Aggiornamento element Bottom Rail - /// - /// - /// - private async Task UpdateElement(ElementDimension updRec) - { - // cerco il record - var currRec = CurrFrame.BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); - // lo aggiorno - if (updRec != null) - { - currRec = updRec; - await EC_UpdateFrame.InvokeAsync(CurrFrame); - } - } - - #endregion Private Properties - } -} \ No newline at end of file diff --git a/WebWindowComplex/Compo/SashBottomRail.razor b/WebWindowComplex/Compo/SashBottomRail.razor deleted file mode 100644 index de9ca4f..0000000 --- a/WebWindowComplex/Compo/SashBottomRail.razor +++ /dev/null @@ -1,20 +0,0 @@ - - - \ No newline at end of file diff --git a/WebWindowComplex/Compo/SashBottomRail.razor.cs b/WebWindowComplex/Compo/SashBottomRail.razor.cs deleted file mode 100644 index 4846335..0000000 --- a/WebWindowComplex/Compo/SashBottomRail.razor.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Components; -using WebWindowComplex.Models; - -namespace WebWindowComplex.Compo -{ - public partial class SashBottomRail - { - #region Public Properties - - /// - /// Sash corrente rispetto alla lista Sash - /// - [CascadingParameter(Name = "CurrSashGroup")] - public Sash SashGroup { get; set; } = null!; - - [Parameter] - public EventCallback EC_UpdateSash { get; set; } - - #endregion Public Properties - - #region Private Properties - - /// - /// Aggiornamento element - /// - /// - /// - private async Task UpdateElement(ElementDimension updRec) - { - // cerco il record - var currRec = SashGroup.BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); - // lo aggiorno - if (updRec != null) - { - currRec = updRec; - await EC_UpdateSash.InvokeAsync(SashGroup); - } - } - - #endregion Private Properties - } -} \ No newline at end of file diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 346afa0..835ce0e 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -131,12 +131,8 @@ namespace WebWindowComplex.Models { SashArea.SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED; } + // SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true); } - //if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC || - // ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC || - // ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL || - // ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC) - // SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true); //else // SashArea.SashArcElem = null; // Salvo gli oggetti già presenti e li cancello da AreaList @@ -188,7 +184,6 @@ namespace WebWindowComplex.Models Frame frame = ParentWindow.AreaList.First(); if(frame != null) { - //frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width"); frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height"); } } @@ -237,53 +232,32 @@ namespace WebWindowComplex.Models } } } + string heightName = "Height"; switch (frame.Shape) { - case Shapes.RECTANGLE: - case Shapes.ARC_FULL: - case Shapes.TRIANGLE: - { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Height")).First().dDimension, "Height"); - break; - } - case Shapes.RIGHTCHAMFER: { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Left Height")).First().dDimension, "Left Height"); + heightName = "Left Height"; break; } case Shapes.LEFTCHAMFER: { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Right Height")).First().dDimension, "Right Height"); + heightName = "Right Height"; break; } case Shapes.DOUBLECHAMFER: case Shapes.ARC: - { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); - break; - } - case Shapes.DOUBLEARC: - { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); - break; - } - case Shapes.THREECENTERARC: { - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); - SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height"); + heightName = "Full Height"; break; } } + SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width"); + SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals(heightName)).First().dDimension, heightName); } /// @@ -390,7 +364,7 @@ namespace WebWindowComplex.Models 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 List(); + List dimList = new(); Split split = new Split(null, null); if (sash.ParentArea.ParentArea is Split) split = (Split)sash.ParentArea.ParentArea; @@ -413,12 +387,6 @@ namespace WebWindowComplex.Models double sum = sash.SashList.Sum(x => x.dDimension); if ((sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) { - //Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault(); - //if (frame != null) - // dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap - // + frame.ElementDimensionList.Last().dOverlap; - //if(sash.SashList.Count == 1) - // dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap; for (int i = 1; i < sash.SashList.Count; i++) dim = dim + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; } @@ -432,24 +400,18 @@ namespace WebWindowComplex.Models 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) { @@ -458,36 +420,30 @@ namespace WebWindowComplex.Models 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.ConvertIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim)); - } + i.SetDimension(i.ConvertAbsoluteIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim)); } } } else if (area is Split split) { - List splitList = new List(); - List elemList = new List(); + List splitList = new(); + List elemList = new(); double sum = 0; if (nameDim.Equals("Width")) { splitList = split.SplitVertList; elemList = split.ElemDimVertList; - //foreach (var item in split.ElemDimVertList) - // sum = sum + item.dDimension; } else { splitList = split.SplitHorizList; elemList = split.ElemDimHorizList; - //foreach (var item in split.ElemDimHorizList) - // sum = sum + item.dDimension; } 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 List(); + List dimensionList = new(); foreach (var i in splitList) dimensionList.Add(new AreaDimension(i.dDimension, i.MeasureType, i.Parent)); double widthGlass = dim; @@ -517,75 +473,6 @@ namespace WebWindowComplex.Models m_ParentArea = ParentArea; } - - /// - /// Metodo per convertire da misura proporzionale a misura assoluta o percentuale - /// - /// - /// - internal double ConvertFromPropVal(Sash sashGroup, double sashDim, MeasureTypes newType, double widthTot) - { - double tot = widthTot; - List adList = new List(); - foreach (var it in sashGroup.SashList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - } - //Somma misura non proporzionali - double sumNotProp = sashGroup.SashList - .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this)) - .Sum(m => m.CalculateAbsoluteValue(adList, tot)); - //Calcolo residuo - double res = tot - sumNotProp; - if (res < 0) res = 0; - //Misure proporzionali - var proportionalList = sashGroup.SashList - .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) - .ToList(); - - double sumPesi = proportionalList.Sum(p => p.dDimension); - if (sumPesi == 0) sumPesi = 1; - if (newType.Equals(MeasureTypes.ABSOLUTE)) - { - return res / sumPesi * sashDim; - } - else - { - return (res / sumPesi * sashDim) / tot * 100; - } - } - - /// - /// Metodo per convertire da misura proporzionale a misura assoluta o percentuale - /// - /// - /// - internal double ConvertFromPropVal(List splitList, double splitDim, MeasureTypes newType, double widthTot) - { - double tot = widthTot; - List adList = new List(); - foreach (var it in splitList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - } - //Somma misura non proporzionali - double sumNotProp = splitList - .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this)) - .Sum(m => m.CalculateAbsoluteValue(adList, tot)); - //Calcolo residuo - double res = tot - sumNotProp; - if (res < 0) res = 0; - //Misure proporzionali - var proportionalList = splitList - .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) - .ToList(); - - double sumPesi = proportionalList.Sum(p => p.dDimension); - if (sumPesi == 0) - sumPesi = 1; - return res / sumPesi * splitDim; - } - #endregion Internal Methods #region Protected Fields @@ -607,7 +494,5 @@ namespace WebWindowComplex.Models private Area m_ParentArea; #endregion Private Fields - - } } \ No newline at end of file diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index 45135eb..f594617 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -190,7 +190,7 @@ namespace WebWindowComplex.Models /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno /// /// - internal List CalculatePropVal(List itemList, int indexArea, double widthTot) + internal List RicalculatePropVal(List itemList, int indexArea, double widthTot) { List ans = itemList; if (itemList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) @@ -309,7 +309,7 @@ namespace WebWindowComplex.Models /// Tipo di misura della dimensione /// Larghezza totale /// - internal double ConvertIn(List itemList, double absoluteVal, MeasureTypes type, double widthTot) + internal double ConvertAbsoluteIn(List itemList, double absoluteVal, MeasureTypes type, double widthTot) { switch (type) { @@ -379,7 +379,6 @@ namespace WebWindowComplex.Models if (sumPesi == 0) sumPesi = 1; return res / sumPesi * dimensionProp; } - #endregion Public Method } diff --git a/WebWindowComplex/Models/ElementDimension.cs b/WebWindowComplex/Models/ElementDimension.cs index 5dc8279..0e1647e 100644 --- a/WebWindowComplex/Models/ElementDimension.cs +++ b/WebWindowComplex/Models/ElementDimension.cs @@ -71,7 +71,10 @@ namespace WebWindowComplex.Models // Per calcolare larghezza split gorup mi basta una qualsiasi dimensione double height = 0; if (frame != null) - height =split.SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + { + height = split.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + //height =split.SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + } //double height = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea()); List horizElemList = split.ElemDimHorizList.Where(x=>x.m_nIndex== 1).ToList(); foreach (var elem in horizElemList) @@ -96,7 +99,7 @@ namespace WebWindowComplex.Models // Per calcolare larghezza split gorup mi basta una qualsiasi dimensione double width = 0; if (frame != null) - width = split.SplitVertList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + width = split.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; //double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea()); List vertElemList = split.ElemDimVertList.Where(x => x.m_nIndex == 1).ToList(); foreach (var elem in vertElemList) @@ -262,8 +265,10 @@ namespace WebWindowComplex.Models return newElementDimension; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { + if (obj is null) + return false; return Equals(obj as ElementDimension); } diff --git a/WebWindowComplex/Models/Fill.cs b/WebWindowComplex/Models/Fill.cs index 30beb75..83de8ac 100644 --- a/WebWindowComplex/Models/Fill.cs +++ b/WebWindowComplex/Models/Fill.cs @@ -6,7 +6,6 @@ namespace WebWindowComplex.Models public class Fill : Area { #region Public Constructors - public Fill(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow) { } @@ -23,13 +22,13 @@ namespace WebWindowComplex.Models } } - public List FillTypeList - { - get - { - return m_FillTypeList; - } - } + //public List FillTypeList + //{ + // get + // { + // return m_FillTypeList; + // } + //} public FillTypes SelFillType { @@ -43,17 +42,17 @@ namespace WebWindowComplex.Models } } - public int SelFillTypeIndex - { - get - { - return IdNameStruct.IndFromId((int)m_SelFillType, m_FillTypeList); - } - set - { - m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList); - } - } + //public int SelFillTypeIndex + //{ + // get + // { + // return IdNameStruct.IndFromId((int)m_SelFillType, m_FillTypeList); + // } + // set + // { + // m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList); + // } + //} #endregion Public Properties diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index a32c988..63f095e 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -397,15 +397,9 @@ namespace WebWindowComplex.Models if (node != null) { if (node.AreaType.Equals(AreaTypes.SASH)) - { sashList.Add((Sash)node); - //Sash s = (Sash)node; - //s.SashArcElem = null; - } foreach (var item in node.AreaList) - { SearchSash(sashList, item); - } } return sashList; } @@ -430,6 +424,11 @@ namespace WebWindowComplex.Models #region Public Methods + public override Frame Copy(Area ParentArea) + { + return new Frame(null, ParentWindow); + } + public void RefreshThresholdList() { m_ThresholdList.Clear(); @@ -478,11 +477,6 @@ namespace WebWindowComplex.Models overlap; } - public override Frame Copy(Area ParentArea) - { - return new Frame(null, ParentWindow); - } - /// /// Metodo per calcolare l'area disponibile /// @@ -496,12 +490,6 @@ namespace WebWindowComplex.Models if(AreaList.First() is Sash) overlap = ElementDimensionList.ElementAt(1).dOverlap + ElementDimensionList.Last().dOverlap; - //if (AreaList.First() is Split split) - //{ - // if(split.SplitHorizList.Count > 0) - // overlap = ElementDimensionList.ElementAt(1).dOverlap + - // ElementDimensionList.Last().dOverlap; - //} return dim - ElementDimensionList.ElementAt(1).dDimension - ElementDimensionList.Last().dDimension + overlap; @@ -638,7 +626,6 @@ namespace WebWindowComplex.Models } } // aggiungo Joint - //int nJointQty = 4; switch (Value) { case Shapes.RECTANGLE: diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index bf95728..ede159f 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -12,7 +12,6 @@ namespace WebWindowComplex.Models m_ParentFrame = ParentFrame; m_nIndex = nIndex; m_sName = sName; - m_bIsLen = bIsLen; } #endregion Public Constructors @@ -36,13 +35,9 @@ namespace WebWindowComplex.Models ParentFrame.SelShapeIndex == (int)Shapes.TRIANGLE) { if (value > MaxDim) - { m_dDimension = MaxDim; - } else if (value < MinDim && !m_sName.Equals("Radius") && !m_sName.Equals("Height projection")) - { m_dDimension = MinDim; - } else m_dDimension = value; } @@ -53,68 +48,44 @@ namespace WebWindowComplex.Models { var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension; if (sName.Equals("Height") && value > 0.5 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim) - { m_dDimension = value; - } } else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC) { 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 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim) - { m_dDimension = value; - } } else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC) { 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 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value) - { m_dDimension = value; - } else if (sName.Equals("Radius") && value < 0.5 * widthArea) - { m_dDimension = value; - } } else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC) { 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 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * widthArea && value < MaxDim) - { m_dDimension = value; - } else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim) - { m_dDimension = value; - } } } if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width") && ParentFrame != null) @@ -169,8 +140,6 @@ namespace WebWindowComplex.Models #region Private Fields - private bool m_bIsLen = false; - private int m_nIndex; private string m_sName; diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 13fbe28..5bfe44d 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -642,6 +642,7 @@ namespace WebWindowComplex.Models #endregion Public Methods #region Internal Methods + internal void SetIsDimensionLight(bool DimensionLight) { m_IsbDimensionLight = DimensionLight; @@ -670,34 +671,34 @@ namespace WebWindowComplex.Models return newSash; } - internal OpeningSides GetOpeningSide(Openings OpeningType) - { - switch (OpeningType) - { - case Openings.TURNONLY_LEFT: - case Openings.TILTTURN_LEFT: - case Openings.TILTONLY_TOP: - case Openings.COMPLANARSLIDE_LEFT: - case Openings.LIFTSLIDE_LEFT: - { - return OpeningSides.LEFT; - } + //internal OpeningSides GetOpeningSide(Openings OpeningType) + //{ + // switch (OpeningType) + // { + // case Openings.TURNONLY_LEFT: + // case Openings.TILTTURN_LEFT: + // case Openings.TILTONLY_TOP: + // case Openings.COMPLANARSLIDE_LEFT: + // case Openings.LIFTSLIDE_LEFT: + // { + // return OpeningSides.LEFT; + // } - case Openings.TURNONLY_RIGHT: - case Openings.TILTTURN_RIGHT: - case Openings.TILTONLY_BOTTOM: - case Openings.COMPLANARSLIDE_RIGHT: - case Openings.LIFTSLIDE_RIGHT: - { - return OpeningSides.RIGHT; - } + // case Openings.TURNONLY_RIGHT: + // case Openings.TILTTURN_RIGHT: + // case Openings.TILTONLY_BOTTOM: + // case Openings.COMPLANARSLIDE_RIGHT: + // case Openings.LIFTSLIDE_RIGHT: + // { + // return OpeningSides.RIGHT; + // } - default: - { - return OpeningSides.NULL; - } - } - } + // default: + // { + // return OpeningSides.NULL; + // } + // } + //} internal Enums.OpeningTypes GetOpeningType(Openings OpeningType) { @@ -797,11 +798,6 @@ namespace WebWindowComplex.Models } } - internal void SetIsMeasureGlass(bool IsMeasureGlass) - { - m_bIsMeasureGlass = IsMeasureGlass; - } - internal void SetIsSashVertical(bool IsSashVertical) { m_bIsSashVertical = IsSashVertical; @@ -815,6 +811,10 @@ namespace WebWindowComplex.Models } } + /// + /// Metodo per impostare opzioni hardware da xml + /// + /// internal void SetHardwareOption(string OptionXml) { if (!string.IsNullOrEmpty(OptionXml)) @@ -928,10 +928,10 @@ namespace WebWindowComplex.Models } } - internal void SetSashType(SashTypes SashType) - { - m_SashType = SashType; - } + //internal void SetSashType(SashTypes SashType) + //{ + // m_SashType = SashType; + //} internal string SetSelFamilyHardwareFromIndex(string codHardware) { @@ -978,6 +978,11 @@ namespace WebWindowComplex.Models if (split.SplitVertList.Count > 0) { double dim = width; + double widthGlass = width; + foreach (var elem in split.ElemDimVertList) + { + widthGlass = widthGlass - elem.dDimension; + } switch (split.SplitVertList.ElementAt(i).SelMeasureType) { case MeasureTypes.ABSOLUTE: @@ -987,27 +992,19 @@ namespace WebWindowComplex.Models } case MeasureTypes.PROPORTIONAL: { - double widthGlass = width; + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType, split.SplitVertList.ElementAt(i).Parent); List adList = new List(); foreach (var it in split.SplitVertList) { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - foreach (var elem in split.ElemDimVertList) - { - widthGlass = widthGlass - elem.dDimension; - } dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass); break; } case MeasureTypes.PERCENTAGE: { - foreach (var elem in split.ElemDimVertList) - { - dim = dim - elem.dDimension; - } - dim = split.SplitVertList.ElementAt(i).dDimension * dim / 100; + dim = split.SplitVertList.ElementAt(i).dDimension * widthGlass / 100; break; } } @@ -1094,6 +1091,12 @@ namespace WebWindowComplex.Models else { double dim = height; + double widthGlass = height; + int minSubArea = split.ElemDimHorizList.Min(x => x.nSubArea); + foreach (var elem in split.ElemDimHorizList.Where(x => x.nSubArea == minSubArea)) + { + widthGlass = widthGlass - elem.dDimension; + } switch (split.SplitHorizList.ElementAt(i).SelMeasureType) { case MeasureTypes.ABSOLUTE: @@ -1103,29 +1106,19 @@ namespace WebWindowComplex.Models } case MeasureTypes.PROPORTIONAL: { - double widthGlass = height; + AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(i).dDimension, split.SplitHorizList.ElementAt(i).SelMeasureType, split.SplitHorizList.ElementAt(i).Parent); List adList = new List(); foreach (var it in split.SplitHorizList) { adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - int minSubArea = split.ElemDimHorizList.Min(x=>x.nSubArea); - foreach (var elem in split.ElemDimHorizList.Where(x=>x.nSubArea == minSubArea)) - { - widthGlass = widthGlass - elem.dDimension; - } dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass); break; } case MeasureTypes.PERCENTAGE: { - int minSubArea = split.ElemDimHorizList.Min(x => x.nSubArea); - foreach (var elem in split.ElemDimHorizList.Where(x => x.nSubArea == minSubArea)) - { - dim = dim - elem.dDimension; - } - dim = split.SplitHorizList.ElementAt(i).dDimension * dim / 100; + dim = split.SplitHorizList.ElementAt(i).dDimension * widthGlass / 100; break; } } @@ -1156,20 +1149,16 @@ namespace WebWindowComplex.Models /// private const string CustomHwId = "000000"; - private bool m_bIsMeasureGlass; - private bool m_bIsSashVertical; private bool m_bSashBottomRail; private string m_CurrShape = ""; private List m_HardwareList = new List(); - private List m_HwOptionList = new List(); private Dictionary m_SelHwOptionList = new Dictionary(); private int m_nSashBottomRailQty; - private List m_BottomRailElemDimList = new List(); private List m_OrientationSashTypeList = new List { diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 0f4990d..3e29c06 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -24,23 +24,13 @@ namespace WebWindowComplex.Models switch (Parent.SashList[0].OpeningType) { case Openings.TURNONLY_LEFT: - { - SetOpeningType(Openings.TURNONLY_RIGHT); - break; - } - - case Openings.TURNONLY_RIGHT: - { - SetOpeningType(Openings.TURNONLY_LEFT); - break; - } - case Openings.TILTTURN_LEFT: { SetOpeningType(Openings.TURNONLY_RIGHT); break; } + case Openings.TURNONLY_RIGHT: case Openings.TILTTURN_RIGHT: { SetOpeningType(Openings.TURNONLY_LEFT); @@ -156,14 +146,12 @@ namespace WebWindowComplex.Models for (int i = 0; i < m_Parent.SashList.Count; i++) { if (i == 0) - widthTot = widthTot - - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + widthTot = widthTot - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; else - widthTot = widthTot - - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension - + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + widthTot = widthTot - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; } } double valMinAbsolute = 100; @@ -308,7 +296,7 @@ namespace WebWindowComplex.Models for (int i = 0; i < absoluteValList.Count; i++) { var item = m_Parent.SashList.ElementAt(i); - item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); + item.SetDimension(ad.ConvertAbsoluteIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); } } foreach(var item in m_Parent.AreaList) @@ -430,28 +418,15 @@ namespace WebWindowComplex.Models else { for (int i = 0; i < m_Parent.SashList.Count - 1; i++) - { widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; - } } AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent); List newDimensions = new List(); foreach (var it in m_Parent.SashList) - { newDimensions.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); - } - //double overlap = 0; - //if (!Parent.bIsDimensionLight) - //{ - // int index = m_Parent.SashList.IndexOf(this); - // if (index == 0) - // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; - // else - // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; - //} if (newType is MeasureTypes.PROPORTIONAL) { - newDimensions = ad.CalculatePropVal(newDimensions, nSashId - 1, widthTot); + newDimensions = ad.RicalculatePropVal(newDimensions, nSashId - 1, widthTot); for (int i = 0; i < newDimensions.Count; i++) m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); } @@ -509,11 +484,6 @@ namespace WebWindowComplex.Models return JsonSashDimension; } - //internal void SetDimension(double dValue) - //{ - // m_dDimension = dValue; - //} - internal void SetHasHandle(bool value) { m_bHasHandle = value; @@ -529,57 +499,47 @@ namespace WebWindowComplex.Models SelMeasureType = value; } - internal void SetSelMeasureType(MeasureTypes value, int indexSash) - { - if (SelMeasureType != (MeasureTypes)value) - { - MeasureTypes newType = (MeasureTypes)value; - Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); - if (frame != null) - { - double widthTot = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; - if (Parent.bIsDimensionLight) - { - for(int i = 0; i < Parent.SashList.Count; i++) - { - if (i == 0) - widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - else - widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension - + Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; - } - } - else - { - for (int i = 0; i < m_Parent.SashList.Count - 1; i++) - { - widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; - } - } - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); - List newDimensions = new List(); - foreach(var item in m_Parent.SashList) - { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); - } - int index = m_Parent.SashList.IndexOf(this); - //double overlap = 0; - //if (index == 0) - // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; - //else - // overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; - m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash); - //if (newType is MeasureTypes.PROPORTIONAL) - //{ - // for (int i = 0; i < newDimensions.Count; i++) - // m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); - //} - SelMeasureType = (MeasureTypes)value; - } - } - } + //internal void SetSelMeasureType(MeasureTypes value, int indexSash) + //{ + // if (SelMeasureType != (MeasureTypes)value) + // { + // MeasureTypes newType = (MeasureTypes)value; + // Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + // if (frame != null) + // { + // double widthTot = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + // if (Parent.bIsDimensionLight) + // { + // for(int i = 0; i < Parent.SashList.Count; i++) + // { + // if (i == 0) + // widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + // - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + // else + // widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + // - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + // + Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + // } + // } + // else + // { + // for (int i = 0; i < m_Parent.SashList.Count - 1; i++) + // { + // widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; + // } + // } + // AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); + // List newDimensions = new List(); + // foreach(var item in m_Parent.SashList) + // { + // newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); + // } + // int index = m_Parent.SashList.IndexOf(this); + // m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash); + // SelMeasureType = (MeasureTypes)value; + // } + // } + //} #endregion Internal Methods diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 8b5aa61..c72e795 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -32,12 +32,12 @@ namespace WebWindowComplex.Models m_ElemDimHorizList.Clear(); double thickness = 78; if (ParentArea is Sash || ParentArea.ParentArea is Sash) - thickness = 60; + thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd"); if (value) { for (int i = 0; i < nSplitQtyVert; i++) { - SplitElementDimension newVertElem= elemVertListOld.Where(x=>x.nSubArea==1 && x.nIndex==i+1).First().Copy(); + SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nSubArea == 1 && x.nIndex == i + 1).First().Copy(); newVertElem.SetElement(i + 1, thickness, 0); m_ElemDimVertList.Add(newVertElem); //m_ElemDimVertList.Add(new SplitElementDimension(this, i + 1, thickness, 0)); @@ -46,7 +46,7 @@ namespace WebWindowComplex.Models { for (int index = 0; index < nSplitQtyHoriz; index++) { - SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nIndex == index+1).First().Copy(); + SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nIndex == index + 1).First().Copy(); newHorizElem.SetElement(index + 1, thickness, subArea + 1); m_ElemDimHorizList.Add(newHorizElem); //m_ElemDimHorizList.Add(new SplitElementDimension(this, index + 1, thickness, subArea + 1)); @@ -57,7 +57,7 @@ namespace WebWindowComplex.Models { for (int i = 0; i < nSplitQtyHoriz; i++) { - SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nSubArea == 1 && x.nIndex == i+1).First().Copy(); + SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nSubArea == 1 && x.nIndex == i + 1).First().Copy(); newHorizElem.SetElement(i + 1, thickness, 0); m_ElemDimHorizList.Add(newHorizElem); //m_ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, thickness, 0)); @@ -66,7 +66,7 @@ namespace WebWindowComplex.Models { for (int index = 0; index < nSplitQtyVert; index++) { - SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nIndex == index+1).First().Copy(); + SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nIndex == index + 1).First().Copy(); newVertElem.SetElement(index + 1, thickness, subArea + 1); m_ElemDimVertList.Add(newVertElem); //m_ElemDimVertList.Add(new SplitElementDimension(this, index + 1, thickness, subArea + 1)); @@ -115,8 +115,8 @@ namespace WebWindowComplex.Models Frame? frame = ParentWindow.AreaList.FirstOrDefault(); if(frame != null) { - double heightTot = SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; - //double heightTot = CalculateHeightArea(frame, frame.AvailHeightArea()); + double heightTot = CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + //double heightTot = SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; // Ricalcolo dimensioni aggiungendo split if (value > m_SplitHorizList.Count - 1) { @@ -141,7 +141,7 @@ namespace WebWindowComplex.Models m_SplitHorizList.Add(new SplitDimension(dNewDimension, m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType, true, this, false)); double thickness = 78; if (ParentArea is Sash || ParentArea.ParentArea is Sash) - thickness = 60; + thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd"); if (!m_bSplitStartVert) { //Aggiungo un elemento alla sottoarea principale @@ -287,7 +287,7 @@ namespace WebWindowComplex.Models Frame? frame = ParentWindow.AreaList.FirstOrDefault(); if (frame != null) { - double widthTot = SplitVertList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + double widthTot = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; //double widthTot = CalculateWidthArea(frame, frame.AvailWidthArea()); // Ricalcolo dimensioni aggiungendo split if (value > m_SplitVertList.Count - 1) @@ -313,7 +313,7 @@ namespace WebWindowComplex.Models m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true)); double thickness = 78; if (ParentArea is Sash || ParentArea.ParentArea is Sash) - thickness = 60; + thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd"); if (m_bSplitStartVert) { //Aggiungo un elemento alla sottoarea principale @@ -321,7 +321,7 @@ namespace WebWindowComplex.Models newElemDim.SetElement(ElemDimVertList.Max(x => x.nIndex) + 1, thickness, 0); ElemDimVertList.Add(newElemDim); //ElemDimVertList.Add(new SplitElementDimension(this, ElemDimVertList.Max(x => x.nIndex) + 1, 78, 0)); - if(nSplitQtyHoriz > 0) + if (nSplitQtyHoriz > 0) { // Aggiungo a tutte le sottoaree degli element int subArea = ElemDimHorizList.Max(x => x.nSubArea) + 1; @@ -546,12 +546,6 @@ namespace WebWindowComplex.Models newSplit.SplitVertList.Add(SplitVertList[i].Copy()); for (int i = 0; i < SplitHorizList.Count; i++) newSplit.SplitHorizList.Add(SplitHorizList[i].Copy()); - //newSplit.SetSplitQtyVert(nSplitQtyVert); - //for (int i = 0; i < SplitVertList.Count; i++) - // newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension); - //newSplit.SetSplitQtyHoriz(nSplitQtyHoriz); - //for (int i = 0; i < SplitHorizList.Count; i++) - // newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension); newSplit.SetSplitShape(SelSplitShape); newSplit.SetAreaType(AreaType); foreach (var item in ElemDimHorizList) @@ -627,13 +621,240 @@ namespace WebWindowComplex.Models return Split; } + /// + /// Metodo per calcolare altezza intero split group + /// + /// area di partenza + /// altezza di partenza + /// area di ritorno + /// + internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound 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) + { + if (split.SplitHorizList.Count > 0) + { + double dim = height; + foreach (var elem in split.ElemDimHorizList) + dim = dim - elem.dDimension; + int index = i; + if (split.SelSplitShape is SplitShapes.GRID) + index = i % split.SplitHorizList.Count; + switch (split.SplitHorizList.ElementAt(index).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + dim = split.SplitHorizList.ElementAt(index).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent); + List adList = new List(); + foreach (var it in split.SplitHorizList) + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim); + break; + } + case MeasureTypes.PERCENTAGE: + { + dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100; + break; + } + } + res = CalculateHeightSplitGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + double dim = height; + res = CalculateHeightSplitGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + else if (area is Sash sash) + { + double bottomRail = 0; + if (sash.SashBottomRailQty > 0) + { + foreach (var bottom in sash.BottomRailElemDimList) + bottomRail = bottomRail + bottom.dDimension + - bottom.dOverlap; + } + double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension + - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension + - bottomRail; + res = CalculateHeightSplitGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else if (area is Splitted splitted) + { + double dim = height; + if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh) + { + if (sp.SplitHorizList.Count > 0) + { + dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap + + sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap; + } + } + res = CalculateHeightSplitGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateHeightSplitGroup(item, height, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + return res; + } + + /// + /// Metodo per calcolare larghezza intero split group + /// + /// area di partenza + /// larghezza di partenza + /// area di ritorno + /// + internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound 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) + { + if (split.SplitVertList.Count > 0) + { + int index = i; + double dim = width; + foreach (var elem in split.ElemDimVertList) + dim = dim - elem.dDimension; + if (split.SelSplitShape is SplitShapes.GRID) + index = i % split.SplitHorizList.Count; + switch (split.SplitVertList.ElementAt(index).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res); + break; + } + case MeasureTypes.PROPORTIONAL: + { + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent); + List adList = new List(); + foreach (var it in split.SplitVertList) + { + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + } + res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim), res); + break; + } + case MeasureTypes.PERCENTAGE: + { + res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * dim / 100, res); + break; + } + } + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSplitGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + else if (area is Sash sash) + { + 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; + if (sash.bIsDimensionLight) + { + 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; + } + } + else + { + for (int anta = 1; anta < sash.SashList.Count; anta++) + { + widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; + } + } + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + dim = sash.SashList.ElementAt(i).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent); + List adList = new List(); + foreach (var it in sash.SashList) + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); + break; + } + case MeasureTypes.PERCENTAGE: + { + dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100; + break; + } + } + if (!sash.bIsDimensionLight) + dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + res = CalculateWidthSplitGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSplitGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + return res; + } + internal override JsonArea Serialize(bool hideHw) { if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape, GroupId); - //foreach (var SplitPosition in m_SplitPositionList) - // JsonSplit.SplitPositionList.Add(SplitPosition.Serialize()); JsonSplit.SplitStartVert = bSplitStartVert; foreach (var SplitVert in m_SplitVertList) JsonSplit.SplitVertList.Add(SplitVert.Serialize()); @@ -690,11 +911,10 @@ namespace WebWindowComplex.Models { double thickness = 78; if (ParentArea is Sash || ParentArea.ParentArea is Sash) - thickness = 60; + thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd"); // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { - for (int subArea = 0; subArea <= QtyVert; subArea++) { for (int i = 0; i < QtyHoriz; i++) @@ -741,7 +961,7 @@ namespace WebWindowComplex.Models { double thickness = 78; if (ParentArea is Sash || ParentArea.ParentArea is Sash) - thickness = 60; + thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd"); // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { @@ -769,41 +989,6 @@ namespace WebWindowComplex.Models m_bSplitStartVert = SplitStartVert; } - internal double HeightFrame() - { - double dim = 0; - switch (ParentWindow.AreaList.First().SelShapeIndex) - { - case (int)Shapes.RECTANGLE: - case (int)Shapes.TRIANGLE: - case (int)Shapes.ARC_FULL: - { - dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Height").First().dDimension; - break; - } - case (int)Shapes.RIGHTCHAMFER: - { - dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Left Height").First().dDimension; - break; - } - case (int)Shapes.LEFTCHAMFER: - { - dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Right Height").First().dDimension; - break; - } - default: - { - dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Full Height").First().dDimension; - break; - } - } - foreach(var elem in ElemDimHorizList) - { - dim = dim - elem.dDimension; - } - return dim; - } - internal void UpdateSubAreaSplit() { if (SplitHorizList.Count > 0) @@ -816,16 +1001,16 @@ namespace WebWindowComplex.Models List dimList = new List(); foreach (var itemDim in SplitHorizList) dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent)); - //double width = SplitHorizList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; - ////double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea()); - //AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width"); double dim = currSplitDim.dDimension; double height = 0; if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE))) { Frame frame = ParentArea.ParentWindow.AreaList[0]; if (frame != null) - height = currSplitDim.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + { + height = CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + //height = currSplitDim.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension; + } foreach (var elem in ElemDimHorizList) height = height - elem.dDimension; dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1); @@ -850,7 +1035,10 @@ namespace WebWindowComplex.Models { Frame frame = ParentArea.ParentWindow.AreaList[0]; if(frame != null) - width = currSplitDim.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + { + width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + //width = currSplitDim.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + } foreach (var elem in ElemDimVertList) width = width - elem.dDimension; dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1); diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index caa9874..7ccad53 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -52,12 +52,14 @@ namespace WebWindowComplex.Models subAreaVert = m_Parent.ElemDimVertList.Min(x => x.nSubArea); if (m_Parent.ElemDimHorizList.Count > 0) subAreaHoriz = m_Parent.ElemDimHorizList.Min(x => x.nSubArea); - double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + //double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + double width = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; foreach (var item in m_Parent.ElemDimVertList.Where(x=>x.nSubArea == subAreaVert)) { width = width - item.dDimension; } - double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + double height = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + //double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; foreach (var item in m_Parent.ElemDimHorizList.Where(x => x.nSubArea == subAreaHoriz)) { height = height - item.dDimension; @@ -225,7 +227,7 @@ namespace WebWindowComplex.Models for (int i = 0; i < absoluteValList.Count; i++) { var item = dimensions.ElementAt(i); - item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot)); + item.SetDimension(ad.ConvertAbsoluteIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot)); } } for (int i = 0; i < m_Parent.AreaList.Count; i++) @@ -293,7 +295,8 @@ namespace WebWindowComplex.Models splitElemList = m_Parent.ElemDimVertList; else splitElemList = m_Parent.ElemDimVertList.Where(x => x.nSubArea == 1).ToList(); - dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + //dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + dimSplitGroup = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; } else { @@ -302,7 +305,8 @@ namespace WebWindowComplex.Models splitElemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList(); else splitElemList = m_Parent.ElemDimHorizList; - dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + dimSplitGroup = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + //dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; } AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); @@ -316,7 +320,7 @@ namespace WebWindowComplex.Models } if (newType is MeasureTypes.PROPORTIONAL) { - adList = ad.CalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup); + adList = ad.RicalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup); for (int i = 0; i < adList.Count; i++) splitList.ElementAt(i).SetDimension(adList.ElementAt(i).dDimension); } @@ -342,247 +346,234 @@ namespace WebWindowComplex.Models #region Internal Methods - /// - /// Metodo per calcolare larghezza intero split group - /// - /// area di partenza - /// larghezza di partenza - /// area di ritorno - /// - internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res) - { - for (int i = 0; i < area.AreaList.Count; i++) - { - if (area.Equals(m_Parent)) - { - res.m_Dimension = width; - res.m_Found = true; - return res; - } - Area item = area.AreaList[i]; - if (area is Split split) - { - if(split.SplitVertList.Count > 0) - { - int index = i; - double widthGlass = width; - foreach (var elem in split.ElemDimVertList) - widthGlass = widthGlass - elem.dDimension; - if (split.SelSplitShape is SplitShapes.GRID) - index = i % split.SplitHorizList.Count; - switch (split.SplitVertList.ElementAt(index).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res); - break; - } - case MeasureTypes.PROPORTIONAL: - { - AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent); - List adList = new List(); - foreach (var it in split.SplitVertList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - } - res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass), res); - break; - } - case MeasureTypes.PERCENTAGE: - { - res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * widthGlass / 100, res); - break; - } - } - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - else - { - res = CalculateWidthSplitGroup(item, width, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - } - else if (area is Sash sash) - { - 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; - if (sash.bIsDimensionLight) - { - 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; - } - } - else - { - for (int anta = 1; anta < sash.SashList.Count; anta++) - { - widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; - } - } - switch (sash.SashList.ElementAt(i).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - dim = sash.SashList.ElementAt(i).dDimension; - break; - } - case MeasureTypes.PROPORTIONAL: - { - AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent); - List adList = new List(); - foreach (var it in sash.SashList) - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); - break; - } - case MeasureTypes.PERCENTAGE: - { - dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100; - break; - } - } - if (!sash.bIsDimensionLight) - dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - res = CalculateWidthSplitGroup(item, dim, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - else - { - res = CalculateWidthSplitGroup(item, width, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - } - return res; - } + ///// + ///// Metodo per calcolare larghezza intero split group + ///// + ///// area di partenza + ///// larghezza di partenza + ///// area di ritorno + ///// + //internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res) + //{ + // for (int i = 0; i < area.AreaList.Count; i++) + // { + // if (area.Equals(m_Parent)) + // { + // res.m_Dimension = width; + // res.m_Found = true; + // return res; + // } + // Area item = area.AreaList[i]; + // if (area is Split split) + // { + // if(split.SplitVertList.Count > 0) + // { + // int index = i; + // double dim = width; + // foreach (var elem in split.ElemDimVertList) + // dim = dim - elem.dDimension; + // if (split.SelSplitShape is SplitShapes.GRID) + // index = i % split.SplitHorizList.Count; + // switch (split.SplitVertList.ElementAt(index).SelMeasureType) + // { + // case MeasureTypes.ABSOLUTE: + // { + // res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res); + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent); + // List adList = new List(); + // foreach (var it in split.SplitVertList) + // { + // adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + // } + // res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim), res); + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * dim / 100, res); + // break; + // } + // } + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // else + // { + // res = CalculateWidthSplitGroup(item, width, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // } + // else if (area is Sash sash) + // { + // 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; + // if (sash.bIsDimensionLight) + // { + // 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; + // } + // } + // else + // { + // for (int anta = 1; anta < sash.SashList.Count; anta++) + // { + // widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; + // } + // } + // switch (sash.SashList.ElementAt(i).SelMeasureType) + // { + // case MeasureTypes.ABSOLUTE: + // { + // dim = sash.SashList.ElementAt(i).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent); + // List adList = new List(); + // foreach (var it in sash.SashList) + // adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + // dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100; + // break; + // } + // } + // if (!sash.bIsDimensionLight) + // dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + // - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + // res = CalculateWidthSplitGroup(item, dim, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // else + // { + // res = CalculateWidthSplitGroup(item, width, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // } + // return res; + //} - /// - /// Metodo per calcolare altezza intero split group - /// - /// area di partenza - /// altezza di partenza - /// area di ritorno - /// - internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res) - { - for (int i = 0; i < area.AreaList.Count; i++) - { - if (area.Equals(m_Parent)) - { - res.m_Dimension = height; - res.m_Found = true; - return res; - } - Area item = area.AreaList[i]; - if (area is Split split) - { - if (split.SplitHorizList.Count > 0) - { - double dim = height; - int index = i; - if (split.SelSplitShape is SplitShapes.GRID) - index = i % split.SplitHorizList.Count; - switch (split.SplitHorizList.ElementAt(index).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - dim = split.SplitHorizList.ElementAt(index).dDimension; - break; - } - case MeasureTypes.PROPORTIONAL: - { - double heigthGlass = 0; - AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent); - List adList = new List(); - foreach (var it in split.SplitHorizList) - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); - foreach (var elem in split.ElemDimHorizList) - heigthGlass = heigthGlass - elem.dDimension; - dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, heigthGlass); - break; - } - case MeasureTypes.PERCENTAGE: - { - foreach(var elem in split.ElemDimHorizList) - dim = dim - elem.dDimension; - dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100; - break; - } - } - //if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash) - //{ - // dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap - // + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap; - //} - res = CalculateHeightSplitGroup(item, dim, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - else - { - double dim = height; - //if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash) - //{ - // dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap - // + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap; - //} - res = CalculateHeightSplitGroup(item, dim, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - } - else if (area is Sash sash) - { - double bottomRail = 0; - if(sash.SashBottomRailQty > 0) - { - foreach (var bottom in sash.BottomRailElemDimList) - bottomRail = bottomRail + bottom.dDimension - - bottom.dOverlap; - } - double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension - - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension - - bottomRail; - res = CalculateHeightSplitGroup(item, dim, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - else if (area is Splitted splitted) - { - double dim = height; - if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh) - { - if (sp.SplitHorizList.Count > 0) - { - dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap - + sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap; - } - } - res = CalculateHeightSplitGroup(item, dim, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - else - { - res = CalculateHeightSplitGroup(item, height, res); - if (res.m_Dimension != -1 && res.m_Found) - return res; - } - } - return res; - } + ///// + ///// Metodo per calcolare altezza intero split group + ///// + ///// area di partenza + ///// altezza di partenza + ///// area di ritorno + ///// + //internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res) + //{ + // for (int i = 0; i < area.AreaList.Count; i++) + // { + // if (area.Equals(m_Parent)) + // { + // res.m_Dimension = height; + // res.m_Found = true; + // return res; + // } + // Area item = area.AreaList[i]; + // if (area is Split split) + // { + // if (split.SplitHorizList.Count > 0) + // { + // double dim = height; + // foreach (var elem in split.ElemDimHorizList) + // dim = dim - elem.dDimension; + // int index = i; + // if (split.SelSplitShape is SplitShapes.GRID) + // index = i % split.SplitHorizList.Count; + // switch (split.SplitHorizList.ElementAt(index).SelMeasureType) + // { + // case MeasureTypes.ABSOLUTE: + // { + // dim = split.SplitHorizList.ElementAt(index).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent); + // List adList = new List(); + // foreach (var it in split.SplitHorizList) + // adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + // dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim); + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100; + // break; + // } + // } + // res = CalculateHeightSplitGroup(item, dim, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // else + // { + // double dim = height; + // res = CalculateHeightSplitGroup(item, dim, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // } + // else if (area is Sash sash) + // { + // double bottomRail = 0; + // if(sash.SashBottomRailQty > 0) + // { + // foreach (var bottom in sash.BottomRailElemDimList) + // bottomRail = bottomRail + bottom.dDimension + // - bottom.dOverlap; + // } + // double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension + // - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension + // - bottomRail; + // res = CalculateHeightSplitGroup(item, dim, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // else if (area is Splitted splitted) + // { + // double dim = height; + // if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh) + // { + // if (sp.SplitHorizList.Count > 0) + // { + // dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap + // + sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap; + // } + // } + // res = CalculateHeightSplitGroup(item, dim, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // else + // { + // res = CalculateHeightSplitGroup(item, height, res); + // if (res.m_Dimension != -1 && res.m_Found) + // return res; + // } + // } + // return res; + //} internal JsonSplitDimension Serialize() { @@ -623,7 +614,8 @@ namespace WebWindowComplex.Models splitElemList = m_Parent.ElemDimVertList; else splitElemList = m_Parent.ElemDimVertList.Where(x => x.nSubArea == 1).ToList(); - dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + //dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + dimSplitGroup = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; } else { @@ -632,7 +624,8 @@ namespace WebWindowComplex.Models splitElemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList(); else splitElemList = m_Parent.ElemDimHorizList; - dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + //dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + dimSplitGroup = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; } AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); @@ -646,7 +639,7 @@ namespace WebWindowComplex.Models } if (newType is MeasureTypes.PROPORTIONAL) { - adList = ad.CalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup); + adList = ad.RicalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup); for (int i = 0; i < adList.Count; i++) splitList.ElementAt(i).SetDimension(adList.ElementAt(i).dDimension); } diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index c3f7949..38ddee9 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -103,7 +103,7 @@ maxCol="m_maxCol" RowCollapsedDict="RowCollapsed" ChildDict="Child" - SashList="SashList" + SashGroupList="SashGroupList" SplitList="SplitList" SplittedList="SplittedList" FillList="FillList" @@ -126,8 +126,8 @@ } - - + + = SashList.Count || currSashIndex == -1) + @if (currSashIndex >= SashGroupList.Count || currSashIndex == -1) { currStep = CompileStep.Tree; } @@ -171,8 +171,8 @@ { - - + + x.AreaList.First().Equals(FillList[currFillIndex])).FirstOrDefault(); @if(currSplitted != null) { - @if (currSplitted.ParentArea != null && currSplitted.ParentWindow != null){ - diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 3b12dce..ae72fd3 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -161,7 +161,7 @@ namespace WebWindowComplex } } - protected List SashList + protected List SashGroupList { get => m_SashList; } @@ -218,11 +218,11 @@ namespace WebWindowComplex if ((node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1) || (node.ParentArea != null && node.ParentArea.AreaList.Count > 1)) { - for (int i = 0; i < SashList.Count; i++) + for (int i = 0; i < SashGroupList.Count; i++) { - if (SashList[i].Equals(node)) + if (SashGroupList[i].Equals(node)) { - nWIndow = SashList.Count == 1 ? "" : $"{i + 1}"; + nWIndow = SashGroupList.Count == 1 ? "" : $"{i + 1}"; // Se il nodo ha figli, salvo il numero nell'oggetto if (node.AreaList.Count >= 1) ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SG" + nWIndow, maxRow, col, i, node.AreaList.Count)); @@ -527,7 +527,7 @@ namespace WebWindowComplex // verifico variazione JWD if (!prevJwd.Equals(CurrJwd) || prevReq != (int)DataReq.ReqElement) { - Log.Info("Richiesta Profili Elementi"); + Log.Info("Richiesta profili elementi"); prevJwd = CurrJwd; prevReq = (int)DataReq.ReqElement; Dictionary Args = new Dictionary(); @@ -637,7 +637,7 @@ namespace WebWindowComplex WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); if (WindowFromJson == null || WindowFromJson.AreaList == null || WindowFromJson.AreaList.Count == 0) { - WindowFromJson = BuildFrameDefault(); + WindowFromJson = BuildWindowDefault(); Log.Info("Ricostruito jwd"); } UpdateInputList(WindowFromJson); @@ -654,7 +654,7 @@ namespace WebWindowComplex listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); Log.Error($"Errore nel deserializzare jwd: {ex.Message}"); // costruisco una finestra base - WindowFromJson = BuildFrameDefault(); + WindowFromJson = BuildWindowDefault(); await DoPreviewSvg(true); } } @@ -667,7 +667,7 @@ namespace WebWindowComplex if (m_CurrWindow != null && m_CurrWindow.AreaList != null && m_CurrWindow.AreaList.Count > 0) { checkWarnings(); - if (SashList.Count > 0) + if (SashGroupList.Count > 0) currAntaIndex = 0; if (updRequested) { @@ -682,7 +682,7 @@ namespace WebWindowComplex if (LiveData.ProfElementList.Count == 0) await UpdateElement(FrameWindow); } - List reqList = SashList.Select(x => x.GroupId).ToList(); + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) { await DoReqShape(reqList); @@ -704,7 +704,7 @@ namespace WebWindowComplex else { JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); - WindowFromJson = BuildFrameDefault(); + WindowFromJson = BuildWindowDefault(); await DoPreviewSvg(true); } } @@ -716,7 +716,11 @@ namespace WebWindowComplex isLoading = false; } - private JsonWindow BuildFrameDefault() + /// + /// Metodo per costruire una finestra con vetro fisso + /// + /// + private JsonWindow BuildWindowDefault() { // Costruisco window e setto i parametri Window window = new Window(); @@ -766,15 +770,12 @@ namespace WebWindowComplex protected bool CheckGroupId(Window window) { List groupIdList = new List(); - SearchInWindow(window.AreaList.First(), groupIdList); + AllGroupIdList(window.AreaList.First(), groupIdList); var duplicati = groupIdList.GroupBy(x => x) - .Where(g => g.Count() > 1) - .Select(g => g.Key) - .ToList(); - if (duplicati.Count > 0) - return false; - else - return true; + .Where(g => g.Count() > 1) + .Select(g => g.Key) + .ToList(); + return duplicati.Count > 0 ? false : true; } /// @@ -812,7 +813,7 @@ namespace WebWindowComplex // Aggiornamento liste sash, split, splitted, fill e itemTable UpdateLists(); } - if (SashList.Count > 0) + if (SashGroupList.Count > 0) currAntaIndex = 0; // Aggiorno window con dati shape e hw option UpdateDict(); @@ -830,8 +831,7 @@ namespace WebWindowComplex // Inserisco le forme ricevuto nei sash group foreach (var item in LiveData.DictShape) { - //Sash sashFromGroupId = SashList.First(x => x.GroupId == item.Key); - var sashFromGroupId = SashList.FirstOrDefault(x => x.GroupId == item.Key); + Sash? sashFromGroupId = SashGroupList.FirstOrDefault(x => x.GroupId == item.Key); if (sashFromGroupId != null) { sashFromGroupId.SashShape = item.Value; @@ -842,7 +842,7 @@ namespace WebWindowComplex { if (reqHwOpt > 0) { - List reqList = SashList.Select(x => x.GroupId).ToList(); + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) { _ = DoReqOptHardware(reqList); @@ -854,7 +854,7 @@ namespace WebWindowComplex if (LiveData.DictOptionsXml.Count > 0) { loadListRem("LoadHwOpt"); - foreach (var item in SashList) + foreach (var item in SashGroupList) { if (LiveData.DictOptionsXml.ContainsKey(item.GroupId)) { @@ -864,7 +864,6 @@ namespace WebWindowComplex } if (LiveData.ProfElementList.Count > 0) { - //List OrderedListProf = LiveData.ProfElementList.OrderBy(x => x.GroupId).ToList(); // Inserisco i profili ricevuti nei rispettivi Element foreach (var item in LiveData.ProfElementList) { @@ -992,7 +991,6 @@ namespace WebWindowComplex #region Private Properties private Window? m_CurrWindow { get; set; } = null; - private Window? m_PreviousWindow { get; set; } = null; /// @@ -1098,7 +1096,7 @@ namespace WebWindowComplex } /// - /// Helper aggiunta elemento a lista caricamento + /// Helper aggiunta elemento a lista caricamento (per caricamento opzioni hw) /// /// private void loadListAdd(string loadCode) @@ -1216,9 +1214,7 @@ namespace WebWindowComplex { Area? found = SearchAreaFromGroupId(child, idSearch); if (found != null) - { return found; - } } return null; } @@ -1719,7 +1715,7 @@ namespace WebWindowComplex if (prevReq == (int)DataReq.ReqShape) { // richiesta calcolo opzioni hardware per la singola sash group - List reqList = SashList.Select(x => x.GroupId).ToList(); + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); // chiamo con gruppo della nuova sash await DoReqOptHardware(reqList); } @@ -1792,19 +1788,24 @@ namespace WebWindowComplex m_SplitList = new List(); m_SplittedList = new List(); CreateWindowsList((m_CurrWindow!).AreaList.First(), false); - ReqListGroupId(FrameWindow, reqList); + ReqGroupIdList(FrameWindow, reqList); await DoReqElement(reqList); } } - private void ReqListGroupId(Area node, List groupId) + /// + /// Lista completa dei group id per le richieste + /// + /// nodo da controllare + /// Lista groupId + private void ReqGroupIdList(Area node, List groupId) { if (node.AreaList == null) return; if (node is Sash || node is Split) groupId.Add(node.GroupId); foreach (var child in node.AreaList) - ReqListGroupId(child, groupId); + ReqGroupIdList(child, groupId); } /// @@ -1820,13 +1821,11 @@ namespace WebWindowComplex var currRec = SearchAreaFromGroupId(FrameWindow, newSash.GroupId); // lo aggiorno currRec = newSash; - // resetto hw lst + // resetto hw list await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); // richiesta calcolo opzioni hardware per la singola sash group - List reqList = SashList.Select(x => x.GroupId).ToList(); - // chiamo con gruppo della nuova sash + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); await DoReqOptHardware(reqList); - //} } } @@ -1843,10 +1842,10 @@ namespace WebWindowComplex var currRec = SearchAreaFromGroupId(FrameWindow, newSash.GroupId); // lo aggiorno currRec = newSash; - // resetto hw lst + // resetto hw list await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); // richiesta calcolo opzioni hardware per la singola sash group - List reqList = SashList.Select(x => x.GroupId).ToList(); + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); // chiamo con gruppo della nuova sash await DoReqOptHardware(reqList); } @@ -1855,7 +1854,7 @@ namespace WebWindowComplex /// /// Aggiornamento Frame /// - /// nuovo frame + /// nuovo frame /// private async Task UpdatePreviewSplit(DataUpdateSplit args) { @@ -1881,7 +1880,7 @@ namespace WebWindowComplex /// /// Metodo per aggiornare Splitted /// - /// Splitted da aggiornare + /// Splitted da aggiornare /// private async Task UpdatePreviewSplitted(Splitted currSplitted) { @@ -1892,7 +1891,7 @@ namespace WebWindowComplex // ricalcolo liste UpdateLists(); // richiedo update shape - List reqList = SashList.Select(x => x.GroupId).ToList(); + List reqList = SashGroupList.Select(x => x.GroupId).ToList(); await DoPreviewSvg(); await UpdateElement(FrameWindow); await DoReqShape(reqList); @@ -1910,39 +1909,34 @@ namespace WebWindowComplex Sash newSash = args.currSash; bool svgNoHw = args.svgNoHw; bool noSvg = args.noSvg; - if (svgNoHw) + Sash? item = (Sash?)SearchAreaFromGroupId(FrameWindow, newSash.GroupId); + if (!noSvg && newSash != null && item != null) { - Sash? item = (Sash?)SearchAreaFromGroupId(FrameWindow, newSash.GroupId); - if (newSash != null && item != null) - { - item = newSash; + item = newSash; + if (svgNoHw) await DoPreviewSvg(true, true); - } - } - else - { - Sash? item = (Sash?)SearchAreaFromGroupId(FrameWindow, newSash.GroupId); - if (newSash != null && item != null) - { - item = newSash; - if (!noSvg) - await DoPreviewSvg(); - } + else + await DoPreviewSvg(); } } + /// + /// Rimozione area da frame corrente + /// + /// oggetto da rimuovere + /// private async Task RemoveArea(DataNextStep remove) { if (remove.currCompileStep is CompileStep.Sash) { - SashList.ElementAt(remove.index).Remove(); + SashGroupList.ElementAt(remove.index).Remove(); if (FrameWindow.SelThreshold.Name.Contains("Threshold") && remove.index == 0) { Threshold? updThreshold = FrameWindow.ThresholdList.FirstOrDefault(x => x.Name != "Threshold"); if (updThreshold != null) FrameWindow.SelThresholdFromName = updThreshold.Name; } - SashList.RemoveAt(remove.index); + SashGroupList.RemoveAt(remove.index); } else if(remove.currCompileStep is CompileStep.Split) { @@ -1968,18 +1962,18 @@ namespace WebWindowComplex } /// - /// Metodo per ottenere lista groupId + /// Metodo per ottenere lista di tutti i groupId appartenenti alla window /// /// Area da aggiungere alla lista groupId /// Lista group id - protected void SearchInWindow(Area node, List groupIdList) + protected void AllGroupIdList(Area node, List groupIdList) { if (node != null) { groupIdList.Add(node.GroupId); foreach (var item in node.AreaList) { - SearchInWindow(item, groupIdList); + AllGroupIdList(item, groupIdList); } } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 36649d1..75cd3be 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1610 + 3.1.3.1617 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -34,3 +34,5 @@ + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 1763a3d..0eba16f 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1610 + 3.1.3.1617 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -35,4 +35,9 @@ - \ No newline at end of file + + + + + +