152 lines
3.2 KiB
C#
152 lines
3.2 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;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public double dDimension
|
|
{
|
|
get
|
|
{
|
|
return m_dDimension;
|
|
}
|
|
set
|
|
{
|
|
if(dDimension != value)
|
|
{
|
|
if (value > m_dMax)
|
|
m_dDimension = m_dMax;
|
|
else if (value < m_dMin)
|
|
m_dDimension = m_dMin;
|
|
else
|
|
m_dDimension = value;
|
|
}
|
|
}
|
|
}
|
|
public int nIndex
|
|
{
|
|
get
|
|
{
|
|
return m_nIndex;
|
|
}
|
|
}
|
|
public string sName
|
|
{
|
|
get
|
|
{
|
|
return m_sName;
|
|
}
|
|
set
|
|
{
|
|
if (m_sName != value)
|
|
{
|
|
m_sName = value;
|
|
}
|
|
}
|
|
}
|
|
public Area ParentArea
|
|
{
|
|
get
|
|
{
|
|
return m_ParentArea;
|
|
}
|
|
}
|
|
public double dOverlap
|
|
{
|
|
get
|
|
{
|
|
return m_dOverlap;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void SetDimension(double dValue)
|
|
{
|
|
m_dDimension = dValue;
|
|
}
|
|
|
|
public void SetIndex(int nIndex)
|
|
{
|
|
m_nIndex = nIndex;
|
|
}
|
|
|
|
public void SetMaxDimension(double dValue)
|
|
{
|
|
m_dMax = dValue;
|
|
}
|
|
|
|
public void SetMinDimension(double dValue)
|
|
{
|
|
m_dMin = dValue;
|
|
}
|
|
|
|
public void SetNameElement(string dValue)
|
|
{
|
|
m_sName = dValue;
|
|
}
|
|
|
|
public void SetOverlapElement(double dValue)
|
|
{
|
|
m_dOverlap = 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 Private Fields
|
|
|
|
private Area m_ParentArea;
|
|
|
|
private double m_dDimension;
|
|
|
|
private double m_dOverlap;
|
|
|
|
private int m_nIndex;
|
|
|
|
private string m_sName = "";
|
|
|
|
private double m_dMin = 40;
|
|
|
|
private double m_dMax = 100;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |