Inizio spacchettamento file window delle classi di base del modello
This commit is contained in:
@@ -0,0 +1,397 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowComplex.Json;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
public class Frame : Area
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public Frame(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool BottomRail
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bBottomRail;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bBottomRail = value;
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public int BottomRailQty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nBottomRailQty;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_nBottomRailQty >= 0)
|
||||
{
|
||||
m_nBottomRailQty = value;
|
||||
if (m_nBottomRailQty > 0)
|
||||
{
|
||||
m_bBottomRail = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bBottomRail = false;
|
||||
}
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public List<FrameDimension> DimensionList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_DimensionList;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Joint> JointList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JointList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_JointList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelShapeIndex
|
||||
{
|
||||
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(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1800, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1500, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.LEFTCHAMFER:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLECHAMFER:
|
||||
case Shapes.ARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLEARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.TRIANGLE:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 2000, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Height projection", 0, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.CUSTOM:
|
||||
{
|
||||
DimensionList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// salvo tipo Joint
|
||||
Joints oldJointType = JointList[0].SelJointType;
|
||||
// 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(this, 1, oldJointType));
|
||||
JointList.Add(new Joint(this, 2, oldJointType));
|
||||
JointList.Add(new Joint(this, 3, oldJointType));
|
||||
JointList.Add(new Joint(this, 4, oldJointType));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.ARC_FULL:
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
case Shapes.TRIANGLE:
|
||||
{
|
||||
JointList.Add(new Joint(this, 1, oldJointType));
|
||||
JointList.Add(new Joint(this, 2, oldJointType));
|
||||
JointList.Add(new Joint(this, 3, Joints.ANGLED));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.CUSTOM:
|
||||
{
|
||||
JointList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Shape = SelShape;
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public Shapes Shape
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Shape;
|
||||
}
|
||||
}
|
||||
|
||||
public List<IdNameStruct> ShapeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ShapeList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override Frame Copy(Area ParentArea)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal static Area CreateFrame(Window Window)
|
||||
{
|
||||
Frame NewFrame = new Frame(null, Window);
|
||||
NewFrame.SetAreaType(AreaTypes.FRAME);
|
||||
NewFrame.SetSelShape(Shapes.RECTANGLE);
|
||||
NewFrame.SetBottomRail(false);
|
||||
NewFrame.SetBottomRailQty(0);
|
||||
return NewFrame;
|
||||
}
|
||||
|
||||
internal override JsonArea Serialize()
|
||||
{
|
||||
Area.nCounterGroup = 0;
|
||||
if (nCounterGroup < IdGroup)
|
||||
Area.nCounterGroup = IdGroup;
|
||||
JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty, IdGroup);
|
||||
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;
|
||||
}
|
||||
|
||||
internal void SetBottomRail(bool bBottomRail)
|
||||
{
|
||||
m_bBottomRail = bBottomRail;
|
||||
}
|
||||
|
||||
internal void SetBottomRailQty(int nBottomRailQty)
|
||||
{
|
||||
m_nBottomRailQty = nBottomRailQty;
|
||||
}
|
||||
|
||||
internal void SetSelShape(Shapes Value)
|
||||
{
|
||||
DimensionList.Clear();
|
||||
// aggiungo Dimension
|
||||
switch (Value)
|
||||
{
|
||||
case Shapes.RECTANGLE:
|
||||
case Shapes.ARC_FULL:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1800, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1500, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.LEFTCHAMFER:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLECHAMFER:
|
||||
case Shapes.ARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLEARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.TRIANGLE:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", 2000, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 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(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, 3, Joints.ANGLED));
|
||||
JointList.Add(new Joint(this, 4, Joints.ANGLED));
|
||||
break;
|
||||
}
|
||||
|
||||
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, 3, Joints.ANGLED));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.CUSTOM:
|
||||
{
|
||||
JointList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Shape = Value;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool m_bBottomRail;
|
||||
|
||||
private List<FrameDimension> m_DimensionList = new List<FrameDimension>();
|
||||
|
||||
private List<Joint> m_JointList = new List<Joint>();
|
||||
|
||||
private int m_nBottomRailQty = 0;
|
||||
|
||||
private Shapes m_Shape;
|
||||
|
||||
private List<IdNameStruct> m_ShapeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)Shapes.RECTANGLE, "Rectangle"),
|
||||
new IdNameStruct((int)Shapes.RIGHTCHAMFER, "Right Chamfer"),
|
||||
new IdNameStruct((int)Shapes.LEFTCHAMFER, "Left Chamfer"),
|
||||
new IdNameStruct((int)Shapes.DOUBLECHAMFER, "Double Chamfer"),
|
||||
new IdNameStruct((int)Shapes.ARC, "Arc"),
|
||||
new IdNameStruct((int)Shapes.ARC_FULL, "Arc Full"),
|
||||
new IdNameStruct((int)Shapes.DOUBLEARC, "Double Arc"),
|
||||
new IdNameStruct((int)Shapes.TRIANGLE, "Triangle")
|
||||
};
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user