- Corretto conversione tipi dimensioni
- Corretto aggiornamento dimensioni a causa di una modifica (no gestione split grid)
This commit is contained in:
+225
-10
@@ -1,4 +1,5 @@
|
||||
using WebWindowComplex.Json;
|
||||
using System.ComponentModel.Design;
|
||||
using WebWindowComplex.Json;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
@@ -69,7 +70,6 @@ namespace WebWindowComplex.Models
|
||||
set
|
||||
{
|
||||
m_nAreaId = value;
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +124,6 @@ namespace WebWindowComplex.Models
|
||||
// Inserisco il riempimento precedente
|
||||
AreaList[0].AreaList.Add(ContentArea[0]);
|
||||
AreaList[0].AreaList[0].SetParentArea(AreaList[0]);
|
||||
// Richiesta SVG con hardware di default
|
||||
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
public void AddSplit()
|
||||
@@ -182,6 +180,155 @@ namespace WebWindowComplex.Models
|
||||
AreaList[0] = AreaList[1];
|
||||
AreaList[1] = tempArea;
|
||||
}
|
||||
//SearchAreaList(this, "Width");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
public void SearchAreaList(Area node, double dim, string nameDim)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
UpdateDimSubArea((Sash)node, dim, nameDim);
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
UpdateDimSubArea((Split)node, dim, nameDim);
|
||||
for (int i = 0; i < node.AreaList.Count; i++)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
{
|
||||
Sash s = (Sash)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var item in s.SashList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
{
|
||||
Split s = (Split)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitHorizList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
}
|
||||
if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitVertList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
}
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDimSubArea(Area area, double dim, string nameDim)
|
||||
{
|
||||
if (area is Sash && nameDim.Equals("Width"))
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
|
||||
int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
Split temp = new Split(null, null);
|
||||
if (sash.ParentArea.ParentArea is Split)
|
||||
temp = (Split)sash.ParentArea.ParentArea;
|
||||
if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && temp.SplitHorizList.Count > 0))
|
||||
{
|
||||
Frame f = null;
|
||||
if(temp.SplitHorizList.Count > 0)
|
||||
f = (Frame)sash.ParentArea.ParentArea.ParentArea;
|
||||
else
|
||||
f = (Frame)sash.ParentArea;
|
||||
foreach (var i in f.DimensionList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
}
|
||||
else
|
||||
{
|
||||
Split s = (Split)sash.ParentArea.ParentArea;
|
||||
foreach (var i in s.SplitVertList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
}
|
||||
if (countAbsolute == sash.SashList.Count)
|
||||
{
|
||||
double sum = sash.SashList.Sum(x => x.dDimension);
|
||||
double res = dim - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (countAbsolute < sash.SashList.Count)
|
||||
{
|
||||
if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
|
||||
{
|
||||
double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
|
||||
var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
|
||||
foreach (var i in percentageList)
|
||||
{
|
||||
i.SetDimension(i.ConvertIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
List<SplitDimension> splitList = null;
|
||||
if (nameDim.Equals("Width"))
|
||||
splitList = split.SplitVertList;
|
||||
else
|
||||
splitList = split.SplitHorizList;
|
||||
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
if (countAbsolute != 0 && countAbsolute == splitList.Count)
|
||||
{
|
||||
double sum = splitList.Sum(x => x.dDimension);
|
||||
double res = 0;
|
||||
res = dim - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -200,13 +347,81 @@ namespace WebWindowComplex.Models
|
||||
m_ParentArea = ParentArea;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(Sash sashGroup, double sashDim, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sashGroup.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = sashGroup.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(adList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = sashGroup.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * sashDim;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * sashDim) / tot * 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(List<SplitDimension> splitList, double splitDim, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = splitList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(adList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = splitList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0)
|
||||
sumPesi = 1;
|
||||
return res / sumPesi * splitDim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza area
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateWidthArea(Area area, double width)
|
||||
public double CalculateWidthArea(Area area, double width)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
@@ -228,7 +443,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(split.SplitVertList, split.SplitVertList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -257,7 +472,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -285,7 +500,7 @@ namespace WebWindowComplex.Models
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="height"> altezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateHeightArea(Area area, double height)
|
||||
public double CalculateHeightArea(Area area, double height)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
@@ -307,7 +522,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateHeighthArea(item, split.SplitHorizList.ElementAt(i).dDimension);
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(split.SplitHorizList, split.SplitHorizList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height) );
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -336,7 +551,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateHeighthArea(item, sash.SashList.ElementAt(i).dDimension);
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
public class AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AreaDimension(double dDimension, MeasureTypes MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_SelMeasureType = MeasureType;
|
||||
//m_Parent = Parent;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dDimension;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
|
||||
//public Area Parent
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_Parent;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_Parent = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
public List<IdNameStruct> MeasureTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureTypeList;
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes SelMeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
protected double m_dDimension;
|
||||
|
||||
protected List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
};
|
||||
|
||||
protected MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
// protected Area m_Parent;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
/// </summary>
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(List<AreaDimension> itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
return (dDimension / widthTot) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(itemList, indexSash, widthTot);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot);
|
||||
}
|
||||
else
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
return (dDimension * widthTot) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(itemList, indexSash, widthTot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MCD
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateMCD(double a, double b)
|
||||
{
|
||||
while (b >= 0.01)
|
||||
{
|
||||
double temp = b;
|
||||
b = a % b;
|
||||
a = temp;
|
||||
}
|
||||
//return Double.Round(a,2);
|
||||
return a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double CalculatePropVal(List<AreaDimension> itemList, int indexArea, double widthTot)
|
||||
{
|
||||
if (itemList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
List<double> absoluteValue = new List<double>();
|
||||
foreach (var item in itemList)
|
||||
{
|
||||
absoluteValue.Add(item.CalculateAbsoluteValue(itemList, widthTot));
|
||||
}
|
||||
int numProportional = itemList.Where(x => x.SelMeasureType == MeasureTypes.PROPORTIONAL).Count();
|
||||
if(itemList.Count > 2 && numProportional == itemList.Count - 1)
|
||||
{
|
||||
int inedMin = absoluteValue.IndexOf(absoluteValue.Min());
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(inedMin));
|
||||
itemList.ElementAt(inedMin).SetDimension(absoluteValue.ElementAt(inedMin) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < itemList.Count; i++)
|
||||
{
|
||||
if (!itemList.ElementAt(i).Equals(this) &&
|
||||
itemList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
if (absoluteValue.ElementAt(indexArea) <= absoluteValue.ElementAt(i))
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i));
|
||||
itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i));
|
||||
itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemList.ElementAt(indexArea).dDimension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
/// </summary>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateAbsoluteValue(List<AreaDimension> itemList, double widthTot)
|
||||
{
|
||||
switch (SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
//return Double.Round(dDimension, 2);
|
||||
return dDimension;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
return ProportionalToAbsoluteVal(itemList, dDimension, widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
//return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
return (dDimension / 100) * widthTot;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
/// </summary>
|
||||
/// <param name="absoluteVal"> Valore assoluto </param>
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(List<AreaDimension> itemList, double absoluteVal, MeasureTypes type, double widthTot)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return absoluteVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return ProportionalToAbsoluteVal(itemList, absoluteVal, widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absoluteVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(List<AreaDimension> itemList, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = itemList.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(itemList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = itemList.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * dDimension) / tot * 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare il valore proporzionale in assoluto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double ProportionalToAbsoluteVal(List<AreaDimension> itemList, double dimensionProp, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = itemList.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsoluteValue(itemList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = itemList.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi * dimensionProp;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Method
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,8 @@ namespace WebWindowComplex.Models
|
||||
List<FrameDimension> oldDimensionList = new List<FrameDimension>(DimensionList);
|
||||
// verifico parametri Dimension
|
||||
DimensionList.Clear();
|
||||
double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dValue).First();
|
||||
//double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dValue).First();
|
||||
double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dDimension).First();
|
||||
// aggiungo Dimensioni
|
||||
switch (SelShape)
|
||||
{
|
||||
@@ -109,6 +110,8 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1400, true));
|
||||
foreach (var dim in DimensionList)
|
||||
SearchAreaList(this, dim.dDimension,dim.sName);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,6 +120,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1800, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1500, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Left Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -125,6 +130,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1800, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Right Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -134,6 +141,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800 - (0.4 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -142,6 +151,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.6 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 2400, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -151,6 +162,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.4 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
DimensionList.Add(new FrameDimension(this, 4, "Radius", 200, true));
|
||||
SearchAreaList(this, 2000, "Width");
|
||||
SearchAreaList(this, 2400, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -159,6 +172,8 @@ namespace WebWindowComplex.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Height projection", 0, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1500, "Height");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,16 +9,15 @@ using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
public class FrameDimension
|
||||
public class FrameDimension:AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dValue, bool bIsLen)
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE)
|
||||
{
|
||||
m_ParentFrame = ParentFrame;
|
||||
m_nIndex = nIndex;
|
||||
m_sName = sName;
|
||||
m_dValue = dValue;
|
||||
m_bIsLen = bIsLen;
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public double dValue
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dValue;
|
||||
return m_dDimension;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(m_dValue != value)
|
||||
if(dDimension != value)
|
||||
{
|
||||
if (ParentFrame.SelShapeIndex == (int)Shapes.RECTANGLE ||
|
||||
ParentFrame.SelShapeIndex == (int)Shapes.RIGHTCHAMFER ||
|
||||
@@ -43,91 +43,93 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (value > MaxDim)
|
||||
{
|
||||
m_dValue = MaxDim;
|
||||
m_dDimension = MaxDim;
|
||||
}
|
||||
else if (value < MinDim && !m_sName.Equals("Radius") && !m_sName.Equals("Height projection"))
|
||||
{
|
||||
m_dValue = MinDim;
|
||||
m_dDimension = MinDim;
|
||||
}
|
||||
else
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ParentFrame.SelShapeIndex == (int)Shapes.ARC_FULL)
|
||||
{
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
if (sName.Equals("Height") && value > 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC)
|
||||
{
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC)
|
||||
{
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Radius") && value < 0.5 * width)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC)
|
||||
{
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
|
||||
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).m_dDimension;
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) > 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * width && value < MaxDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim)
|
||||
{
|
||||
m_dValue = value;
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ParentFrame.AreaList.Count > 0)
|
||||
SearchAreaList(ParentFrame);
|
||||
if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width"))
|
||||
ParentFrame.SearchAreaList(ParentFrame, dDimension, "Width");
|
||||
else
|
||||
ParentFrame.SearchAreaList(ParentFrame, dDimension, "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,107 +162,132 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
protected void SearchAreaList(Area node)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
UpdateDimSubArea((Sash)node);
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
UpdateDimSubArea((Split)node);
|
||||
foreach (var item in node.AreaList)
|
||||
{
|
||||
SearchAreaList(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
///// <summary>
|
||||
///// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza
|
||||
///// </summary>
|
||||
///// <param name="node"></param>
|
||||
//protected void SearchAreaList(Area node)
|
||||
//{
|
||||
// if (node != null)
|
||||
// {
|
||||
// if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
// UpdateDimSubArea((Sash)node);
|
||||
// else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
// UpdateDimSubArea((Split)node);
|
||||
// foreach (var item in node.AreaList)
|
||||
// {
|
||||
// SearchAreaList(item);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
protected void UpdateDimSubArea(Area area)
|
||||
{
|
||||
if(area is Sash && sName.Equals("Width"))
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
|
||||
int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
|
||||
if (countAbsolute == sash.SashList.Count)
|
||||
{
|
||||
double sum = sash.SashList.Sum(x => x.dDimension);
|
||||
double res = dValue - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (countAbsolute < sash.SashList.Count)
|
||||
{
|
||||
if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
|
||||
{
|
||||
double widthTot = ParentFrame.CalculateWidthArea(ParentFrame, ParentFrame.DimensionList.First(x => x.m_sName.Equals("Width")).dValue);
|
||||
double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
|
||||
var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
|
||||
foreach(var i in percentageList)
|
||||
{
|
||||
i.SetDimension(ConvertIn((widthTot - sumAbsolute) / countPercentage, i.MeasureType, widthTot, sash));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
List<SplitDimension> splitList = null;
|
||||
if (sName.Equals("Width"))
|
||||
splitList = split.SplitVertList;
|
||||
else
|
||||
splitList = split.SplitHorizList;
|
||||
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
if (countAbsolute != 0 && countAbsolute == splitList.Count)
|
||||
{
|
||||
double sum = splitList.Sum(x => x.dDimension);
|
||||
double res = dValue - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var sashDim in splitList)
|
||||
{
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sashDim in splitList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//protected void UpdateDimSubArea(Area area)
|
||||
//{
|
||||
// if(area is Sash && sName.Equals("Width"))
|
||||
// {
|
||||
// Sash sash = (Sash)area;
|
||||
// int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
// int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
|
||||
// int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
|
||||
// double widthTot = 0;
|
||||
// if (sash.ParentArea is Frame)
|
||||
// {
|
||||
// widthTot = ParentFrame.CalculateWidthArea(ParentFrame, ParentFrame.DimensionList.First(x => x.m_sName.Equals("Width")).dValue);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Split s = (Split)sash.ParentArea.ParentArea;
|
||||
// int index = s.AreaList.First().AreaList.IndexOf(sash);
|
||||
// widthTot = s.CalculateWidthArea(s, s.SplitVertList.ElementAt(index).dDimension);
|
||||
// }
|
||||
// if (countAbsolute == sash.SashList.Count)
|
||||
// {
|
||||
// double sum = sash.SashList.Sum(x => x.dDimension);
|
||||
// double res = widthTot - sum;
|
||||
// if (res > 0)
|
||||
// {
|
||||
// foreach (var sashDim in sash.SashList)
|
||||
// {
|
||||
// sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach (var sashDim in sash.SashList)
|
||||
// {
|
||||
// // Sommo perchè res è negativo
|
||||
// sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (countAbsolute < sash.SashList.Count)
|
||||
// {
|
||||
// if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
|
||||
// {
|
||||
// double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
|
||||
// var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
|
||||
// foreach(var i in percentageList)
|
||||
// {
|
||||
// i.SetDimension(ConvertIn((widthTot - sumAbsolute) / countPercentage, i.MeasureType, widthTot, sash));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if(area is Split)
|
||||
// {
|
||||
// Split split = (Split)area;
|
||||
// List<SplitDimension> splitList = null;
|
||||
// if (sName.Equals("Width"))
|
||||
// splitList = split.SplitVertList;
|
||||
// else
|
||||
// splitList = split.SplitHorizList;
|
||||
// int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
// double widthTot = 0;
|
||||
// if (split.ParentArea is Frame)
|
||||
// {
|
||||
// widthTot = ParentFrame.CalculateWidthArea(ParentFrame, ParentFrame.DimensionList.First(x => x.m_sName.Equals("Width")).dValue);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Sash s = (Sash)split.ParentArea.ParentArea;
|
||||
// int index = -1;
|
||||
// if (s.AreaList.First().AreaList.IndexOf(split) != -1)
|
||||
// index = s.AreaList.First().AreaList.IndexOf(split);
|
||||
// else
|
||||
// index = s.AreaList.Last().AreaList.IndexOf(split);
|
||||
// widthTot = s.CalculateWidthArea(s, s.SashList.ElementAt(index).dDimension);
|
||||
// }
|
||||
// if (countAbsolute != 0 && countAbsolute == splitList.Count)
|
||||
// {
|
||||
// double sum = splitList.Sum(x => x.dDimension);
|
||||
// double res = widthTot - sum;
|
||||
// if (res > 0)
|
||||
// {
|
||||
// foreach (var sashDim in splitList)
|
||||
// {
|
||||
// sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach (var sashDim in splitList)
|
||||
// {
|
||||
// // Sommo perchè res è negativo
|
||||
// sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
internal void SetDimension(double dValue)
|
||||
{
|
||||
m_dValue = dValue;
|
||||
}
|
||||
//internal void SetDimension(double dValue)
|
||||
//{
|
||||
// m_dDimension = dValue;
|
||||
//}
|
||||
|
||||
internal JsonFrameDimension Serialize()
|
||||
{
|
||||
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
|
||||
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dDimension);
|
||||
return JsonFrameDimension;
|
||||
}
|
||||
|
||||
@@ -271,48 +298,53 @@ namespace WebWindowComplex.Models
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, Sash sash)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return absoluteVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return ProportionalFromAbsoluteVal(absoluteVal, widthTot, sash);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absoluteVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, Sash sash)
|
||||
//{
|
||||
// switch (type)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// return absoluteVal;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// return ProportionalFromAbsoluteVal(absoluteVal, widthTot, sash);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// return (absoluteVal / widthTot) * 100;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare il valore proporzionale in assoluto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double ProportionalFromAbsoluteVal(double absoluteVal, double widthTot, Sash sash)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = sash.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = sash.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi * absoluteVal;
|
||||
}
|
||||
//internal double ProportionalFromAbsoluteVal(double absoluteVal, double widthTot, Sash sash)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// List<AreaDimension> adList = new List<AreaDimension>();
|
||||
// foreach (var it in sash.SashList)
|
||||
// {
|
||||
// adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
// }
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = sash.SashList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
// .Sum(m => m.CalculateAbsoluteValue(adList, tot));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = sash.SashList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
// double sumPesi = proportionalList.Sum(p => p.m_dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// return res / sumPesi * absoluteVal;
|
||||
//}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
@@ -326,7 +358,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private bool m_bIsLen = false;
|
||||
|
||||
private double m_dValue;
|
||||
//private double m_dDimension;
|
||||
|
||||
private int m_nIndex;
|
||||
|
||||
|
||||
+29
-119
@@ -34,17 +34,17 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool bIsMeasureGlass
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsMeasureGlass;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bIsMeasureGlass = value;
|
||||
}
|
||||
}
|
||||
//public bool bIsMeasureGlass
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_bIsMeasureGlass;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_bIsMeasureGlass = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool bIsSashVertical
|
||||
{
|
||||
@@ -104,7 +104,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (value > 0 && value <= 3)
|
||||
{
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
if (value > m_SashList.Count)
|
||||
{
|
||||
// recupero larghezza ultimo
|
||||
@@ -145,7 +145,16 @@ namespace WebWindowComplex.Models
|
||||
SashList.RemoveAt(SplitIndex);
|
||||
}
|
||||
if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType))
|
||||
deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot);
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete));
|
||||
}
|
||||
//deleteDim = Convert.ConvertDimension(itemDelete, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, itemDelete.dDimension, widthTot);
|
||||
else
|
||||
deleteDim = itemDelete.dDimension;
|
||||
//dLastDimension += m_SashList[SashList.Count - 1].dDimension;
|
||||
@@ -227,6 +236,8 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SashList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
RefreshHardwareList();
|
||||
ClearHardwareOptionList();
|
||||
@@ -270,7 +281,6 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
// Controllo che il valore inserito sia positivo
|
||||
if (value >= 0)
|
||||
{
|
||||
m_nSashBottomRailQty = value;
|
||||
@@ -384,7 +394,6 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
m_bIsSashVertical = false;
|
||||
}
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +453,9 @@ namespace WebWindowComplex.Models
|
||||
Enums.OpeningTypes sOpeningType = ConvertOpeningType();
|
||||
if (string.IsNullOrEmpty(m_SelFamilyHardware))
|
||||
m_SelFamilyHardware = s_FamilyHardwareList.FirstOrDefault();
|
||||
int sashPosition = 1;
|
||||
if (nSashQty > 2 && !(SashList.First().bHasHandle || SashList.Last().bHasHandle))
|
||||
sashPosition = 2;
|
||||
var iComp = StringComparison.InvariantCultureIgnoreCase;
|
||||
var rawList = m_HardwareCompleteList
|
||||
.Where(x => x.Id == "000000" ||
|
||||
@@ -451,7 +463,8 @@ namespace WebWindowComplex.Models
|
||||
x.FamilyName.Equals(m_SelFamilyHardware, iComp) &&
|
||||
x.SashQty == nSashQty &&
|
||||
x.Shape.Equals(m_CurrShape, iComp) &&
|
||||
x.OpeningType == sOpeningType)
|
||||
x.OpeningType == sOpeningType &&
|
||||
x.SashPosition == sashPosition)
|
||||
)
|
||||
.ToList() ?? new List<Hardware>();
|
||||
if(rawList.Count == 0 || rawList == null)
|
||||
@@ -475,31 +488,6 @@ namespace WebWindowComplex.Models
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Richiesta calcolo shape corrente
|
||||
///// </summary>
|
||||
//public void ReqRefreshShape()
|
||||
//{
|
||||
// if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0)
|
||||
// {
|
||||
// m_HardwareList.Clear();
|
||||
// // reset shape corrente
|
||||
// m_CurrShape = "";
|
||||
// // chiamata evento calcolo shape: gruppo da calcolare
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Richiesta calcolo hardware option list
|
||||
///// </summary>
|
||||
//public void ReqRefreshHwOption()
|
||||
//{
|
||||
// HwOptionList.Clear();
|
||||
// m_ReqHwOption = true;
|
||||
// // chiamata evento calcolo opzioni hardware
|
||||
// //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
|
||||
//}
|
||||
|
||||
public void SetSelFamilyHardware(string sFamilyHw)
|
||||
{
|
||||
m_SelFamilyHardware = sFamilyHw;
|
||||
@@ -559,84 +547,6 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per calcolare larghezza intera sash group
|
||||
///// </summary>
|
||||
///// <param name="area"> area di partenza </param>
|
||||
///// <param name="width"> larghezza di partenza </param>
|
||||
///// <returns></returns>
|
||||
//internal double CalculateWidthSashGroup(Area area, double width)
|
||||
//{
|
||||
// for (int i = 0; i < area.AreaList.Count; i++)
|
||||
// {
|
||||
// double risultato = -1;
|
||||
// if (area.Equals(this))
|
||||
// return width;
|
||||
// Area item = area.AreaList[i];
|
||||
// if (area is Split)
|
||||
// {
|
||||
// Split split = (Split)area;
|
||||
// if(split.SplitVertList.Count > 0)
|
||||
// {
|
||||
// switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
// break;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
// break;
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, width);
|
||||
// }
|
||||
// if (risultato != -1)
|
||||
// return risultato;
|
||||
// }
|
||||
// else if (area is Sash)
|
||||
// {
|
||||
// Sash sash = (Sash)area;
|
||||
// switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
// break;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
// break;
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (risultato != -1)
|
||||
// return risultato;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// risultato = CalculateWidthSashGroup(item, width);
|
||||
// if (risultato != -1)
|
||||
// return risultato;
|
||||
// }
|
||||
// }
|
||||
// return width;
|
||||
//}
|
||||
internal static Sash CreateSash(Area Area)
|
||||
{
|
||||
Sash newSash = new Sash(Area, Area.ParentWindow);
|
||||
|
||||
@@ -5,15 +5,15 @@ using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
public class SashDimension
|
||||
public class SashDimension : AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId)
|
||||
public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_Parent = Parent;
|
||||
m_nSashId = nSashId;
|
||||
m_Parent = Parent;
|
||||
SetMeasureType(MeasureType);
|
||||
// assengno maniglia
|
||||
if (Parent.SashList.Count == 0 || !Parent.SashList.Any(x => x.bHasHandle))
|
||||
@@ -106,6 +106,18 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public Sash Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Parent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Joint> JointList
|
||||
{
|
||||
get
|
||||
@@ -118,7 +130,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public double dDimension
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -126,7 +138,8 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
//double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
double valMinAbsolute = 200;
|
||||
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
|
||||
bool valueAccept = false;
|
||||
@@ -155,9 +168,17 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
List<SashDimension> dimensions = m_Parent.SashList;
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
}
|
||||
int index = 0;
|
||||
foreach (var item in m_Parent.SashList)
|
||||
{
|
||||
absoluteValList.Add(item.CalculateAbsoluteValue(widthTot));
|
||||
absoluteValList.Add(adList.ElementAt(index).CalculateAbsoluteValue(adList, widthTot));
|
||||
index++;
|
||||
}
|
||||
int nIndex = dimensions.IndexOf(this);
|
||||
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
|
||||
@@ -171,13 +192,13 @@ namespace WebWindowComplex.Models
|
||||
// Le dimensioni sono solo in percentuale
|
||||
else if (percentageCount == dimensions.Count)
|
||||
{
|
||||
if (value < dDimension)
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value));
|
||||
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value));
|
||||
else if (dimensions.Count > 1)
|
||||
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value));
|
||||
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value));
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
@@ -191,7 +212,7 @@ namespace WebWindowComplex.Models
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += dimensions[nInd].dDimension;
|
||||
dRes += dimensions[nInd].m_dDimension;
|
||||
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
|
||||
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
|
||||
dimensions[Ind].SetDimension(dRes);
|
||||
@@ -202,7 +223,7 @@ namespace WebWindowComplex.Models
|
||||
if (dimensions.Count > 2)
|
||||
{
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += dimensions[Ind].dDimension;
|
||||
dRes += dimensions[Ind].m_dDimension;
|
||||
}
|
||||
dRes = (100 - dRes);
|
||||
dimensions[nIndex - 1].SetDimension(dRes);
|
||||
@@ -228,9 +249,8 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
var pesi = value + dimensions
|
||||
.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
|
||||
.Sum(x => x.m_dDimension);
|
||||
var pesi = value + dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
|
||||
.Sum(x => x.m_dDimension);
|
||||
valueInAbsolute = widthTot / pesi * value;
|
||||
break;
|
||||
}
|
||||
@@ -240,7 +260,7 @@ namespace WebWindowComplex.Models
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value < dDimension)
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absoluteValList.Count - 1)
|
||||
@@ -275,11 +295,12 @@ namespace WebWindowComplex.Models
|
||||
for (int i = 0; i < absoluteValList.Count; i++)
|
||||
{
|
||||
var item = m_Parent.SashList.ElementAt(i);
|
||||
item.SetDimension(ConvertIn(absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
|
||||
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
|
||||
}
|
||||
}
|
||||
foreach(var item in m_Parent.AreaList)
|
||||
item.SearchAreaList(item, dDimension, "Width");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,48 +363,55 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
}
|
||||
//public MeasureTypes MeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
//}
|
||||
|
||||
public List<IdNameStruct> MeasureTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureTypeList;
|
||||
}
|
||||
}
|
||||
//public List<IdNameStruct> MeasureTypeList
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_MeasureTypeList;
|
||||
// }
|
||||
//}
|
||||
|
||||
public MeasureTypes SelMeasureType
|
||||
//public MeasureTypes SelMeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SelMeasureType = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public override int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
return (int)SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(m_SelMeasureType != (MeasureTypes)value)
|
||||
if(SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot);
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1);
|
||||
//m_dDimension = Convert.ConvertDimension(this, m_SelMeasureType, newType, m_dDimension, widthTot);
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,50 +426,50 @@ namespace WebWindowComplex.Models
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
return (m_dDimension / widthTot) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(widthTot);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
return ConvertFromPropVal(newType, widthTot);
|
||||
}
|
||||
else
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
return ConvertFromPropVal(newType, widthTot);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
return (m_dDimension * widthTot) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(widthTot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot)
|
||||
//{
|
||||
// switch (oldType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
// return (m_dDimension / widthTot) * 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
// return ConvertFromPropVal(newType, widthTot, dDimension);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
// return ConvertFromPropVal(newType, widthTot, dDimension);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
// return (m_dDimension * widthTot) / 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per copiare l'intero oggetto
|
||||
@@ -449,7 +477,7 @@ namespace WebWindowComplex.Models
|
||||
/// <returns></returns>
|
||||
public SashDimension Copy()
|
||||
{
|
||||
SashDimension newSashDim = new SashDimension(dDimension, MeasureType, m_Parent, m_nSashId);
|
||||
SashDimension newSashDim = new SashDimension(m_dDimension, MeasureType, m_Parent, m_nSashId);
|
||||
newSashDim.SetMeasureType(MeasureType);
|
||||
newSashDim.SetOpeningType(SelOpeningType);
|
||||
newSashDim.SetHasHandle(bHasHandle);
|
||||
@@ -493,7 +521,13 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach(var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -522,7 +556,14 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
//risultato = CalculateWidthSashGroup(item, ConvertFromPropVal(MeasureTypes.ABSOLUTE, width, sash.SashList.ElementAt(i).dDimension));
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -544,185 +585,185 @@ namespace WebWindowComplex.Models
|
||||
return width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MCD
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
internal static double CalculateMCD(double a, double b)
|
||||
{
|
||||
while (b >= 0.01)
|
||||
{
|
||||
double temp = b;
|
||||
b = a % b;
|
||||
a = temp;
|
||||
}
|
||||
//return Double.Round(a,2);
|
||||
return a;
|
||||
}
|
||||
///// <summary>
|
||||
///// Calcolo MCD
|
||||
///// </summary>
|
||||
///// <param name="a"></param>
|
||||
///// <param name="b"></param>
|
||||
///// <returns></returns>
|
||||
//internal static double CalculateMCD(double a, double b)
|
||||
//{
|
||||
// while (b >= 0.01)
|
||||
// {
|
||||
// double temp = b;
|
||||
// b = a % b;
|
||||
// a = temp;
|
||||
// }
|
||||
// //return Double.Round(a,2);
|
||||
// return a;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double CalculatePropVal(double widthTot)
|
||||
{
|
||||
if (m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
List<double> absoluteValue = new List<double>();
|
||||
foreach (var item in m_Parent.SashList)
|
||||
{
|
||||
absoluteValue.Add(item.CalculateAbsoluteValue(widthTot));
|
||||
}
|
||||
for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
{
|
||||
if (!m_Parent.SashList.ElementAt(i).Equals(this) &&
|
||||
m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
int nIndex = m_Parent.SashList.IndexOf(this);
|
||||
if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
else
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m_dDimension;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double CalculatePropVal(double widthTot)
|
||||
//{
|
||||
// if (m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
// List<double> absoluteValue = new List<double>();
|
||||
// foreach (var item in m_Parent.SashList)
|
||||
// {
|
||||
// absoluteValue.Add(item.CalculateAbsoluteValue(widthTot));
|
||||
// }
|
||||
// for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
// {
|
||||
// if (!m_Parent.SashList.ElementAt(i).Equals(this) &&
|
||||
// m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
// {
|
||||
// int nIndex = m_Parent.SashList.IndexOf(this);
|
||||
// if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return m_dDimension;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
/// </summary>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateAbsoluteValue(double widthTot)
|
||||
{
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
//return Double.Round(dDimension, 2);
|
||||
return dDimension;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
return ProportionalFromAbsoluteVal(widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
//return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
return (dDimension / 100) * widthTot;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
///// </summary>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double CalculateAbsoluteValue(double widthTot)
|
||||
//{
|
||||
// switch (MeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// //return Double.Round(dDimension, 2);
|
||||
// return dDimension;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
// return ProportionalFromAbsoluteVal(widthTot);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// //return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
// return (dDimension / 100) * widthTot;
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
/// </summary>
|
||||
/// <param name="absoluteVal"> Valore assoluto </param>
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return absoluteVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return ProportionalFromAbsoluteVal(widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absoluteVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
///// </summary>
|
||||
///// <param name="absoluteVal"> Valore assoluto </param>
|
||||
///// <param name="type"> Tipo di misura della dimensione </param>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot)
|
||||
//{
|
||||
// switch (type)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// return absoluteVal;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// return ProportionalFromAbsoluteVal(widthTot);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// return (absoluteVal / widthTot) * 100;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = m_Parent.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = m_Parent.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
///// <summary>
|
||||
///// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
///// </summary>
|
||||
///// <param name="newType"></param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, double dim)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = m_Parent.SashList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = m_Parent.SashList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * dDimension) / tot * 100;
|
||||
}
|
||||
}
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// return res / sumPesi * dim;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return (res / sumPesi * dim) / tot * 100;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare il valore proporzionale in assoluto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double ProportionalFromAbsoluteVal(double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = m_Parent.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = m_Parent.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per trasformare il valore proporzionale in assoluto
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double ProportionalFromAbsoluteVal(double widthTot)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = m_Parent.SashList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = m_Parent.SashList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// return res / sumPesi * dDimension;
|
||||
//}
|
||||
|
||||
internal JsonSashDimension Serialize()
|
||||
{
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId);
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, dDimension, m_nSashId);
|
||||
foreach (var Joint in JointList)
|
||||
JsonSashDimension.JointList.Add(Joint.Serialize());
|
||||
return JsonSashDimension;
|
||||
}
|
||||
|
||||
internal void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
//internal void SetDimension(double dValue)
|
||||
//{
|
||||
// m_dDimension = dValue;
|
||||
//}
|
||||
|
||||
internal void SetHasHandle(bool value)
|
||||
{
|
||||
@@ -736,17 +777,28 @@ namespace WebWindowComplex.Models
|
||||
|
||||
internal void SetMeasureType(MeasureTypes value)
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
SelMeasureType = value;
|
||||
}
|
||||
|
||||
internal void SetSelMeasureType(MeasureTypes value)
|
||||
internal void SetSelMeasureType(MeasureTypes value, int indexSash)
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
if (SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot);
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach(var item in m_Parent.SashList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < newDimensions.Count; i++)
|
||||
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,7 +808,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private bool m_bHasHandle;
|
||||
|
||||
private double m_dDimension;
|
||||
//private double m_dDimension;
|
||||
|
||||
private int m_nSashId;
|
||||
|
||||
@@ -789,12 +841,12 @@ namespace WebWindowComplex.Models
|
||||
//new IdNameStruct((int)Openings.LIFTSLIDE_RIGHT, "←┐")
|
||||
};
|
||||
|
||||
private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
};
|
||||
//private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
//{
|
||||
// new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
// new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
// new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
//};
|
||||
|
||||
// reference
|
||||
private Sash m_Parent;
|
||||
@@ -803,7 +855,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private Openings m_SelOpeningType;
|
||||
|
||||
private MeasureTypes m_SelMeasureType;
|
||||
//private MeasureTypes m_SelMeasureType;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@ namespace WebWindowComplex.Models
|
||||
ParentArea.AreaList.Remove(this);
|
||||
}
|
||||
}
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +157,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitVertList.Count - 1)
|
||||
{
|
||||
@@ -224,6 +223,24 @@ namespace WebWindowComplex.Models
|
||||
ParentArea.AreaList.Remove(this);
|
||||
}
|
||||
}
|
||||
if(SplitHorizList.Count > 0)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in AreaList)
|
||||
{
|
||||
item.SearchAreaList(item, SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (SplitVertList.Count > 0)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in AreaList)
|
||||
{
|
||||
item.SearchAreaList(item, SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,19 +486,19 @@ namespace WebWindowComplex.Models
|
||||
case (int)Shapes.TRIANGLE:
|
||||
case (int)Shapes.ARC_FULL:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue;
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dValue;
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.LEFTCHAMFER:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dValue;
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dValue;
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,14 +9,13 @@ using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
public class SplitDimension
|
||||
public class SplitDimension:AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList)
|
||||
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_SelMeasureType = MeasureType;
|
||||
m_bIsRelative = bIsRelative;
|
||||
m_Parent = Parent;
|
||||
m_bIsVertListDim = IsVertList;
|
||||
@@ -41,7 +41,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public double dDimension
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -54,12 +54,12 @@ namespace WebWindowComplex.Models
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
dimensions = m_Parent.SplitVertList;
|
||||
dimensionTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
dimensionTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensions = m_Parent.SplitHorizList;
|
||||
dimensionTot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
|
||||
dimensionTot = CalculateHeightSplitGroup(m_Parent, HeightTot());
|
||||
}
|
||||
double valMinAbsolute = 100;
|
||||
double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1);
|
||||
@@ -88,9 +88,15 @@ namespace WebWindowComplex.Models
|
||||
if (valueAccept)
|
||||
{
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in dimensions)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
foreach (var item in dimensions)
|
||||
{
|
||||
absoluteValList.Add(item.CalculateAbsoluteValue(dimensionTot, dimensions));
|
||||
absoluteValList.Add(item.CalculateAbsoluteValue(adList, dimensionTot));
|
||||
}
|
||||
int nIndex = dimensions.IndexOf(this);
|
||||
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
|
||||
@@ -207,11 +213,30 @@ namespace WebWindowComplex.Models
|
||||
for (int i = 0; i < absoluteValList.Count; i++)
|
||||
{
|
||||
var item = dimensions.ElementAt(i);
|
||||
item.SetDimension(ConvertIn(absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot, dimensions));
|
||||
//item.SetDimension(ConvertIn(absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot, dimensions));
|
||||
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot));
|
||||
}
|
||||
}
|
||||
foreach (var item in m_Parent.AreaList)
|
||||
{
|
||||
if (m_Parent.SplitHorizList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.AreaList.Count(); i++)
|
||||
{
|
||||
item.SearchAreaList(item, m_Parent.SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (m_Parent.SplitVertList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.AreaList.Count(); i++)
|
||||
{
|
||||
item.SearchAreaList(item, m_Parent.SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,35 +252,35 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
}
|
||||
//public MeasureTypes MeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
//}
|
||||
|
||||
public List<IdNameStruct> MeasureTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureTypeList;
|
||||
}
|
||||
}
|
||||
//public List<IdNameStruct> MeasureTypeList
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_MeasureTypeList;
|
||||
// }
|
||||
//}
|
||||
|
||||
public MeasureTypes SelMeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
}
|
||||
//public MeasureTypes SelMeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SelMeasureType = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public int SelMeasureTypeIndex
|
||||
public override int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -271,14 +296,20 @@ namespace WebWindowComplex.Models
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
splitList = m_Parent.SplitVertList;
|
||||
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
}
|
||||
else
|
||||
{
|
||||
splitList = m_Parent.SplitHorizList;
|
||||
tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
|
||||
}
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, splitList);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
@@ -289,56 +320,56 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
/// </summary>
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
return (m_dDimension / widthTot) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(widthTot, splitList);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
}
|
||||
else
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
return (m_dDimension * widthTot) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CalculatePropVal(widthTot, splitList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
///// </summary>
|
||||
///// <param name="oldType"> Vecchio tipo </param>
|
||||
///// <param name="newType"> Nuovo tipo </param>
|
||||
///// <returns></returns>
|
||||
//public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (oldType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
// return (m_dDimension / widthTot) * 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
// return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
// return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
// return (m_dDimension * widthTot) / 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
public SplitDimension Copy()
|
||||
{
|
||||
@@ -358,11 +389,11 @@ namespace WebWindowComplex.Models
|
||||
/// <returns></returns>
|
||||
internal double CalculateWidthSplitGroup(Area area, double width)
|
||||
{
|
||||
if (area.Equals(m_Parent))
|
||||
return width;
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(m_Parent))
|
||||
return width;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
@@ -378,6 +409,13 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
//risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
@@ -393,6 +431,8 @@ namespace WebWindowComplex.Models
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthSplitGroup(item, width);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
@@ -407,6 +447,13 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
//risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
@@ -426,7 +473,7 @@ namespace WebWindowComplex.Models
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -457,7 +504,13 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateHeightSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(i).dDimension, split.SplitHorizList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitHorizList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateHeightSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -472,6 +525,8 @@ namespace WebWindowComplex.Models
|
||||
else
|
||||
{
|
||||
risultato = CalculateHeightSplitGroup(item, height);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -484,172 +539,172 @@ namespace WebWindowComplex.Models
|
||||
return height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MCD
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
internal static double CalculateMCD(double a, double b)
|
||||
{
|
||||
while (b >= 0.01)
|
||||
{
|
||||
double temp = b;
|
||||
b = a % b;
|
||||
a = temp;
|
||||
}
|
||||
//return Double.Round(a,2);
|
||||
return a;
|
||||
}
|
||||
///// <summary>
|
||||
///// Calcolo MCD
|
||||
///// </summary>
|
||||
///// <param name="a"></param>
|
||||
///// <param name="b"></param>
|
||||
///// <returns></returns>
|
||||
//internal static double CalculateMCD(double a, double b)
|
||||
//{
|
||||
// while (b >= 0.01)
|
||||
// {
|
||||
// double temp = b;
|
||||
// b = a % b;
|
||||
// a = temp;
|
||||
// }
|
||||
// //return Double.Round(a,2);
|
||||
// return a;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double CalculatePropVal(double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
if (splitList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
List<double> absoluteValue = new List<double>();
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
absoluteValue.Add(item.CalculateAbsoluteValue(widthTot, splitList));
|
||||
}
|
||||
for (int i = 0; i < splitList.Count; i++)
|
||||
{
|
||||
if (!splitList.ElementAt(i).Equals(this) &&
|
||||
splitList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
int nIndex = splitList.IndexOf(this);
|
||||
if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
else
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m_dDimension;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double CalculatePropVal(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// if (splitList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
// List<double> absoluteValue = new List<double>();
|
||||
// foreach (var item in splitList)
|
||||
// {
|
||||
// absoluteValue.Add(item.CalculateAbsoluteValue(widthTot, splitList));
|
||||
// }
|
||||
// for (int i = 0; i < splitList.Count; i++)
|
||||
// {
|
||||
// if (!splitList.ElementAt(i).Equals(this) &&
|
||||
// splitList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
// {
|
||||
// int nIndex = splitList.IndexOf(this);
|
||||
// if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return m_dDimension;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
/// </summary>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateAbsoluteValue(double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
//return Double.Round(dDimension, 2);
|
||||
return dDimension;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
//return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
return (dDimension / 100) * widthTot;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
///// </summary>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double CalculateAbsoluteValue(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (MeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// //return Double.Round(dDimension, 2);
|
||||
// return dDimension;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
// return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// //return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
// return (dDimension / 100) * widthTot;
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
/// </summary>
|
||||
/// <param name="absoluteVal"> Valore assoluto </param>
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return absoluteVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absoluteVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
///// </summary>
|
||||
///// <param name="absoluteVal"> Valore assoluto </param>
|
||||
///// <param name="type"> Tipo di misura della dimensione </param>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (type)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// return absoluteVal;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// return (absoluteVal / widthTot) * 100;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = splitList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = splitList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
///// <summary>
|
||||
///// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
///// </summary>
|
||||
///// <param name="newType"></param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = splitList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = splitList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * dDimension) / tot * 100;
|
||||
}
|
||||
}
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// return res / sumPesi * dDimension;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return (res / sumPesi * dDimension) / tot * 100;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare il valore proporzionale in assoluto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double Proportional2AbsoluteVal(double widthTot, List<SplitDimension> splitList)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = splitList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = splitList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
///// <summary>
|
||||
///// Metodo per trasformare il valore proporzionale in assoluto
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double Proportional2AbsoluteVal(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = splitList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = splitList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// return res / sumPesi * dDimension;
|
||||
//}
|
||||
|
||||
internal JsonSplitDimension Serialize()
|
||||
{
|
||||
@@ -657,10 +712,10 @@ namespace WebWindowComplex.Models
|
||||
return JsonSplitDimension;
|
||||
}
|
||||
|
||||
internal void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
//internal void SetDimension(double dValue)
|
||||
//{
|
||||
// m_dDimension = dValue;
|
||||
//}
|
||||
|
||||
internal void SetIsRelative(bool value)
|
||||
{
|
||||
@@ -685,16 +740,40 @@ namespace WebWindowComplex.Models
|
||||
double tot = 0;
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitVertList);
|
||||
}
|
||||
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitVertList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, tot, m_Parent.SplitVertList.IndexOf(this));
|
||||
if (newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SplitVertList.Count; i++)
|
||||
{
|
||||
m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
} }
|
||||
else
|
||||
{
|
||||
tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitHorizList);
|
||||
tot = CalculateHeightSplitGroup(m_Parent, HeightTot());
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitHorizList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, tot, m_Parent.SplitHorizList.IndexOf(this));
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
|
||||
{
|
||||
m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -706,19 +785,19 @@ namespace WebWindowComplex.Models
|
||||
case (int)Shapes.TRIANGLE:
|
||||
case (int)Shapes.ARC_FULL:
|
||||
{
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue);
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension);
|
||||
}
|
||||
case (int)Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dValue);
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension);
|
||||
}
|
||||
case (int)Shapes.LEFTCHAMFER:
|
||||
{
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dValue);
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension);
|
||||
}
|
||||
default:
|
||||
{
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dValue);
|
||||
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -731,16 +810,16 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private bool m_bIsVertListDim = false;
|
||||
|
||||
private double m_dDimension;
|
||||
//private double m_dDimension;
|
||||
|
||||
private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
};
|
||||
//private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
//{
|
||||
// new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
// new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
// new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
//};
|
||||
|
||||
private MeasureTypes m_SelMeasureType;
|
||||
//private MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
private Split m_Parent;
|
||||
|
||||
Reference in New Issue
Block a user