Files
webwindowconfigurator/WebWindowComplex/Models/ElementDimension.cs
T
2026-01-22 09:03:03 +01:00

121 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
public class ElementDimension
{
#region Public Constructors
public ElementDimension(Area ParentArea, int nIndex, double dDimension)
{
m_ParentArea = ParentArea;
m_nIndex = nIndex;
m_dDimension = dDimension;
}
public ElementDimension(Area ParentArea, int nIndex, double dDimension, double dMin, double dMax)
{
m_ParentArea = ParentArea;
m_nIndex = nIndex;
m_dDimension = dDimension;
m_dMin = dMin;
m_dMax = dMax;
}
#endregion Public Constructors
#region Public Properties
public double dDimension
{
get
{
return m_dDimension;
}
set
{
if(dDimension != value)
{
if (value > MaxDim)
m_dDimension = MaxDim;
else if (value < MinDim)
m_dDimension = MinDim;
else
m_dDimension = value;
}
}
}
public int nIndex
{
get
{
return m_nIndex;
}
}
public Area ParentArea
{
get
{
return m_ParentArea;
}
}
#endregion Public Properties
#region Public Methods
public void SetDimension(double dValue)
{
m_dDimension = dValue;
}
public ElementDimension Copy()
{
ElementDimension newElementDimension = new ElementDimension(ParentArea, nIndex, dDimension);
return newElementDimension;
}
#endregion Public Methods
#region Internal Methods
internal JsonElementDimension Serialize()
{
JsonElementDimension JsonElementDimension = new JsonElementDimension(m_nIndex, m_dDimension);
return JsonElementDimension;
}
#endregion Internal Methods
#region Protected Fields
protected Area m_ParentArea;
#endregion Protected Fields
#region Private Fields
private double m_dDimension;
private int m_nIndex;
private double m_dMin;
private double m_dMax;
// valore massimo della dimensione del frame
private int MaxDim = 200;
// valore minimo della dimensione del frame
private int MinDim = 50;
#endregion Private Fields
}
}