From b48cf848a9ed7085251d34c75badc52cef2be854 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 29 Sep 2025 09:44:26 +0200 Subject: [PATCH] Aggiunta gestione Split a griglia nel componente di test --- Test.UI/Data/FinDueAnteBottomFisso.jwd | 4 +- Test.UI/Data/FinestraDueAnteSeparate.jwd | 4 +- Test.UI/Data/FinestraSplitGrid.jwd | 151 +++ Test.UI/Data/FinestraSplitVert.jwd | 4 +- Test.UI/Data/FinestraSplitVertOriz.jwd | 158 ---- Test.UI/Data/Setup.json | 6 +- WebWindow.Base/WebWindow.Base.csproj | 24 +- WebWindowComplex/WebWindowComplex.csproj | 16 +- .../WebWindowConfigurator.csproj | 26 +- WebWindowTest/Json/JsonUtility.cs | 66 +- WebWindowTest/Test.razor | 880 +++++++++--------- WebWindowTest/Test.razor.cs | 187 ++-- WebWindowTest/Window.cs | 312 ++++++- 13 files changed, 1122 insertions(+), 716 deletions(-) create mode 100644 Test.UI/Data/FinestraSplitGrid.jwd delete mode 100644 Test.UI/Data/FinestraSplitVertOriz.jwd diff --git a/Test.UI/Data/FinDueAnteBottomFisso.jwd b/Test.UI/Data/FinDueAnteBottomFisso.jwd index 4363cbd..2940a11 100644 --- a/Test.UI/Data/FinDueAnteBottomFisso.jwd +++ b/Test.UI/Data/FinDueAnteBottomFisso.jwd @@ -43,7 +43,9 @@ { "IdGroup": 2, "SplitShape": "HORIZONTAL", - "SplitPositionList": [ + "SplitStartVert": false, + "SplitVertList": [], + "SplitHorizList": [ { "bIsRelative": true, "dDimension": 40.0 diff --git a/Test.UI/Data/FinestraDueAnteSeparate.jwd b/Test.UI/Data/FinestraDueAnteSeparate.jwd index 69db6ca..b051b18 100644 --- a/Test.UI/Data/FinestraDueAnteSeparate.jwd +++ b/Test.UI/Data/FinestraDueAnteSeparate.jwd @@ -48,7 +48,8 @@ { "IdGroup": 2, "SplitShape": "VERTICAL", - "SplitPositionList": [ + "SplitStartVert": true, + "SplitVertList": [ { "bIsRelative": true, "dDimension": 50.0 @@ -58,6 +59,7 @@ "dDimension": 50.0 } ], + "SplitHorizList": [], "AreaList": [ { "IdGroup": 3, diff --git a/Test.UI/Data/FinestraSplitGrid.jwd b/Test.UI/Data/FinestraSplitGrid.jwd new file mode 100644 index 0000000..6f5f99e --- /dev/null +++ b/Test.UI/Data/FinestraSplitGrid.jwd @@ -0,0 +1,151 @@ +{ + "ProfilePath": "Profilo78", + "Material": "Pine", + "ColorMaterial": "Black", + "Glass": "4T/16/4T", + "AreaList": [ + { + "IdGroup": 1, + "Shape": "RECTANGLE", + "DimensionList": [ + { + "nIndex": 1, + "sName": "Width", + "dValue": 1500.0 + }, + { + "nIndex": 2, + "sName": "Height", + "dValue": 1800.0 + } + ], + "JointList": [ + { + "nIndex": 1, + "JointType": "FULL_H" + }, + { + "nIndex": 2, + "JointType": "FULL_H" + }, + { + "nIndex": 3, + "JointType": "FULL_H" + }, + { + "nIndex": 4, + "JointType": "FULL_H" + } + ], + "BottomRail": false, + "BottomRailQty": 0, + "AreaList": [ + { + "IdGroup": 2, + "SplitShape": "GRID", + "SplitStartVert": false, + "SplitVertList": [ + { + "bIsRelative": true, + "dDimension": 50.0 + }, + { + "bIsRelative": true, + "dDimension": 50.0 + } + ], + "SplitHorizList": [ + { + "bIsRelative": true, + "dDimension": 30.0 + }, + { + "bIsRelative": true, + "dDimension": 40.0 + }, + { + "bIsRelative": true, + "dDimension": 30.0 + } + ], + "AreaList": [ + { + "IdGroup": 3, + "AreaList": [ + { + "IdGroup": 4, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "IdGroup": 5, + "AreaList": [ + { + "IdGroup": 6, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "IdGroup": 7, + "AreaList": [ + { + "IdGroup": 8, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "IdGroup": 9, + "AreaList": [ + { + "IdGroup": 10, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "IdGroup": 11, + "AreaList": [ + { + "IdGroup": 12, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "IdGroup": 13, + "AreaList": [ + { + "IdGroup": 14, + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SPLIT" + } + ], + "AreaType": "FRAME" + } + ] +} \ No newline at end of file diff --git a/Test.UI/Data/FinestraSplitVert.jwd b/Test.UI/Data/FinestraSplitVert.jwd index 74a4606..60e1e4b 100644 --- a/Test.UI/Data/FinestraSplitVert.jwd +++ b/Test.UI/Data/FinestraSplitVert.jwd @@ -43,7 +43,8 @@ { "IdGroup": 2, "SplitShape": "VERTICAL", - "SplitPositionList": [ + "SplitStartVert": true, + "SplitVertList": [ { "bIsRelative": true, "dDimension": 50.0 @@ -53,6 +54,7 @@ "dDimension": 50.0 } ], + "SplitHorizList": [], "AreaList": [ { "IdGroup": 3, diff --git a/Test.UI/Data/FinestraSplitVertOriz.jwd b/Test.UI/Data/FinestraSplitVertOriz.jwd deleted file mode 100644 index f149bc8..0000000 --- a/Test.UI/Data/FinestraSplitVertOriz.jwd +++ /dev/null @@ -1,158 +0,0 @@ -{ - "ProfilePath": "Profilo78", - "Material": "Pine", - "ColorMaterial": "Black", - "Glass": "4T/16/4T", - "AreaList": [ - { - "IdGroup": 1, - "Shape": "RECTANGLE", - "DimensionList": [ - { - "nIndex": 1, - "sName": "Width", - "dValue": 1500.0 - }, - { - "nIndex": 2, - "sName": "Height", - "dValue": 1800.0 - } - ], - "JointList": [ - { - "nIndex": 1, - "JointType": "FULL_H" - }, - { - "nIndex": 2, - "JointType": "FULL_H" - }, - { - "nIndex": 3, - "JointType": "FULL_H" - }, - { - "nIndex": 4, - "JointType": "FULL_H" - } - ], - "BottomRail": false, - "BottomRailQty": 0, - "AreaList": [ - { - "IdGroup": 2, - "SplitShape": "VERTICAL", - "SplitPositionList": [ - { - "bIsRelative": true, - "dDimension": 50.0 - }, - { - "bIsRelative": true, - "dDimension": 50.0 - } - ], - "AreaList": [ - { - "IdGroup": 3, - "AreaList": [ - { - "IdGroup": 4, - "SplitShape": "HORIZONTAL", - "SplitPositionList": [ - { - "bIsRelative": true, - "dDimension": 40.0 - }, - { - "bIsRelative": true, - "dDimension": 60.0 - } - ], - "AreaList": [ - { - "IdGroup": 5, - "AreaList": [ - { - "IdGroup": 6, - "FillType": "GLASS", - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" - }, - { - "IdGroup": 7, - "AreaList": [ - { - "IdGroup": 8, - "FillType": "GLASS", - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" - } - ], - "AreaType": "SPLIT" - } - ], - "AreaType": "SPLITTED" - }, - { - "IdGroup": 9, - "AreaList": [ - { - "IdGroup": 10, - "SplitShape": "HORIZONTAL", - "SplitPositionList": [ - { - "bIsRelative": true, - "dDimension": 40.0 - }, - { - "bIsRelative": true, - "dDimension": 60.0 - } - ], - "AreaList": [ - { - "IdGroup": 11, - "AreaList": [ - { - "IdGroup": 12, - "FillType": "GLASS", - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" - }, - { - "IdGroup": 13, - "AreaList": [ - { - "IdGroup": 14, - "FillType": "GLASS", - "AreaList": [], - "AreaType": "FILL" - } - ], - "AreaType": "SPLITTED" - } - ], - "AreaType": "SPLIT" - } - ], - "AreaType": "SPLITTED" - } - ], - "AreaType": "SPLIT" - } - ], - "AreaType": "FRAME" - } - ] -} \ No newline at end of file diff --git a/Test.UI/Data/Setup.json b/Test.UI/Data/Setup.json index f11b42d..3a4469d 100644 --- a/Test.UI/Data/Setup.json +++ b/Test.UI/Data/Setup.json @@ -25,9 +25,9 @@ }, { "Index": 5, - "Description": "Finestra con split verticale e orizzontale", - "SVGFileName": "FinestraSplitVertOriz.svg", - "JwdFileName": "Data/FinestraSplitVertOriz.jwd" + "Description": "Finestra con split grid", + "SVGFileName": "FinestraSplitGrid.svg", + "JwdFileName": "Data/FinestraSplitGrid.jwd" }, { "Index": 6, diff --git a/WebWindow.Base/WebWindow.Base.csproj b/WebWindow.Base/WebWindow.Base.csproj index 567e902..ceaacca 100644 --- a/WebWindow.Base/WebWindow.Base.csproj +++ b/WebWindow.Base/WebWindow.Base.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.2414 + 2.7.9.2909 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -41,6 +41,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 778cc87..f91cbce 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.2414 + 2.7.9.2909 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -53,6 +53,20 @@ + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 76369e4..3228850 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.9.2414 + 2.7.9.2909 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -71,6 +71,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowTest/Json/JsonUtility.cs b/WebWindowTest/Json/JsonUtility.cs index c2de704..b26ce62 100644 --- a/WebWindowTest/Json/JsonUtility.cs +++ b/WebWindowTest/Json/JsonUtility.cs @@ -425,17 +425,45 @@ namespace WebWindowTest.Json } } - private List m_SplitPositionList = new List(); + private bool m_SplitStartVert; [JsonProperty] - public List SplitPositionList + public bool SplitStartVert { get { - return m_SplitPositionList; + return m_SplitStartVert; } set { - m_SplitPositionList = value; + m_SplitStartVert = value; + } + } + + private List m_SplitVertList = new List(); + [JsonProperty] + public List SplitVertList + { + get + { + return m_SplitVertList; + } + set + { + m_SplitVertList = value; + } + } + + private List m_SplitHorizList = new List(); + [JsonProperty] + public List SplitHorizList + { + get + { + return m_SplitHorizList; + } + set + { + m_SplitHorizList = value; } } @@ -445,8 +473,8 @@ namespace WebWindowTest.Json public JsonSplit(SplitShapes SplitShape, int nIdGroup) : base(AreaTypes.SPLIT) { - IdGroup = nIdGroup; m_SplitShape = SplitShape; + IdGroup = nIdGroup; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) @@ -455,12 +483,30 @@ namespace WebWindowTest.Json Split.SetIdGroup(IdGroup); Split.SetAreaType(AreaTypes.SPLIT); Split.SetSplitShape(m_SplitShape, true); - Split.SetSplitQty(m_SplitPositionList.Count - 1, true); - //Split.AppliedDone(); - for (var SplitIndex = 0; SplitIndex <= m_SplitPositionList.Count - 1; SplitIndex++) + Split.SetSplitStartVert(m_SplitStartVert); + if(m_SplitVertList.Count == 0) + Split.SetSplitQtyVert(0, true); + else { - Split.SplitPositionList[SplitIndex].SetIsRelative(m_SplitPositionList[SplitIndex].bIsRelative); - Split.SplitPositionList[SplitIndex].SetDimension(m_SplitPositionList[SplitIndex].dDimension); + //Split.SplitVertList.Clear(); + Split.SetSplitQtyVert(m_SplitVertList.Count - 1, true); + for (var SplitIndex = 0; SplitIndex <= m_SplitVertList.Count - 1; SplitIndex++) + { + Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].bIsRelative); + Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].dDimension); + } + } + if(m_SplitHorizList.Count == 0) + Split.SetSplitQtyHoriz(0, true); + else + { + //Split.SplitHorizList.Clear(); + Split.SetSplitQtyHoriz(m_SplitHorizList.Count - 1, true); + for (var SplitIndex = 0; SplitIndex <= m_SplitHorizList.Count - 1; SplitIndex++) + { + Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].bIsRelative); + Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].dDimension); + } } foreach (var Area in AreaList) { diff --git a/WebWindowTest/Test.razor b/WebWindowTest/Test.razor index 1616b69..8829cac 100644 --- a/WebWindowTest/Test.razor +++ b/WebWindowTest/Test.razor @@ -153,115 +153,117 @@ m_PreviousWindow = m_CurrWindow; }
-
-
-
-
- - -
-
-
-
-
-
-
-
Dimension
- @foreach (FrameDimension dimension in FrameWindow.DimensionList) - { -
- @dimension.sName - - mm -
- } +
+
+
+
+
+ +
-
-
-
-
Threshold
-
- - -
-
-
-
-
-
-
-
-
-
Frame joints
-
-
- -
-
- -
-
- -
-
- @foreach (Joint joint in FrameWindow.JointList) - { -
- - -
- } -
-
-
- @if (!(FrameWindow.AreaList[0] is Split)) - { +
-
Frame
+
Dimension
+ @foreach (FrameDimension dimension in FrameWindow.DimensionList) + { +
+ @dimension.sName + + mm +
+ } +
+
+
+
+
+
+
Threshold
- + + +
+
+
+
+
+
+
+
+
+
Frame joints
+
+
+ +
+
+ +
+
+ +
+
+ @foreach (Joint joint in FrameWindow.JointList) + { +
+ + +
+ } +
+
+
+ @if (!(FrameWindow.AreaList[0] is Split)) + { +
+
+
+
Frame
+
+ +
+
+
+
+ } +
+ @if (m_SashList.Count == 0) + { +
+
+
+
+
Bottom rail
+
+ Quantity + +
}
- @if (m_SashList.Count == 0) - { -
-
-
-
-
Bottom rail
-
- Quantity - -
-
-
-
-
- }
} @@ -274,86 +276,97 @@ @for (int i = 0; i < SplitList.Count; i++) { Split currSplit = SplitList[i]; -
+
- @if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0) - { - @for (int j = 0; j < SashList.Count; j++) - { - @if (SashList[j].Equals(currSplit.ParentArea)) - { -
@("Sash " + (j + 1))
- } - else if (SashList[j].Equals(currSplit.ParentArea.ParentArea)) - { - @for (int k = 0; k < SashList[j].AreaList.Count; k++) - { - @if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit)) - { -
@("Sash " + (j + 1) + " - anta " + (k + 1))
- } - } - } - } - - } - else - { -
@("Frame")
- } +
@(descParentSplit(currSplit))
Split
- @if (currSplit.nSplitQty == 1) + @if ((currSplit.nSplitQtyVert == 1 && currSplit.nSplitQtyHoriz == 1) || + (currSplit.nSplitQtyVert == 1 && currSplit.nSplitQtyHoriz == 0) || + (currSplit.nSplitQtyVert == 0 && currSplit.nSplitQtyHoriz == 1)) {
} -
- Number - +
+
+
+ + +
+
-
- - +
+ @if (currSplit.nSplitQtyVert > 0) + { +
+
+ QtyVert + +
+
+ } + @if (currSplit.nSplitQtyHoriz > 0) + { +
+
+ QtyHoriz + +
+
+ }
- @foreach (var dim in currSplit.SplitPositionList) +
+ @if (currSplit.SplitVertList.Count > 0) + { +
+ @foreach (var dim in currSplit.SplitVertList) + { +
+ Width + + % +
+ } +
+ } + @if (currSplit.SplitHorizList.Count > 0) + { +
+ @foreach (var dim in currSplit.SplitHorizList) + { +
+ Height + + % +
+ + } +
+ } +
+ @if(currSplit.SelSplitShape == Json.WindowConst.SplitShapes.GRID) { - string desc = ""; - @if (currSplit.SelSplitShape == Json.WindowConst.SplitShapes.VERTICAL) - { - @if (currSplit.SplitPositionList.IndexOf(dim) == 0) - { - desc = "Larg. area sx split"; - } - else - { - desc = "Larg. area dx split"; - } - } - else - { - @if (currSplit.SplitPositionList.IndexOf(dim) == 0) - { - desc = "Altez. area sotto split"; - } - else - { - desc = "Altez. area sopra split"; - } - } -
- @desc - - % +
+
+
+
+ +
+
+ +
+
+
}
@@ -363,7 +376,8 @@
} - +
+
@for (int i = 0; i < SplittedList.Count; i++) { Splitted currSplitted = SplittedList[i]; @@ -407,157 +421,101 @@ { Sash item = SashList[currSash];
-
-
-
-
- Number - -
-
-
-
-
-
-
-
Orientation
-
- - -
+
+
+
+
+
+ Number +
-
-
-
-
Bottom rail
-
- Quantity - -
-
-
-
-
-
- @for (int i = 0; i <= item.SashList.Count / 2; i++) - { - for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) - { - SashDimension sash = item.SashList[i * 2 + j]; -
-
-
- @if (item.SashList.Count == 1) - { -
Opening
- } - else - { -
Sash opening @(i * 2 + j + 1)
- } -
- - -
-
- Dimension - - % -
-
-
- -
-
- -
-
-
- @for (int k = 1; k <= i * 2 + j; k++) - { - int IndexCopy = k; - int IndexModify = i * 2 + j; -
-
- -
-
- } -
-
-
-
- } - } -
-
-
-
-
-
Sash joints
-
-
- -
-
- -
-
- -
-
- @foreach (Joint joint in item.JointList) - { +
+
+
+
+
Orientation
- - + +
- } +
+
+
+
+
+
+
Bottom rail
+
+ Quantity + +
+
-
- @for (int i = 0; i < item.AreaList.Count; i++) +
+ @for (int i = 0; i <= item.SashList.Count / 2; i++) { - Area anta; - @if (item.AreaList[i] is Splitted) + for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) { - anta = item.AreaList[i]; - } - else - { - anta = item; - } - @if (!(anta.AreaList[0] is Split)) - { -
+ SashDimension sash = item.SashList[i * 2 + j]; +
-
Anta @(i + 1)
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(i * 2 + j + 1)
+ }
- + + +
+
+ Dimension + + % +
+
+
+ +
+
+ +
+
+
+ @for (int k = 1; k <= i * 2 + j; k++) + { + int IndexCopy = k; + int IndexModify = i * 2 + j; +
+
+ +
+
+ }
@@ -565,33 +523,91 @@ } }
-
-
-
-
-
-
Hardware
-
-
-
- - +
+
+
+
+
Sash joints
+
+
+ +
+
+ +
+
+
-
+ @foreach (Joint joint in item.JointList) + {
- + + +
+ } +
+
+
+
+ @for (int i = 0; i < item.AreaList.Count; i++) + { + Area anta; + @if (item.AreaList[i] is Splitted) + { + anta = item.AreaList[i]; + } + else + { + anta = item; + } + @if (!(anta.AreaList[0] is Split)) + { +
+
+
+
Anta @(i + 1)
+
+ +
+
+
+
+ } + } +
+
+
+
+
+
+
Hardware
+
+
+
+ + +
+
+
+
+ +
+
@@ -607,20 +623,20 @@
-
+
-
-
-
Fill Area
+
Area Fill
+
+
+
+ +
-
-
-
- -
-
- +
+
+ +
@@ -683,121 +699,123 @@ else if (currStep == CompileStep.General) {
-
-
-
-
-
-
Generic
-
- - -
-
- - -
-
-
-
-
-
-
-
Fill type
-
- - -
-
- - -
-
-
-
-
-
-
-
-
-
Color
-
-
- - -
-
-
- - -
-
-
-
-
- @if (m_SashList.Count > 0) - { +
+
-
Hardware
+
Generic
- - + @for (int i = 0; i < IN_MaterialList.Count; i++) + { + + }
- - + + + + +
+
+
+
+
+
+
+
Fill type
+
+ +
- - + + +
- } +
+
+
+
+
Color
+
+
+ + +
+
+
+ + +
+
+
+
+
+ @if (m_SashList.Count > 0) + { +
+
+
+
+
Hardware
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ } +
} diff --git a/WebWindowTest/Test.razor.cs b/WebWindowTest/Test.razor.cs index e845cdc..de384d0 100644 --- a/WebWindowTest/Test.razor.cs +++ b/WebWindowTest/Test.razor.cs @@ -4,6 +4,7 @@ using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; using System.Runtime.InteropServices; using WebWindow.Base; using WebWindowTest.DTO; @@ -296,48 +297,6 @@ namespace WebWindowTest Sash.s_SelFamilyHW = IN_SelFamilyHardware; } - /// - /// Metodo per la scelta della maniglia univoca - /// - /// anta su cui si seleziona la maniglia - /// - protected void changeHandle(SashDimension sashDim, Sash currSash) - { - // Cerco la Sash che si sta considerando nella lista Sash - foreach (Sash s in SashList) - { - if (s.Equals(currSash)) - { - // Per ogni anta della Sash setto bHasHandle - foreach (SashDimension item in s.SashList) - { - if (item.Equals(sashDim)) - { - item.bHasHandle = true; - } - else - { - if (item.bHasHandle) - { - switch (item.SelOpeningType) - { - case Openings.TILTTURN_LEFT: - item.SetOpeningType(Openings.TURNONLY_LEFT); - break; - case Openings.TILTTURN_RIGHT: - item.SetOpeningType(Openings.TURNONLY_RIGHT); - break; - default: - break; - } - } - item.bHasHandle = false; - } - } - } - } - } - // Ancora da fare... protected async Task DoClose() { @@ -383,6 +342,7 @@ namespace WebWindowTest // Aggiorante liste sash, split, splitted, fill e itemTable UpdateLists(); currSash = -1; + currStep = CompileStep.Gerarchia; await DoPreviewSvg(); } @@ -393,6 +353,99 @@ namespace WebWindowTest await EC_OnClose.InvokeAsync(true); } + /// + /// Metodo per la scelta della maniglia univoca + /// + /// anta su cui si seleziona la maniglia + /// + protected void changeHandle(SashDimension sashDim, Sash currSash) + { + // Cerco la Sash che si sta considerando nella lista Sash + foreach (Sash s in SashList) + { + if (s.Equals(currSash)) + { + // Per ogni anta della Sash setto bHasHandle + foreach (SashDimension item in s.SashList) + { + if (item.Equals(sashDim)) + { + item.bHasHandle = true; + } + else + { + if (item.bHasHandle) + { + switch (item.SelOpeningType) + { + case Openings.TILTTURN_LEFT: + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + case Openings.TILTTURN_RIGHT: + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + default: + break; + } + } + item.bHasHandle = false; + } + } + } + } + } + + /// + /// Metodo per la scelta dello split intero nella modalità griglia + /// + /// split su cui si sceglie + /// + protected void changeStartVert(ChangeEventArgs e, Split currSplit) + { + // Cerco la Sash che si sta considerando nella lista Sash + foreach (Split s in SplitList) + { + if (s.Equals(currSplit)) + { + s.SetSplitStartVert((bool)e.Value); + } + } + } + + /// + /// Metodo per determinare la descrizione del parent dello split corrente + /// + /// split corrente + /// + protected string descParentSplit(Split currSplit) + { + if((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0) + { + for(int j = 0; j < SashList.Count; j++) + { + if(SashList[j].Equals(currSplit.ParentArea)) + { + return "Sash " + (j + 1); + } + else if (SashList[j].Equals(currSplit.ParentArea.ParentArea)) + { + for(int k = 0; k < SashList[j].AreaList.Count; k++) + { + if(SashList[j].AreaList[k].AreaList[0].Equals(currSplit)) + { + return "Sash " + (j + 1) + " - anta " + (k + 1); + } + } + } + } + } + else + { + return "Frame"; + } + return ""; + } + /// /// Selezione del template /// @@ -403,20 +456,6 @@ namespace WebWindowTest await EC_OnSelectedTemplate.InvokeAsync(newSel); } - /// - /// Metodo per cambiare step e aggiornare preview svg - /// - /// step successivo - protected async void NextStepAndPreview(CompileStep newStep, int Index = -1) - { - currStep = newStep; - if (newStep == CompileStep.Sash) - currSash = Index; - else - currSash = -1; - await DoPreviewSvg(); - } - /// /// Metodo per riempire le liste Sash, Split, Splitted e Fill /// @@ -785,6 +824,20 @@ namespace WebWindowTest #region Private Methods + /// + /// Metodo per cambiare step e aggiornare preview svg + /// + /// step successivo + private async void NextStepAndPreview(CompileStep newStep, int Index = -1) + { + currStep = newStep; + if (newStep == CompileStep.Sash) + currSash = Index; + else + currSash = -1; + await DoPreviewSvg(); + } + /// /// Metodo per andare allo step successivo /// @@ -829,13 +882,31 @@ namespace WebWindowTest return (currStep == CompileStep.Template) ? "col-12" : "col-6"; } + /// + /// Calcola larghezza border descrizione split + /// + /// + private string splitCss(Split currSplit) + { + return (currSplit.SelSplitShape == SplitShapes.GRID ) ? "col-sm-12" : "col-sm-6"; + } + + /// + /// Calcola larghezza border descrizione split + /// + /// + private string splitContentCss(Split currSplit) + { + return (currSplit.SelSplitShape == SplitShapes.GRID) ? "col-sm-6" : "col-sm-12"; + } + /// /// Calcola larghezza colonna header nav /// /// private string headerCss() { - return (currStep == CompileStep.Template) ? "col-10 d-grid gap-1 px-2 d-md-flex justify-content-md-start" : "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start"; + return (currStep == CompileStep.Template) ? "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start" : "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start"; } /// @@ -844,7 +915,7 @@ namespace WebWindowTest /// private string buttonCss() { - return (currStep == CompileStep.Template) ? "col-2 d-grid gap-1 d-md-flex justify-content-md-end" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end"; + return (currStep == CompileStep.Template) ? "col-4 d-grid gap-1 d-md-flex justify-content-md-end" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end"; } #endregion Private Methods diff --git a/WebWindowTest/Window.cs b/WebWindowTest/Window.cs index 21da3b0..cf19a29 100644 --- a/WebWindowTest/Window.cs +++ b/WebWindowTest/Window.cs @@ -5,10 +5,11 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Drawing; using System.Runtime.Intrinsics.Arm; +using System.Xml.Linq; using System.Xml.Serialization; using WebWindowTest.Json; -using static WebWindowTest.ParametriOpzioni; using static WebWindowTest.Json.WindowConst; +using static WebWindowTest.ParametriOpzioni; namespace WebWindowTest { @@ -238,7 +239,8 @@ namespace WebWindowTest // Aggiungo Area split di default Split SplitArea = Split.CreateSplit(this, SplitShapes.HORIZONTAL); // imposto i parametri di default - SplitArea.SetSplitQty(1); + SplitArea.SetSplitQtyHoriz(1); + SplitArea.SetSplitStartVert(false); // Aggiungo area AreaList.Add(SplitArea); // Creo le due aree Splitted @@ -412,6 +414,8 @@ namespace WebWindowTest break; } } + // salvo tipo Joint + Joints oldJointType = JointList[0].SelJointType; // aggiungo Joint m_JointList.Clear(); switch (SelShape) @@ -423,17 +427,21 @@ namespace WebWindowTest case Shapes.ARC: case Shapes.DOUBLEARC: { - JointList.Add(new Joint(this, 1, Joints.FULL_H)); - JointList.Add(new Joint(this, 2, Joints.FULL_H)); - JointList.Add(new Joint(this, 3, Joints.FULL_H)); - JointList.Add(new Joint(this, 4, Joints.FULL_H)); + JointList.Add(new Joint(this, 1, oldJointType)); + JointList.Add(new Joint(this, 2, oldJointType)); + JointList.Add(new Joint(this, 3, oldJointType)); + JointList.Add(new Joint(this, 4, oldJointType)); + //JointList.Add(new Joint(this, 1, Joints.FULL_H)); + //JointList.Add(new Joint(this, 2, Joints.FULL_H)); + //JointList.Add(new Joint(this, 3, Joints.FULL_H)); + //JointList.Add(new Joint(this, 4, Joints.FULL_H)); break; } case Shapes.ARC_FULL: { - JointList.Add(new Joint(this, 1, Joints.FULL_H)); - JointList.Add(new Joint(this, 2, Joints.FULL_H)); + JointList.Add(new Joint(this, 1, oldJointType)); + JointList.Add(new Joint(this, 2, oldJointType)); JointList.Add(new Joint(this, 3, Joints.ANGLED)); JointList.Add(new Joint(this, 4, Joints.ANGLED)); break; @@ -441,8 +449,8 @@ namespace WebWindowTest case Shapes.TRIANGLE: { - JointList.Add(new Joint(this, 1, Joints.FULL_H)); - JointList.Add(new Joint(this, 2, Joints.FULL_H)); + JointList.Add(new Joint(this, 1, oldJointType)); + JointList.Add(new Joint(this, 2, oldJointType)); JointList.Add(new Joint(this, 3, Joints.ANGLED)); break; } @@ -1413,61 +1421,81 @@ namespace WebWindowTest public class Split : Area { - public int nSplitQty + private bool m_bSplitStartVert = true; + public bool bSplitStartVert { get { - return m_SplitPositionList.Count > 0 ? m_SplitPositionList.Count - 1 : 0; + return m_bSplitStartVert; + } + set + { + m_bSplitStartVert = value; + m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + } + } + internal void SetSplitStartVert(bool SplitStartVert) + { + bSplitStartVert = SplitStartVert; + } + public int nSplitQtyVert + { + get + { + return m_SplitVertList.Count > 0 ? m_SplitVertList.Count - 1 : 0; } set { // Ricalcolo dimensioni aggiungendo split - if (value > m_SplitPositionList.Count - 1) + if (value > m_SplitVertList.Count - 1) { // recupero larghezza ultimo double dLastDimension = 100; double dNewDimension = 100; - if (m_SplitPositionList.Count > 0) + if (m_SplitVertList.Count > 0) { - dLastDimension = m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSplitQty); - m_SplitPositionList[m_SplitPositionList.Count - 1].SetDimension(dNewDimension); + dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension; + dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert); + m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension); } else - dNewDimension = dLastDimension / (value + 1 - nSplitQty); + dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert); // aggiungo area Split di default - for (var SplitIndex = m_SplitPositionList.Count; SplitIndex <= value; SplitIndex++) - SplitPositionList.Add(new SplitDimension(dNewDimension, true, this)); + for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++) + m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true)); } - else if(value == 0) + else if (value == 0) { - SplitPositionList.RemoveAt(1); - SplitPositionList.RemoveAt(0); + m_SplitVertList.RemoveAt(1); + m_SplitVertList.RemoveAt(0); } // Ricalcolo dimensioni rimuovendo split else { double dLastDimension = 0; - for (var SplitIndex = m_SplitPositionList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) + for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) { - dLastDimension += m_SplitPositionList[SplitIndex].dDimension; - SplitPositionList.RemoveAt(SplitIndex); + dLastDimension += m_SplitVertList[SplitIndex].dDimension; + m_SplitVertList.RemoveAt(SplitIndex); } - dLastDimension += m_SplitPositionList[SplitPositionList.Count - 1].dDimension; - SplitPositionList[SplitPositionList.Count - 1].SetDimension(dLastDimension); + dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension; + m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension); } + // Controllo quanti split orizzontali ci sono + int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1; // Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta - for (var SplitIndex = AreaList.Count; SplitIndex <= SplitPositionList.Count - 1; SplitIndex++) + for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++) { AreaList.Add(Splitted.CreateSplitted(this)); - Fill newFill = Fill.CreateFill(AreaList[1], FillTypes.GLASS); + Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS); newFill.SetAreaType(AreaTypes.FILL); AreaList[AreaList.Count - 1].AreaList.Add(newFill); } // Se ho più di uno split, elimino l'ultimo if (AreaList.Count > 2) { - for (var SplitIndex = SplitPositionList.Count; SplitIndex <= AreaList.Count - 1; SplitIndex++) + int nAreaList = AreaList.Count - 1; + for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++) { AreaList.Remove(AreaList[AreaList.Count - 1]); } @@ -1483,30 +1511,128 @@ namespace WebWindowTest m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } - - internal void SetSplitQty(int Qty, bool NotifyProperty = false) + internal void SetSplitQtyVert(int QtyVert, bool NotifyProperty = false) { - if (Qty > m_SplitPositionList.Count) + if (QtyVert > m_SplitVertList.Count) { // recupero larghezza ultimo double dLastDimension = 100; double dNewDimension = 100; - if (m_SplitPositionList.Count > 0) + if (m_SplitVertList.Count > 0) { - dLastDimension = m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension; - dNewDimension = dLastDimension / (Qty + 1 - nSplitQty); - m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension = dNewDimension; + dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension; + dNewDimension = dLastDimension / (QtyVert + 1 - nSplitQtyVert); + m_SplitVertList[m_SplitVertList.Count - 1].dDimension = dNewDimension; } else - dNewDimension = dLastDimension / (Qty + 1 - nSplitQty); + dNewDimension = dLastDimension / (QtyVert + 1 - nSplitQtyVert); // aggiungo area Split di default - for (var SplitIndex = m_SplitPositionList.Count; SplitIndex <= Qty; SplitIndex++) - SplitPositionList.Add(new SplitDimension(dNewDimension, true, this)); + for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= QtyVert; SplitIndex++) + m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true)); } - else if (Qty < m_SplitPositionList.Count) + else if (QtyVert < m_SplitVertList.Count) { - for (var SplitIndex = m_SplitPositionList.Count - 1; SplitIndex >= Qty; SplitIndex += -1) - SplitPositionList.RemoveAt(SplitIndex); + for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= QtyVert; SplitIndex += -1) + m_SplitVertList.RemoveAt(SplitIndex); + } + } + + public int nSplitQtyHoriz + { + get + { + return m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count - 1 : 0; + } + set + { + // Ricalcolo dimensioni aggiungendo split + if (value > m_SplitHorizList.Count - 1) + { + // recupero larghezza ultimo + double dLastDimension = 100; + double dNewDimension = 100; + if (m_SplitHorizList.Count > 0) + { + dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; + dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz); + m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension); + } + else + dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz); + // aggiungo area Split di default + for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++) + m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false)); + } + else if (value == 0) + { + m_SplitHorizList.RemoveAt(1); + m_SplitHorizList.RemoveAt(0); + } + // Ricalcolo dimensioni rimuovendo split + else + { + double dLastDimension = 0; + for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) + { + dLastDimension += m_SplitHorizList[SplitIndex].dDimension; + m_SplitHorizList.RemoveAt(SplitIndex); + } + dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; + m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dLastDimension); + } + // Controllo quanti split verticali ci sono + int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1; + // Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta + for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitHorizList.Count * nVert) - 1; SplitIndex++) + { + AreaList.Add(Splitted.CreateSplitted(this)); + Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS); + newFill.SetAreaType(AreaTypes.FILL); + AreaList[AreaList.Count - 1].AreaList.Add(newFill); + } + // Se ho più di uno split, elimino l'ultimo + if (AreaList.Count > 2) + { + int nAreaList = AreaList.Count - 1; + for (var SplitIndex = (m_SplitHorizList.Count * nVert); SplitIndex <= nAreaList; SplitIndex++) + { + AreaList.Remove(AreaList[AreaList.Count - 1]); + } + } + // Se elimino l'unico split presente + else + { + Splitted s = (Splitted)AreaList[0]; + s.SetParentArea(ParentArea); + ParentArea.AreaList.Add(s); + ParentArea.AreaList.Remove(this); + } + m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + } + } + internal void SetSplitQtyHoriz(int QtyHoriz, bool NotifyProperty = false) + { + if (QtyHoriz > m_SplitHorizList.Count) + { + // recupero larghezza ultimo + double dLastDimension = 100; + double dNewDimension = 100; + if (m_SplitHorizList.Count > 0) + { + dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; + dNewDimension = dLastDimension / (QtyHoriz + 1 - nSplitQtyHoriz); + m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension = dNewDimension; + } + else + dNewDimension = dLastDimension / (QtyHoriz + 1 - nSplitQtyHoriz); + // aggiungo area Split di default + for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= QtyHoriz; SplitIndex++) + m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false)); + } + else if (QtyHoriz < m_SplitHorizList.Count) + { + for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= QtyHoriz; SplitIndex += -1) + m_SplitHorizList.RemoveAt(SplitIndex); } } @@ -1535,6 +1661,39 @@ namespace WebWindowTest set { m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList); + // Cancello elementi nello split e azzero quantità orizzontale e verticale + AreaList.Clear(); + SetSplitQtyVert(0); + SetSplitQtyHoriz(0); + if (m_SelSplitShape == SplitShapes.VERTICAL) + { + // Inserisco valori di default + SetSplitQtyVert(1); + SetSplitStartVert(true); + } + else if (m_SelSplitShape == SplitShapes.HORIZONTAL) + { + // Inserisco valori di default + SetSplitQtyHoriz(1); + SetSplitStartVert(false); + } + else + { + // Inserisco valori di default + SetSplitQtyVert(1); + SetSplitQtyHoriz(1); + SetSplitStartVert(true); + } + // Aggiungo area Splitted e vetro + int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1; + int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1; + for (var SplitIndex = 0; SplitIndex <= (nVert * nHoriz) - 1; SplitIndex++) + { + AreaList.Add(Splitted.CreateSplitted(this)); + Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS); + newFill.SetAreaType(AreaTypes.FILL); + AreaList[SplitIndex].AreaList.Add(newFill); + } m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -1572,6 +1731,32 @@ namespace WebWindowTest } } + private ObservableCollection m_SplitVertList = new ObservableCollection(); + public ObservableCollection SplitVertList + { + get + { + return m_SplitVertList; + } + set + { + m_SplitVertList = value; + } + } + + private ObservableCollection m_SplitHorizList = new ObservableCollection(); + public ObservableCollection SplitHorizList + { + get + { + return m_SplitHorizList; + } + set + { + m_SplitHorizList = value; + } + } + public Split(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow) { } @@ -1591,7 +1776,9 @@ namespace WebWindowTest Split newSplit = new Split(newParentArea, ParentWindow); AddCounterGroup(); newSplit.SetIdGroup(nCounterGroup); - newSplit.SetSplitQty(nSplitQty); + newSplit.SetSplitStartVert(bSplitStartVert); + newSplit.SetSplitQtyVert(nSplitQtyVert); + newSplit.SetSplitQtyHoriz(nSplitQtyHoriz); newSplit.SetSplitShape(SelSplitShape, true); newSplit.SetAreaType(AreaType); foreach(var item in AreaList) @@ -1607,8 +1794,13 @@ namespace WebWindowTest if (nCounterGroup < IdGroup) Area.nCounterGroup = IdGroup; JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape, IdGroup); - foreach (var SplitPosition in m_SplitPositionList) - JsonSplit.SplitPositionList.Add(SplitPosition.Serialize()); + //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()); + foreach (var SplitHoriz in m_SplitHorizList) + JsonSplit.SplitHorizList.Add(SplitHoriz.Serialize()); foreach (var Area in AreaList) JsonSplit.AreaList.Add(Area.Serialize()); return JsonSplit; @@ -2413,6 +2605,20 @@ namespace WebWindowTest m_bIsRelative = value; } + private bool m_bIsVertListDim = false; + public bool bIsVertListDim + { + get + { + return m_bIsVertListDim; + } + } + internal void SetIsVertListDim(bool value) + { + m_bIsVertListDim = value; + } + + private double m_dDimension; public double dDimension { @@ -2428,8 +2634,13 @@ namespace WebWindowTest // se sono in percentuale if (m_bIsRelative) { + List RelativeDimList = new List(); + if (bIsVertListDim) + RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList(); + else + RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList(); // verifico se ci sono assoluti - List RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList(); + //List RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList(); if (RelativeDimList.Count > 0) { if (m_Parent.bIsPercentage) @@ -2500,14 +2711,15 @@ namespace WebWindowTest public SplitDimension Copy() { - SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent); + SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent, bIsVertListDim); return newSplitDim; } - public SplitDimension(double dDimension, bool bIsRelative, Split Parent) + public SplitDimension(double dDimension, bool bIsRelative, Split Parent, bool IsVertList) { m_dDimension = dDimension; m_bIsRelative = bIsRelative; m_Parent = Parent; + m_bIsVertListDim = IsVertList; } internal JsonSplitDimension Serialize()