diff --git a/Test.UI/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Test.UI/Components/Pages/Home.razor.cs index b7c4567..889a9ac 100644 --- a/Test.UI/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Test.UI/Components/Pages/Home.razor.cs @@ -69,11 +69,11 @@ namespace Test.UI.Components.Pages { string rawVal = ""; // brutale,d a rivedere... - if (File.Exists(selTemp.TemplFile)) + if (File.Exists(selTemp.JwdFileName)) { - rawVal = File.ReadAllText(selTemp.TemplFile); + rawVal = File.ReadAllText(selTemp.JwdFileName); } - SelTemplate = new Template(selTemp.Index, selTemp.Description, rawVal, selTemp.TemplSVG); + SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal); } #endregion Private Methods diff --git a/Test.UI/Test.UI/Data/Setup.json b/Test.UI/Test.UI/Data/Setup.json index 905d2ca..ec98f9c 100644 --- a/Test.UI/Test.UI/Data/Setup.json +++ b/Test.UI/Test.UI/Data/Setup.json @@ -2,27 +2,32 @@ { "Index": 1, "Description": "Anta singola", - "TemplFile": "Data/AntaSingola.jwd" + "SVGFileName": "Images/ImgRouter/Singola.svg", + "JwdFileName": "Data/AntaSingola.jwd" }, { "Index": 2, "Description": "Anta doppia", - "TemplFile": "Data/AntaDoppia.jwd" + "SVGFileName": "Images/ImgRouter/Doppia.svg", + "JwdFileName": "Data/AntaDoppia.jwd" }, { "Index": 3, "Description": "Finestra con split verticale", - "TemplFile": "Data/FinestraSplitVert.jwd" + "SVGFileName": "", + "JwdFileName": "Data/FinestraSplitVert.jwd" }, { "Index": 4, "Description": "Finestra con split verticale e orizzontale", - "TemplFile": "Data/FinestraSplitVertOriz.jwd" + "SVGFileName": "", + "JwdFileName": "Data/FinestraSplitVertOriz.jwd" }, { "Index": 5, "Description": "Finestra con split orizzontale (sopra due ante e sotto vetro fisso)", - "TemplFile": "Data/FinDueAnteBottomFisso.jwd" + "SVGFileName": "", + "JwdFileName": "Data/FinDueAnteBottomFisso.jwd" } ] \ No newline at end of file diff --git a/Test.UI/Test.UI/Test.UI.csproj b/Test.UI/Test.UI/Test.UI.csproj index e60dbb2..e9af1ed 100644 --- a/Test.UI/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI/Test.UI.csproj @@ -14,6 +14,12 @@ Always + + Always + + + Always + diff --git a/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Doppia.svg b/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Doppia.svg new file mode 100644 index 0000000..b5c13ac --- /dev/null +++ b/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Doppia.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Singola.svg b/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Singola.svg new file mode 100644 index 0000000..7f736b0 --- /dev/null +++ b/Test.UI/Test.UI/wwwroot/Images/ImgRouter/Singola.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs b/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs index 840f7b4..98d44ea 100644 --- a/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs +++ b/WebWindowConfigurator/DTO/TemplateSelectorDTO.cs @@ -10,7 +10,7 @@ namespace WebWindowConfigurator.DTO { public int Index { get; set; } = 0; public string Description { get; set; } = ""; - public string TemplFile { get; set; } = ""; - public string TemplSVG { get; set; } = ""; + public string JwdFileName { get; set; } = ""; + public string SVGFileName { get; set; } = ""; } } diff --git a/WebWindowConfigurator/Template.cs b/WebWindowConfigurator/Template.cs index 39dbd23..d88962d 100644 --- a/WebWindowConfigurator/Template.cs +++ b/WebWindowConfigurator/Template.cs @@ -37,12 +37,12 @@ namespace WebWindowConfigurator } } - public Template(int nIndex, string sDescription, string JWD, string SVG) + public Template(int nIndex, string sDescription, string SVG, string JWD) { m_nIndex = nIndex; this.sDescription = sDescription; - m_JWD = JWD; m_SVG = SVG; + m_JWD = JWD; } } } diff --git a/WebWindowConfigurator/WebWindowMaker.razor b/WebWindowConfigurator/WebWindowMaker.razor index c4fa21b..84ec5df 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor +++ b/WebWindowConfigurator/WebWindowMaker.razor @@ -58,11 +58,11 @@
@if (currStep == CompileStep.Template) { - +
- + @@ -74,9 +74,9 @@ colorClass = "table-success"; else colorClass = ""; - + - + } @@ -91,8 +91,8 @@
- - @@ -106,11 +106,11 @@
Dimensioni
- @foreach (FrameDimension dimension in m_frame.DimensionList) + @foreach (FrameDimension dimension in m_Frame.DimensionList) {
- @dimension.nIndex - @dimension.sName + @dimension.nIndex + @dimension.sName
} @@ -119,10 +119,10 @@
Giunzioni telaio
- @foreach (Joint joint in m_frame.JointList) + @foreach (Joint joint in m_Frame.JointList) {
- + +
- +
- Quantità - + Quantità +
@@ -153,23 +153,123 @@
- @m_SelSVG + @*img*@
} else if (currStep == CompileStep.Split) { -
- aggiungi montanti - @* *@ +
+
+
+
+ @foreach(var item in SplitList) + { +
+
+
+ Numero + +
+
+ + +
+ @foreach (var dim in item.SplitPositionList) + { +
+ Altezza area inferiore + +
+ } +
+
+ } + @* *@ +
+
+
+ @*img*@ +
+
} else if (currStep == CompileStep.Sash) { -
- aggiungi caratteristiche finestra - @* *@ +
+
+
+
+ @foreach (var item in SashList) + { +
+
+ Numero + +
+
+
+
+
Orientamento
+
+ + +
+
+ + +
+
+
+ +
+
+
Giunzioni ante
+ @foreach (Joint joint in item.JointList) + { +
+ + +
+ } +
+
+
+
+
Bottom rail
+
+
+ +
+
+ +
+
+
+ Quantità + +
+
+
+ } + + @* *@ +
+
+
+ @* img *@ +
+
} else if (currStep == CompileStep.Fill) @@ -231,7 +331,7 @@ @if (currStep == CompileStep.General) {
- @foreach (FrameDimension dimension in m_frame.DimensionList) + @foreach (FrameDimension dimension in m_Frame.DimensionList) {
@dimension.nIndex diff --git a/WebWindowConfigurator/WebWindowMaker.razor.cs b/WebWindowConfigurator/WebWindowMaker.razor.cs index 88b6c55..33c66fc 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor.cs +++ b/WebWindowConfigurator/WebWindowMaker.razor.cs @@ -36,6 +36,7 @@ namespace WebWindowConfigurator m_SelTemplate = value; JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()); m_CurrWindow = WindowFromJson.Deserialize(); + SearchInAreaList(m_CurrWindow.AreaList[0]); m_SelSVG = m_SelTemplate.SVG; } } @@ -46,7 +47,6 @@ namespace WebWindowConfigurator public TemplateSelectDTO? SelTemplateDTO { get; set; } = null; - public Area m_SelArea { get; set; } = null!; public string m_SelSVG { get; set; } = ""; #endregion Public Properties @@ -66,9 +66,11 @@ namespace WebWindowConfigurator #region Protected Properties - protected Frame m_frame + private Frame m_Frame; + protected Frame Frame { - get => (Frame)m_CurrWindow.AreaList[0]; + get => m_Frame; + set => m_Frame = value; } #endregion Protected Properties @@ -116,6 +118,56 @@ namespace WebWindowConfigurator #region Private Methods + private List m_SashList = new List(); + public List SashList + { + get => m_SashList; + } + private List m_FillList = new List(); + public List FillList + { + get => m_FillList; + } + private List m_SplitList = new List(); + public List SplitList + { + get => m_SplitList; + } + + public void SearchInAreaList(Area node) + { + if (node != null) + { + switch (node.AreaType) + { + case AreaTypes.FRAME: + { + m_Frame = (Frame)node; + break; + } + case AreaTypes.SASH: + { + m_SashList.Add((Sash)node); + break; + } + case AreaTypes.FILL: + { + m_FillList.Add((Fill)node); + break; + } + case AreaTypes.SPLIT: + { + m_SplitList.Add((Split)node); + break; + } + } + foreach (var item in node.AreaList) + { + SearchInAreaList(item); + } + } + } + private void AdvStep(CompileStep newStep) { currStep = newStep; diff --git a/WebWindowConfigurator/Window.cs b/WebWindowConfigurator/Window.cs index ac65959..89083e1 100644 --- a/WebWindowConfigurator/Window.cs +++ b/WebWindowConfigurator/Window.cs @@ -129,38 +129,145 @@ namespace WebWindowConfigurator new IdNameStruct((int)Shapes.DOUBLEARC, "Double Arc"), new IdNameStruct((int)Shapes.TRIANGLE, "Triangle") }; - public ObservableCollection ShapeList - { - get + public ObservableCollection ShapeList { - return m_ShapeList; + get + { + return m_ShapeList; + } } - } - private Shapes m_Shape; - public Shapes Shape - { - get + private Shapes m_Shape; + public Shapes Shape { - return m_Shape; + get + { + return m_Shape; + } } - } - public int SelShapeIndex - { - get + public int SelShapeIndex { - return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + get + { + return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + } + set + { + Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); + if (m_Shape != SelShape) + { + // verifico parametri Dimension + DimensionList.Clear(); + // aggiungo Dimensioni + switch (SelShape) + { + case Shapes.RECTANGLE: + case Shapes.ARC_FULL: + { + DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); + DimensionList.Add(new FrameDimension(2, "Height", 1800, true)); + break; + } + + case Shapes.RIGHTCHAMFER: + { + DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); + DimensionList.Add(new FrameDimension(2, "Left Height", 1800, true)); + DimensionList.Add(new FrameDimension(3, "Right Height", 1500, true)); + break; + } + + case Shapes.LEFTCHAMFER: + { + DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); + DimensionList.Add(new FrameDimension(2, "Left Height", 1500, true)); + DimensionList.Add(new FrameDimension(3, "Right Height", 1800, true)); + break; + } + + case Shapes.DOUBLECHAMFER: + case Shapes.ARC: + { + DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); + DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); + DimensionList.Add(new FrameDimension(3, "Full Height", 1800, true)); + break; + } + + case Shapes.DOUBLEARC: + { + DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); + DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); + DimensionList.Add(new FrameDimension(3, "Full Height", 2400, true)); + break; + } + + case Shapes.TRIANGLE: + { + DimensionList.Add(new FrameDimension(1, "Width", 2000, true)); + DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); + DimensionList.Add(new FrameDimension(3, "Height projection", 0, true)); + break; + } + + case Shapes.CUSTOM: + { + DimensionList.Clear(); + break; + } + } + // aggiungo Joint + m_JointList.Clear(); + switch (SelShape) + { + case Shapes.RECTANGLE: + case Shapes.RIGHTCHAMFER: + case Shapes.LEFTCHAMFER: + case Shapes.DOUBLECHAMFER: + case Shapes.ARC: + case Shapes.DOUBLEARC: + { + JointList.Add(new Joint(1, Joints.FULL_H)); + JointList.Add(new Joint(2, Joints.FULL_H)); + JointList.Add(new Joint(3, Joints.FULL_H)); + JointList.Add(new Joint(4, Joints.FULL_H)); + break; + } + + case Shapes.ARC_FULL: + { + JointList.Add(new Joint(1, Joints.FULL_H)); + JointList.Add(new Joint(2, Joints.FULL_H)); + JointList.Add(new Joint(3, Joints.ANGLED)); + JointList.Add(new Joint(4, Joints.ANGLED)); + break; + } + + case Shapes.TRIANGLE: + { + JointList.Add(new Joint(1, Joints.FULL_H)); + JointList.Add(new Joint(2, Joints.FULL_H)); + JointList.Add(new Joint(3, Joints.ANGLED)); + break; + } + + case Shapes.CUSTOM: + { + JointList.Clear(); + break; + } + } + m_Shape = SelShape; + } + } } - set - { - Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); - if (m_Shape != SelShape) - { - // verifico parametri Dimension + + internal void SetSelShape(Shapes Value) + { DimensionList.Clear(); - // aggiungo Dimensioni - switch (SelShape) + // aggiungo Dimension + switch (Value) { case Shapes.RECTANGLE: case Shapes.ARC_FULL: @@ -218,8 +325,8 @@ namespace WebWindowConfigurator } } // aggiungo Joint - m_JointList.Clear(); - switch (SelShape) + int nJointQty = 4; + switch (Value) { case Shapes.RECTANGLE: case Shapes.RIGHTCHAMFER: @@ -258,263 +365,156 @@ namespace WebWindowConfigurator break; } } - m_Shape = SelShape; + m_Shape = Value; + } + + private ObservableCollection m_DimensionList = new ObservableCollection(); + public ObservableCollection DimensionList + { + get + { + return m_DimensionList; } } - } - - internal void SetSelShape(Shapes Value) + + private ObservableCollection m_JointList = new ObservableCollection(); + public ObservableCollection JointList { - DimensionList.Clear(); - // aggiungo Dimension - switch (Value) + get + { + return m_JointList; + } + set + { + m_JointList = value; + } + } + + private bool m_bBottomRail; + public bool BottomRail + { + get + { + return m_bBottomRail; + } + set + { + m_bBottomRail = value; + } + } + internal void SetBottomRail(bool bBottomRail) + { + m_bBottomRail = bBottomRail; + } + + private int m_nBottomRailQty = 0; + public int BottomRailQty + { + get + { + return m_nBottomRailQty; + } + set + { + m_nBottomRailQty = value; + } + } + internal void SetBottomRailQty(int nBottomRailQty) + { + m_nBottomRailQty = nBottomRailQty; + } + + private ObservableCollection m_Outline; + public ObservableCollection Outline + { + get + { + return m_Outline; + } + set + { + m_Outline = value; + } + } + + public Frame(Area ParentArea) : base(ParentArea) + { + } + + internal static Area CreateFrame(Window Window) + { + Frame NewFrame = new Frame(null/* TODO Change to default(_) if this is not a reference type */); + NewFrame.SetAreaType(AreaTypes.FRAME); + NewFrame.SetSelShape(Shapes.RECTANGLE); + NewFrame.SetBottomRail(false); + NewFrame.SetBottomRailQty(0); + return NewFrame; + } + + private LuaShapes ConvertShape(Shapes value) + { + switch (value) { case Shapes.RECTANGLE: - case Shapes.ARC_FULL: { - DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); - DimensionList.Add(new FrameDimension(2, "Height", 1800, true)); - break; + return LuaShapes.RECT; } case Shapes.RIGHTCHAMFER: { - DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); - DimensionList.Add(new FrameDimension(2, "Left Height", 1800, true)); - DimensionList.Add(new FrameDimension(3, "Right Height", 1500, true)); - break; + return LuaShapes.CHAMFER_SIDE; } case Shapes.LEFTCHAMFER: { - DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); - DimensionList.Add(new FrameDimension(2, "Left Height", 1500, true)); - DimensionList.Add(new FrameDimension(3, "Right Height", 1800, true)); - break; + return LuaShapes.CHAMFER_SIDE; } case Shapes.DOUBLECHAMFER: + { + return LuaShapes.CHAMFER; + } + case Shapes.ARC: { - DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); - DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); - DimensionList.Add(new FrameDimension(3, "Full Height", 1800, true)); - break; - } - - case Shapes.DOUBLEARC: - { - DimensionList.Add(new FrameDimension(1, "Width", 1500, true)); - DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); - DimensionList.Add(new FrameDimension(3, "Full Height", 2400, true)); - break; - } - - case Shapes.TRIANGLE: - { - DimensionList.Add(new FrameDimension(1, "Width", 2000, true)); - DimensionList.Add(new FrameDimension(2, "Height", 1500, true)); - DimensionList.Add(new FrameDimension(3, "Height projection", 0, true)); - break; - } - - case Shapes.CUSTOM: - { - DimensionList.Clear(); - break; - } - } - // aggiungo Joint - int nJointQty = 4; - switch (Value) - { - case Shapes.RECTANGLE: - case Shapes.RIGHTCHAMFER: - case Shapes.LEFTCHAMFER: - case Shapes.DOUBLECHAMFER: - case Shapes.ARC: - case Shapes.DOUBLEARC: - { - JointList.Add(new Joint(1, Joints.FULL_H)); - JointList.Add(new Joint(2, Joints.FULL_H)); - JointList.Add(new Joint(3, Joints.FULL_H)); - JointList.Add(new Joint(4, Joints.FULL_H)); - break; + return LuaShapes.SEGMENTAL_ARC; } case Shapes.ARC_FULL: { - JointList.Add(new Joint(1, Joints.FULL_H)); - JointList.Add(new Joint(2, Joints.FULL_H)); - JointList.Add(new Joint(3, Joints.ANGLED)); - JointList.Add(new Joint(4, Joints.ANGLED)); - break; + return LuaShapes.ROUND_ARC; + } + + case Shapes.DOUBLEARC: + { + return LuaShapes.POINTED_ARC; } case Shapes.TRIANGLE: { - JointList.Add(new Joint(1, Joints.FULL_H)); - JointList.Add(new Joint(2, Joints.FULL_H)); - JointList.Add(new Joint(3, Joints.ANGLED)); - break; + return LuaShapes.TRIANGLE; } - case Shapes.CUSTOM: + default: { - JointList.Clear(); - break; + return LuaShapes.RECT; } } - m_Shape = Value; } - private ObservableCollection m_DimensionList = new ObservableCollection(); - public ObservableCollection DimensionList - { - get + internal override JsonArea Serialize() { - return m_DimensionList; + JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty); + foreach (var Dimension in DimensionList) + JsonFrame.DimensionList.Add(Dimension.Serialize()); + foreach (var Joint in JointList) + JsonFrame.JointList.Add(Joint.Serialize()); + foreach (var Area in AreaList) + JsonFrame.AreaList.Add(Area.Serialize()); + return JsonFrame; } } - private ObservableCollection m_JointList = new ObservableCollection(); - public ObservableCollection JointList - { - get - { - return m_JointList; - } - set - { - m_JointList = value; - } - } - - private bool m_bBottomRail; - public bool BottomRail - { - get - { - return m_bBottomRail; - } - set - { - m_bBottomRail = value; - } - } - internal void SetBottomRail(bool bBottomRail) - { - m_bBottomRail = bBottomRail; - } - - private int m_nBottomRailQty = 0; - public int BottomRailQty - { - get - { - return m_nBottomRailQty; - } - set - { - m_nBottomRailQty = value; - } - } - internal void SetBottomRailQty(int nBottomRailQty) - { - m_nBottomRailQty = nBottomRailQty; - } - - private ObservableCollection m_Outline; - public ObservableCollection Outline - { - get - { - return m_Outline; - } - set - { - m_Outline = value; - } - } - - public Frame(Area ParentArea) : base(ParentArea) - { - } - - internal static Area CreateFrame(Window Window) - { - Frame NewFrame = new Frame(null/* TODO Change to default(_) if this is not a reference type */); - NewFrame.SetAreaType(AreaTypes.FRAME); - NewFrame.SetSelShape(Shapes.RECTANGLE); - NewFrame.SetBottomRail(false); - NewFrame.SetBottomRailQty(0); - return NewFrame; - } - - private LuaShapes ConvertShape(Shapes value) - { - switch (value) - { - case Shapes.RECTANGLE: - { - return LuaShapes.RECT; - } - - case Shapes.RIGHTCHAMFER: - { - return LuaShapes.CHAMFER_SIDE; - } - - case Shapes.LEFTCHAMFER: - { - return LuaShapes.CHAMFER_SIDE; - } - - case Shapes.DOUBLECHAMFER: - { - return LuaShapes.CHAMFER; - } - - case Shapes.ARC: - { - return LuaShapes.SEGMENTAL_ARC; - } - - case Shapes.ARC_FULL: - { - return LuaShapes.ROUND_ARC; - } - - case Shapes.DOUBLEARC: - { - return LuaShapes.POINTED_ARC; - } - - case Shapes.TRIANGLE: - { - return LuaShapes.TRIANGLE; - } - - default: - { - return LuaShapes.RECT; - } - } - } - - internal override JsonArea Serialize() - { - JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty); - foreach (var Dimension in DimensionList) - JsonFrame.DimensionList.Add(Dimension.Serialize()); - foreach (var Joint in JointList) - JsonFrame.JointList.Add(Joint.Serialize()); - foreach (var Area in AreaList) - JsonFrame.AreaList.Add(Area.Serialize()); - return JsonFrame; - } -} - public class Sash : Area { public int nSashQty
#ImageImage Description
@item.Index@item.TemplSVG @item.Description