diff --git a/Test.UI/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Test.UI/Components/Pages/Home.razor.cs index a1623da..b7c4567 100644 --- a/Test.UI/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Test.UI/Components/Pages/Home.razor.cs @@ -10,7 +10,7 @@ namespace Test.UI.Components.Pages { #region Public Properties - public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", ""); + public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "",""); #endregion Public Properties @@ -73,7 +73,7 @@ namespace Test.UI.Components.Pages { rawVal = File.ReadAllText(selTemp.TemplFile); } - SelTemplate = new Template(selTemp.Index, selTemp.Description, rawVal); + SelTemplate = new Template(selTemp.Index, selTemp.Description, rawVal, selTemp.TemplSVG); } #endregion Private Methods diff --git a/Test.UI/Test.UI/Data/FinDueAnteBottomFisso.jwd b/Test.UI/Test.UI/Data/FinDueAnteBottomFisso.jwd new file mode 100644 index 0000000..36f9952 --- /dev/null +++ b/Test.UI/Test.UI/Data/FinDueAnteBottomFisso.jwd @@ -0,0 +1,132 @@ +{ + "ProfilePath": "Profilo78", + "AreaList": [ + { + "Shape": "RECTANGLE", + "DimensionList": [ + { + "nIndex": 1, + "sName": "Width", + "dValue": 1500.0 + }, + { + "nIndex": 2, + "sName": "Height", + "dValue": 2100.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": [ + { + "SplitShape": "HORIZONTAL", + "SplitPositionList": [ + { + "bIsRelative": true, + "dDimension": 40.0 + }, + { + "bIsRelative": true, + "dDimension": 60.0 + } + ], + "AreaList": [ + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "bIsSashVertical": true, + "SashList": [ + { + "OpeningType": "TURNONLY_LEFT", + "bHasHandle": false, + "dDimension": 50.0 + }, + { + "OpeningType": "TILTTURN_RIGHT", + "bHasHandle": true, + "dDimension": 50.0 + } + ], + "SashType": "NULL", + "JointList": [ + { + "nIndex": 1, + "JointType": "FULL_H" + }, + { + "nIndex": 2, + "JointType": "FULL_H" + }, + { + "nIndex": 3, + "JointType": "FULL_H" + }, + { + "nIndex": 4, + "JointType": "FULL_H" + } + ], + "Hardware": "000000", + "AreaList": [ + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SASH" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SPLIT" + } + ], + "AreaType": "FRAME" + } + ] +} \ No newline at end of file diff --git a/Test.UI/Test.UI/Data/FinestraSplitVert.jwd b/Test.UI/Test.UI/Data/FinestraSplitVert.jwd new file mode 100644 index 0000000..b8dc284 --- /dev/null +++ b/Test.UI/Test.UI/Data/FinestraSplitVert.jwd @@ -0,0 +1,79 @@ +{ + "ProfilePath": "Profilo78", + "AreaList": [ + { + "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": [ + { + "SplitShape": "VERTICAL", + "SplitPositionList": [ + { + "bIsRelative": true, + "dDimension": 50.0 + }, + { + "bIsRelative": true, + "dDimension": 50.0 + } + ], + "AreaList": [ + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SPLIT" + } + ], + "AreaType": "FRAME" + } + ] +} \ No newline at end of file diff --git a/Test.UI/Test.UI/Data/FinestraSplitVertOriz.jwd b/Test.UI/Test.UI/Data/FinestraSplitVertOriz.jwd new file mode 100644 index 0000000..e8380b3 --- /dev/null +++ b/Test.UI/Test.UI/Data/FinestraSplitVertOriz.jwd @@ -0,0 +1,141 @@ +{ + "ProfilePath": "Profilo78", + "AreaList": [ + { + "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": [ + { + "SplitShape": "VERTICAL", + "SplitPositionList": [ + { + "bIsRelative": true, + "dDimension": 50.0 + }, + { + "bIsRelative": true, + "dDimension": 50.0 + } + ], + "AreaList": [ + { + "AreaList": [ + { + "SplitShape": "HORIZONTAL", + "SplitPositionList": [ + { + "bIsRelative": true, + "dDimension": 40.0 + }, + { + "bIsRelative": true, + "dDimension": 60.0 + } + ], + "AreaList": [ + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SPLIT" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "SplitShape": "HORIZONTAL", + "SplitPositionList": [ + { + "bIsRelative": true, + "dDimension": 40.0 + }, + { + "bIsRelative": true, + "dDimension": 60.0 + } + ], + "AreaList": [ + { + "AreaList": [ + { + "FillType": "GLASS", + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "AreaList": [ + { + "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/Test.UI/Data/Setup.json b/Test.UI/Test.UI/Data/Setup.json index 3354e02..905d2ca 100644 --- a/Test.UI/Test.UI/Data/Setup.json +++ b/Test.UI/Test.UI/Data/Setup.json @@ -8,5 +8,21 @@ "Index": 2, "Description": "Anta doppia", "TemplFile": "Data/AntaDoppia.jwd" + }, + { + "Index": 3, + "Description": "Finestra con split verticale", + "TemplFile": "Data/FinestraSplitVert.jwd" + }, + { + "Index": 4, + "Description": "Finestra con split verticale e orizzontale", + "TemplFile": "Data/FinestraSplitVertOriz.jwd" + }, + { + "Index": 5, + "Description": "Finestra con split orizzontale (sopra due ante e sotto vetro fisso)", + "TemplFile": "Data/FinDueAnteBottomFisso.jwd" } + ] \ No newline at end of file diff --git a/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs b/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs index 8d34f80..840f7b4 100644 --- a/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs +++ b/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs @@ -8,9 +8,9 @@ namespace WebWindowConfigurator.DTO { public class TemplateSelectDTO { - public int Index { get; set; } = 0; public string Description { get; set; } = ""; public string TemplFile { get; set; } = ""; + public string TemplSVG { get; set; } = ""; } } diff --git a/WebWindowConfigurator/Json/JsonUtility.cs b/WebWindowConfigurator/Json/JsonUtility.cs index 3576651..f3c2456 100644 --- a/WebWindowConfigurator/Json/JsonUtility.cs +++ b/WebWindowConfigurator/Json/JsonUtility.cs @@ -276,34 +276,40 @@ namespace WebWindowConfigurator.Json { } - public JsonSash(bool bIsSashVertical, SashTypes SashType, string Hardware) : base(AreaTypes.SASH) + public JsonSash(bool bIsSashVertical, SashTypes SashType/*, string Hardware*/) : base(AreaTypes.SASH) { m_bIsSashVertical = bIsSashVertical; m_SashType = SashType; m_Hardware = Hardware; } - //internal override Area Deserialize(Area ParentArea) - //{ - // Sash Sash = new Sash(ParentArea); - // Sash.SetAreaType(AreaTypes.SASH); - // Sash.SetSashQty(m_SashList.Count); - // Sash.SetIsSashVertical(m_bIsSashVertical); - // Sash.AppliedDone(); - // for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++) - // { - // Sash.SashList(SashIndex).SetOpeningType(m_SashList[SashIndex].OpeningType); - // Sash.SashList(SashIndex).SetHasHandle(m_SashList[SashIndex].bHasHandle); - // Sash.SashList(SashIndex).SetDimension(m_SashList[SashIndex].dDimension); - // } - // foreach (var Joint in m_JointList) - // Sash.JointList.Add(Joint.Deserialize()); - // Sash.RefreshHardwareList(); - // Sash.SetSelHardwareFromId(Hardware); - // foreach (var Area in JsonArea.AreaList) - // Sash.AreaList.Add(Area.Deserialize(Sash)); - // return Sash; - //} + internal override Area Deserialize(Area ParentArea) + { + Sash Sash = new Sash(ParentArea); + Sash.SetAreaType(AreaTypes.SASH); + Sash.SetSashQty(m_SashList.Count); + Sash.SetIsSashVertical(m_bIsSashVertical); + //Sash.AppliedDone(); + for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++) + { + Sash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType); + Sash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].bHasHandle); + Sash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].dDimension); + } + foreach (var Joint in m_JointList) + Sash.JointList.Add(Joint.Deserialize()); + //Sash.RefreshHardwareList(); + //Sash.SetSelHardwareFromId(Hardware); + foreach (var Area in AreaList) + { + var AreaDeserealized = Area.Deserialize(Sash); + if (AreaDeserealized != null) + { + Sash.AreaList.Add(AreaDeserealized); + } + } + return Sash; + } } public class JsonSplit : JsonArea @@ -346,22 +352,28 @@ namespace WebWindowConfigurator.Json m_SplitShape = SplitShape; } - //internal override Area Deserialize(Area ParentArea) - //{ - // Split Split = new Split(ParentArea); - // 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.SplitPositionList(SplitIndex).SetIsRelative(m_SplitPositionList[SplitIndex].bIsRelative); - // Split.SplitPositionList(SplitIndex).SetDimension(m_SplitPositionList[SplitIndex].dDimension); - // } - // foreach (var Area in JsonArea.AreaList) - // Split.AreaList.Add(Area.Deserialize(Split)); - // return Split; - //} + internal override Area Deserialize(Area ParentArea) + { + Split Split = new Split(ParentArea); + 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.SplitPositionList[SplitIndex].SetIsRelative(m_SplitPositionList[SplitIndex].bIsRelative); + Split.SplitPositionList[SplitIndex].SetDimension(m_SplitPositionList[SplitIndex].dDimension); + } + foreach (var Area in AreaList) + { + var AreaDeserealized = Area.Deserialize(Split); + if (AreaDeserealized != null) + { + Split.AreaList.Add(AreaDeserealized); + } + } + return Split; + } } public class JsonSplitted : JsonArea @@ -370,15 +382,22 @@ namespace WebWindowConfigurator.Json { } - //internal override Area Deserialize(Area ParentArea) - //{ - // Splitted Split = new Splitted(ParentArea); - // Split.SetAreaType(AreaTypes.SPLITTED); - // Split.AppliedDone(); - // foreach (var Area in JsonArea.AreaList) - // Split.AreaList.Add(Area.Deserialize(Split)); - // return Split; - //} + internal override Area Deserialize(Area ParentArea) + { + Splitted Split = new Splitted(ParentArea); + Split.SetAreaType(AreaTypes.SPLITTED); + //Split.AppliedDone(); + foreach (var Area in AreaList) + { + var AreaDeserealized = Area.Deserialize(Split); + if (AreaDeserealized != null) + { + Split.AreaList.Add(AreaDeserealized); + } + } + + return Split; + } } public class JsonFill : JsonArea @@ -407,16 +426,22 @@ namespace WebWindowConfigurator.Json m_FillType = FillType; } - //internal override Area Deserialize(Area ParentArea) - //{ - // Fill Fill = new Fill(ParentArea); - // Fill.SetAreaType(AreaTypes.FILL); - // Fill.SetFillType(m_FillType); - // Fill.AppliedDone(); - // foreach (var Area in JsonArea.AreaList) - // Fill.AreaList.Add(Area.Deserialize(Fill)); - // return Fill; - //} + internal override Area Deserialize(Area ParentArea) + { + Fill Fill = new Fill(ParentArea); + Fill.SetAreaType(AreaTypes.FILL); + Fill.SetFillType(m_FillType); + //Fill.AppliedDone(); + foreach (var Area in AreaList) + { + var AreaDeserealized = Area.Deserialize(Fill); + if (AreaDeserealized != null) + { + Fill.AreaList.Add(AreaDeserealized); + } + } + return Fill; + } } public class JsonJoint @@ -452,11 +477,11 @@ namespace WebWindowConfigurator.Json m_JointType = JointType; } - //internal Joint Deserialize() - //{ - // Joint Joint = new Joint(m_nIndex, m_JointType); - // return Joint; - //} + internal Joint Deserialize() + { + Joint Joint = new Joint(m_nIndex, m_JointType); + return Joint; + } } public class JsonCurve diff --git a/WebWindowConfigurator/Template.cs b/WebWindowConfigurator/Template.cs index 399ea7a..39dbd23 100644 --- a/WebWindowConfigurator/Template.cs +++ b/WebWindowConfigurator/Template.cs @@ -28,11 +28,21 @@ namespace WebWindowConfigurator } } - public Template(int nIndex, string sDescription, string JWDTemplate) + private string m_SVG; + public string SVG + { + get + { + return m_SVG; + } + } + + public Template(int nIndex, string sDescription, string JWD, string SVG) { m_nIndex = nIndex; this.sDescription = sDescription; - m_JWD = JWDTemplate; + m_JWD = JWD; + m_SVG = SVG; } } } diff --git a/WebWindowConfigurator/WebWindowMaker.razor b/WebWindowConfigurator/WebWindowMaker.razor index 5325328..c4fa21b 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor +++ b/WebWindowConfigurator/WebWindowMaker.razor @@ -1,59 +1,69 @@
| # | Image | -Description | +Description | |
|---|---|---|---|---|
| @item.Index | -... | -@item.Description | +@item.TemplSVG | +@item.Description |