- Eliminazioni commenti

- Eliminazione funzioni non più usate
- Eliminazione pagine razor sostituite
This commit is contained in:
Annamaria Sassi
2026-03-16 17:02:49 +01:00
parent 171cc8cb90
commit 83161fd2c4
30 changed files with 781 additions and 919 deletions
+12 -127
View File
@@ -131,12 +131,8 @@ namespace WebWindowComplex.Models
{
SashArea.SashList.LastOrDefault()!.JointList.ElementAt(2).SelJointTypeIndex = (int)Joints.ANGLED;
}
// SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true);
}
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC)
// SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true);
//else
// SashArea.SashArcElem = null;
// Salvo gli oggetti già presenti e li cancello da AreaList
@@ -188,7 +184,6 @@ namespace WebWindowComplex.Models
Frame frame = ParentWindow.AreaList.First();
if(frame != null)
{
//frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width");
frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height");
}
}
@@ -237,53 +232,32 @@ namespace WebWindowComplex.Models
}
}
}
string heightName = "Height";
switch (frame.Shape)
{
case Shapes.RECTANGLE:
case Shapes.ARC_FULL:
case Shapes.TRIANGLE:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Height")).First().dDimension, "Height");
break;
}
case Shapes.RIGHTCHAMFER:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Left Height")).First().dDimension, "Left Height");
heightName = "Left Height";
break;
}
case Shapes.LEFTCHAMFER:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Right Height")).First().dDimension, "Right Height");
heightName = "Right Height";
break;
}
case Shapes.DOUBLECHAMFER:
case Shapes.ARC:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
break;
}
case Shapes.DOUBLEARC:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
break;
}
case Shapes.THREECENTERARC:
{
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
heightName = "Full Height";
break;
}
}
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals(heightName)).First().dDimension, heightName);
}
/// <summary>
@@ -390,7 +364,7 @@ namespace WebWindowComplex.Models
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>();
List<AreaDimension> dimList = new();
Split split = new Split(null, null);
if (sash.ParentArea.ParentArea is Split)
split = (Split)sash.ParentArea.ParentArea;
@@ -413,12 +387,6 @@ namespace WebWindowComplex.Models
double sum = sash.SashList.Sum(x => x.dDimension);
if ((sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0))
{
//Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault();
//if (frame != null)
// dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap
// + frame.ElementDimensionList.Last().dOverlap;
//if(sash.SashList.Count == 1)
// dim = dim + sash.SashList.First().ElementDimensionList.ElementAt(1).dOverlap;
for (int i = 1; i < sash.SashList.Count; i++)
dim = dim + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
}
@@ -432,24 +400,18 @@ namespace WebWindowComplex.Models
dim = dim - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.First().ElementDimensionList.Last().dDimension;
for (int i = 1; i < sash.SashList.Count; i++)
{
dim = dim - sash.SashList[i].ElementDimensionList.ElementAt(1).dDimension
- sash.SashList[i].ElementDimensionList.Last().dDimension
+ sash.SashList[i].ElementDimensionList.Last().dOverlap;
}
}
else if (sash.SashList.Count > 1)
{
for (int i = 1; i < sash.SashList.Count; i++)
{
dim = dim + sash.SashList[i].ElementDimensionList.Last().dOverlap;
}
}
double res = dim - sum;
foreach (var sashDim in sash.SashList)
{
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
}
else if (countAbsolute < sash.SashList.Count && countPercentage != sash.SashList.Count && countProportional != sash.SashList.Count)
{
@@ -458,36 +420,30 @@ namespace WebWindowComplex.Models
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));
}
i.SetDimension(i.ConvertAbsoluteIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim));
}
}
}
else if (area is Split split)
{
List<SplitDimension> splitList = new List<SplitDimension>();
List<SplitElementDimension> elemList = new List<SplitElementDimension>();
List<SplitDimension> splitList = new();
List<SplitElementDimension> elemList = new();
double sum = 0;
if (nameDim.Equals("Width"))
{
splitList = split.SplitVertList;
elemList = split.ElemDimVertList;
//foreach (var item in split.ElemDimVertList)
// sum = sum + item.dDimension;
}
else
{
splitList = split.SplitHorizList;
elemList = split.ElemDimHorizList;
//foreach (var item in split.ElemDimHorizList)
// sum = sum + item.dDimension;
}
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
if (countAbsolute != 0 && countAbsolute == splitList.Count)
{
sum = sum + splitList.Sum(x => x.dDimension);
List<AreaDimension> dimensionList = new List<AreaDimension>();
List<AreaDimension> dimensionList = new();
foreach (var i in splitList)
dimensionList.Add(new AreaDimension(i.dDimension, i.MeasureType, i.Parent));
double widthGlass = dim;
@@ -517,75 +473,6 @@ 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, it.Parent));
}
//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, it.Parent));
}
//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;
}
#endregion Internal Methods
#region Protected Fields
@@ -607,7 +494,5 @@ namespace WebWindowComplex.Models
private Area m_ParentArea;
#endregion Private Fields
}
}
+2 -3
View File
@@ -190,7 +190,7 @@ namespace WebWindowComplex.Models
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
/// </summary>
/// <returns></returns>
internal List<AreaDimension> CalculatePropVal(List<AreaDimension> itemList, int indexArea, double widthTot)
internal List<AreaDimension> RicalculatePropVal(List<AreaDimension> itemList, int indexArea, double widthTot)
{
List <AreaDimension> ans = itemList;
if (itemList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
@@ -309,7 +309,7 @@ namespace WebWindowComplex.Models
/// <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)
internal double ConvertAbsoluteIn(List<AreaDimension> itemList, double absoluteVal, MeasureTypes type, double widthTot)
{
switch (type)
{
@@ -379,7 +379,6 @@ namespace WebWindowComplex.Models
if (sumPesi == 0) sumPesi = 1;
return res / sumPesi * dimensionProp;
}
#endregion Public Method
}
+8 -3
View File
@@ -71,7 +71,10 @@ namespace WebWindowComplex.Models
// Per calcolare larghezza split gorup mi basta una qualsiasi dimensione
double height = 0;
if (frame != null)
height =split.SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
{
height = split.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
//height =split.SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
}
//double height = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
List<SplitElementDimension> horizElemList = split.ElemDimHorizList.Where(x=>x.m_nIndex== 1).ToList();
foreach (var elem in horizElemList)
@@ -96,7 +99,7 @@ namespace WebWindowComplex.Models
// Per calcolare larghezza split gorup mi basta una qualsiasi dimensione
double width = 0;
if (frame != null)
width = split.SplitVertList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
width = split.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
List<SplitElementDimension> vertElemList = split.ElemDimVertList.Where(x => x.m_nIndex == 1).ToList();
foreach (var elem in vertElemList)
@@ -262,8 +265,10 @@ namespace WebWindowComplex.Models
return newElementDimension;
}
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (obj is null)
return false;
return Equals(obj as ElementDimension);
}
+18 -19
View File
@@ -6,7 +6,6 @@ namespace WebWindowComplex.Models
public class Fill : Area
{
#region Public Constructors
public Fill(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
{
}
@@ -23,13 +22,13 @@ namespace WebWindowComplex.Models
}
}
public List<IdNameStruct> FillTypeList
{
get
{
return m_FillTypeList;
}
}
//public List<IdNameStruct> FillTypeList
//{
// get
// {
// return m_FillTypeList;
// }
//}
public FillTypes SelFillType
{
@@ -43,17 +42,17 @@ namespace WebWindowComplex.Models
}
}
public int SelFillTypeIndex
{
get
{
return IdNameStruct.IndFromId((int)m_SelFillType, m_FillTypeList);
}
set
{
m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList);
}
}
//public int SelFillTypeIndex
//{
// get
// {
// return IdNameStruct.IndFromId((int)m_SelFillType, m_FillTypeList);
// }
// set
// {
// m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList);
// }
//}
#endregion Public Properties
+5 -18
View File
@@ -397,15 +397,9 @@ namespace WebWindowComplex.Models
if (node != null)
{
if (node.AreaType.Equals(AreaTypes.SASH))
{
sashList.Add((Sash)node);
//Sash s = (Sash)node;
//s.SashArcElem = null;
}
foreach (var item in node.AreaList)
{
SearchSash(sashList, item);
}
}
return sashList;
}
@@ -430,6 +424,11 @@ namespace WebWindowComplex.Models
#region Public Methods
public override Frame Copy(Area ParentArea)
{
return new Frame(null, ParentWindow);
}
public void RefreshThresholdList()
{
m_ThresholdList.Clear();
@@ -478,11 +477,6 @@ namespace WebWindowComplex.Models
overlap;
}
public override Frame Copy(Area ParentArea)
{
return new Frame(null, ParentWindow);
}
/// <summary>
/// Metodo per calcolare l'area disponibile
/// </summary>
@@ -496,12 +490,6 @@ namespace WebWindowComplex.Models
if(AreaList.First() is Sash)
overlap = ElementDimensionList.ElementAt(1).dOverlap +
ElementDimensionList.Last().dOverlap;
//if (AreaList.First() is Split split)
//{
// if(split.SplitHorizList.Count > 0)
// overlap = ElementDimensionList.ElementAt(1).dOverlap +
// ElementDimensionList.Last().dOverlap;
//}
return dim - ElementDimensionList.ElementAt(1).dDimension -
ElementDimensionList.Last().dDimension +
overlap;
@@ -638,7 +626,6 @@ namespace WebWindowComplex.Models
}
}
// aggiungo Joint
//int nJointQty = 4;
switch (Value)
{
case Shapes.RECTANGLE:
-31
View File
@@ -12,7 +12,6 @@ namespace WebWindowComplex.Models
m_ParentFrame = ParentFrame;
m_nIndex = nIndex;
m_sName = sName;
m_bIsLen = bIsLen;
}
#endregion Public Constructors
@@ -36,13 +35,9 @@ namespace WebWindowComplex.Models
ParentFrame.SelShapeIndex == (int)Shapes.TRIANGLE)
{
if (value > MaxDim)
{
m_dDimension = MaxDim;
}
else if (value < MinDim && !m_sName.Equals("Radius") && !m_sName.Equals("Height projection"))
{
m_dDimension = MinDim;
}
else
m_dDimension = value;
}
@@ -53,68 +48,44 @@ namespace WebWindowComplex.Models
{
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
if (sName.Equals("Height") && value > 0.5 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim)
{
m_dDimension = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC)
{
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 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim)
{
m_dDimension = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC)
{
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 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value)
{
m_dDimension = value;
}
else if (sName.Equals("Radius") && value < 0.5 * widthArea)
{
m_dDimension = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC)
{
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 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * widthArea && value < MaxDim)
{
m_dDimension = value;
}
else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim)
{
m_dDimension = value;
}
}
}
if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width") && ParentFrame != null)
@@ -169,8 +140,6 @@ namespace WebWindowComplex.Models
#region Private Fields
private bool m_bIsLen = false;
private int m_nIndex;
private string m_sName;
+50 -61
View File
@@ -642,6 +642,7 @@ namespace WebWindowComplex.Models
#endregion Public Methods
#region Internal Methods
internal void SetIsDimensionLight(bool DimensionLight)
{
m_IsbDimensionLight = DimensionLight;
@@ -670,34 +671,34 @@ namespace WebWindowComplex.Models
return newSash;
}
internal OpeningSides GetOpeningSide(Openings OpeningType)
{
switch (OpeningType)
{
case Openings.TURNONLY_LEFT:
case Openings.TILTTURN_LEFT:
case Openings.TILTONLY_TOP:
case Openings.COMPLANARSLIDE_LEFT:
case Openings.LIFTSLIDE_LEFT:
{
return OpeningSides.LEFT;
}
//internal OpeningSides GetOpeningSide(Openings OpeningType)
//{
// switch (OpeningType)
// {
// case Openings.TURNONLY_LEFT:
// case Openings.TILTTURN_LEFT:
// case Openings.TILTONLY_TOP:
// case Openings.COMPLANARSLIDE_LEFT:
// case Openings.LIFTSLIDE_LEFT:
// {
// return OpeningSides.LEFT;
// }
case Openings.TURNONLY_RIGHT:
case Openings.TILTTURN_RIGHT:
case Openings.TILTONLY_BOTTOM:
case Openings.COMPLANARSLIDE_RIGHT:
case Openings.LIFTSLIDE_RIGHT:
{
return OpeningSides.RIGHT;
}
// case Openings.TURNONLY_RIGHT:
// case Openings.TILTTURN_RIGHT:
// case Openings.TILTONLY_BOTTOM:
// case Openings.COMPLANARSLIDE_RIGHT:
// case Openings.LIFTSLIDE_RIGHT:
// {
// return OpeningSides.RIGHT;
// }
default:
{
return OpeningSides.NULL;
}
}
}
// default:
// {
// return OpeningSides.NULL;
// }
// }
//}
internal Enums.OpeningTypes GetOpeningType(Openings OpeningType)
{
@@ -797,11 +798,6 @@ namespace WebWindowComplex.Models
}
}
internal void SetIsMeasureGlass(bool IsMeasureGlass)
{
m_bIsMeasureGlass = IsMeasureGlass;
}
internal void SetIsSashVertical(bool IsSashVertical)
{
m_bIsSashVertical = IsSashVertical;
@@ -815,6 +811,10 @@ namespace WebWindowComplex.Models
}
}
/// <summary>
/// Metodo per impostare opzioni hardware da xml
/// </summary>
/// <param name="OptionXml"></param>
internal void SetHardwareOption(string OptionXml)
{
if (!string.IsNullOrEmpty(OptionXml))
@@ -928,10 +928,10 @@ namespace WebWindowComplex.Models
}
}
internal void SetSashType(SashTypes SashType)
{
m_SashType = SashType;
}
//internal void SetSashType(SashTypes SashType)
//{
// m_SashType = SashType;
//}
internal string SetSelFamilyHardwareFromIndex(string codHardware)
{
@@ -978,6 +978,11 @@ namespace WebWindowComplex.Models
if (split.SplitVertList.Count > 0)
{
double dim = width;
double widthGlass = width;
foreach (var elem in split.ElemDimVertList)
{
widthGlass = widthGlass - elem.dDimension;
}
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
@@ -987,27 +992,19 @@ namespace WebWindowComplex.Models
}
case MeasureTypes.PROPORTIONAL:
{
double widthGlass = width;
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType, split.SplitVertList.ElementAt(i).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitVertList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
}
foreach (var elem in split.ElemDimVertList)
{
widthGlass = widthGlass - elem.dDimension;
}
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass);
break;
}
case MeasureTypes.PERCENTAGE:
{
foreach (var elem in split.ElemDimVertList)
{
dim = dim - elem.dDimension;
}
dim = split.SplitVertList.ElementAt(i).dDimension * dim / 100;
dim = split.SplitVertList.ElementAt(i).dDimension * widthGlass / 100;
break;
}
}
@@ -1094,6 +1091,12 @@ namespace WebWindowComplex.Models
else
{
double dim = height;
double widthGlass = height;
int minSubArea = split.ElemDimHorizList.Min(x => x.nSubArea);
foreach (var elem in split.ElemDimHorizList.Where(x => x.nSubArea == minSubArea))
{
widthGlass = widthGlass - elem.dDimension;
}
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
@@ -1103,29 +1106,19 @@ namespace WebWindowComplex.Models
}
case MeasureTypes.PROPORTIONAL:
{
double widthGlass = height;
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(i).dDimension, split.SplitHorizList.ElementAt(i).SelMeasureType, split.SplitHorizList.ElementAt(i).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitHorizList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
}
int minSubArea = split.ElemDimHorizList.Min(x=>x.nSubArea);
foreach (var elem in split.ElemDimHorizList.Where(x=>x.nSubArea == minSubArea))
{
widthGlass = widthGlass - elem.dDimension;
}
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass);
break;
}
case MeasureTypes.PERCENTAGE:
{
int minSubArea = split.ElemDimHorizList.Min(x => x.nSubArea);
foreach (var elem in split.ElemDimHorizList.Where(x => x.nSubArea == minSubArea))
{
dim = dim - elem.dDimension;
}
dim = split.SplitHorizList.ElementAt(i).dDimension * dim / 100;
dim = split.SplitHorizList.ElementAt(i).dDimension * widthGlass / 100;
break;
}
}
@@ -1156,20 +1149,16 @@ namespace WebWindowComplex.Models
/// </summary>
private const string CustomHwId = "000000";
private bool m_bIsMeasureGlass;
private bool m_bIsSashVertical;
private bool m_bSashBottomRail;
private string m_CurrShape = "";
private List<Hardware> m_HardwareList = new List<Hardware>();
private List<AGBOption> m_HwOptionList = new List<AGBOption>();
private Dictionary<string, string> m_SelHwOptionList = new Dictionary<string, string>();
private int m_nSashBottomRailQty;
private List<ElementDimension> m_BottomRailElemDimList = new List<ElementDimension>();
private List<IdNameStruct> m_OrientationSashTypeList = new List<IdNameStruct>
{
+49 -89
View File
@@ -24,23 +24,13 @@ namespace WebWindowComplex.Models
switch (Parent.SashList[0].OpeningType)
{
case Openings.TURNONLY_LEFT:
{
SetOpeningType(Openings.TURNONLY_RIGHT);
break;
}
case Openings.TURNONLY_RIGHT:
{
SetOpeningType(Openings.TURNONLY_LEFT);
break;
}
case Openings.TILTTURN_LEFT:
{
SetOpeningType(Openings.TURNONLY_RIGHT);
break;
}
case Openings.TURNONLY_RIGHT:
case Openings.TILTTURN_RIGHT:
{
SetOpeningType(Openings.TURNONLY_LEFT);
@@ -156,14 +146,12 @@ namespace WebWindowComplex.Models
for (int i = 0; i < m_Parent.SashList.Count; i++)
{
if (i == 0)
widthTot = widthTot
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
widthTot = widthTot - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
else
widthTot = widthTot
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
+ m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
widthTot = widthTot - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
+ m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
}
}
double valMinAbsolute = 100;
@@ -308,7 +296,7 @@ namespace WebWindowComplex.Models
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = m_Parent.SashList.ElementAt(i);
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
item.SetDimension(ad.ConvertAbsoluteIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
}
}
foreach(var item in m_Parent.AreaList)
@@ -430,28 +418,15 @@ namespace WebWindowComplex.Models
else
{
for (int i = 0; i < m_Parent.SashList.Count - 1; i++)
{
widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap;
}
}
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach (var it in m_Parent.SashList)
{
newDimensions.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent));
}
//double overlap = 0;
//if (!Parent.bIsDimensionLight)
//{
// int index = m_Parent.SashList.IndexOf(this);
// if (index == 0)
// overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap;
// else
// overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap;
//}
if (newType is MeasureTypes.PROPORTIONAL)
{
newDimensions = ad.CalculatePropVal(newDimensions, nSashId - 1, widthTot);
newDimensions = ad.RicalculatePropVal(newDimensions, nSashId - 1, widthTot);
for (int i = 0; i < newDimensions.Count; i++)
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
}
@@ -509,11 +484,6 @@ namespace WebWindowComplex.Models
return JsonSashDimension;
}
//internal void SetDimension(double dValue)
//{
// m_dDimension = dValue;
//}
internal void SetHasHandle(bool value)
{
m_bHasHandle = value;
@@ -529,57 +499,47 @@ namespace WebWindowComplex.Models
SelMeasureType = value;
}
internal void SetSelMeasureType(MeasureTypes value, int indexSash)
{
if (SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
if (frame != null)
{
double widthTot = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
if (Parent.bIsDimensionLight)
{
for(int i = 0; i < Parent.SashList.Count; i++)
{
if (i == 0)
widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
else
widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
+ Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
}
}
else
{
for (int i = 0; i < m_Parent.SashList.Count - 1; i++)
{
widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap;
}
}
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach(var item in m_Parent.SashList)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent));
}
int index = m_Parent.SashList.IndexOf(this);
//double overlap = 0;
//if (index == 0)
// overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap;
//else
// overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap;
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;
}
}
}
//internal void SetSelMeasureType(MeasureTypes value, int indexSash)
//{
// if (SelMeasureType != (MeasureTypes)value)
// {
// MeasureTypes newType = (MeasureTypes)value;
// Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
// if (frame != null)
// {
// double widthTot = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
// if (Parent.bIsDimensionLight)
// {
// for(int i = 0; i < Parent.SashList.Count; i++)
// {
// if (i == 0)
// widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
// - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
// else
// widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
// - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
// + Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
// }
// }
// else
// {
// for (int i = 0; i < m_Parent.SashList.Count - 1; i++)
// {
// widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap;
// }
// }
// AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
// List<AreaDimension> newDimensions = new List<AreaDimension>();
// foreach(var item in m_Parent.SashList)
// {
// newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent));
// }
// int index = m_Parent.SashList.IndexOf(this);
// m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
// SelMeasureType = (MeasureTypes)value;
// }
// }
//}
#endregion Internal Methods
+250 -62
View File
@@ -32,12 +32,12 @@ namespace WebWindowComplex.Models
m_ElemDimHorizList.Clear();
double thickness = 78;
if (ParentArea is Sash || ParentArea.ParentArea is Sash)
thickness = 60;
thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd");
if (value)
{
for (int i = 0; i < nSplitQtyVert; i++)
{
SplitElementDimension newVertElem= elemVertListOld.Where(x=>x.nSubArea==1 && x.nIndex==i+1).First().Copy();
SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nSubArea == 1 && x.nIndex == i + 1).First().Copy();
newVertElem.SetElement(i + 1, thickness, 0);
m_ElemDimVertList.Add(newVertElem);
//m_ElemDimVertList.Add(new SplitElementDimension(this, i + 1, thickness, 0));
@@ -46,7 +46,7 @@ namespace WebWindowComplex.Models
{
for (int index = 0; index < nSplitQtyHoriz; index++)
{
SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nIndex == index+1).First().Copy();
SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nIndex == index + 1).First().Copy();
newHorizElem.SetElement(index + 1, thickness, subArea + 1);
m_ElemDimHorizList.Add(newHorizElem);
//m_ElemDimHorizList.Add(new SplitElementDimension(this, index + 1, thickness, subArea + 1));
@@ -57,7 +57,7 @@ namespace WebWindowComplex.Models
{
for (int i = 0; i < nSplitQtyHoriz; i++)
{
SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nSubArea == 1 && x.nIndex == i+1).First().Copy();
SplitElementDimension newHorizElem = elemHorizListOld.Where(x => x.nSubArea == 1 && x.nIndex == i + 1).First().Copy();
newHorizElem.SetElement(i + 1, thickness, 0);
m_ElemDimHorizList.Add(newHorizElem);
//m_ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, thickness, 0));
@@ -66,7 +66,7 @@ namespace WebWindowComplex.Models
{
for (int index = 0; index < nSplitQtyVert; index++)
{
SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nIndex == index+1).First().Copy();
SplitElementDimension newVertElem = elemVertListOld.Where(x => x.nIndex == index + 1).First().Copy();
newVertElem.SetElement(index + 1, thickness, subArea + 1);
m_ElemDimVertList.Add(newVertElem);
//m_ElemDimVertList.Add(new SplitElementDimension(this, index + 1, thickness, subArea + 1));
@@ -115,8 +115,8 @@ namespace WebWindowComplex.Models
Frame? frame = ParentWindow.AreaList.FirstOrDefault();
if(frame != null)
{
double heightTot = SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
//double heightTot = CalculateHeightArea(frame, frame.AvailHeightArea());
double heightTot = CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
//double heightTot = SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitHorizList.Count - 1)
{
@@ -141,7 +141,7 @@ namespace WebWindowComplex.Models
m_SplitHorizList.Add(new SplitDimension(dNewDimension, m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType, true, this, false));
double thickness = 78;
if (ParentArea is Sash || ParentArea.ParentArea is Sash)
thickness = 60;
thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd");
if (!m_bSplitStartVert)
{
//Aggiungo un elemento alla sottoarea principale
@@ -287,7 +287,7 @@ namespace WebWindowComplex.Models
Frame? frame = ParentWindow.AreaList.FirstOrDefault();
if (frame != null)
{
double widthTot = SplitVertList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
double widthTot = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//double widthTot = CalculateWidthArea(frame, frame.AvailWidthArea());
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitVertList.Count - 1)
@@ -313,7 +313,7 @@ namespace WebWindowComplex.Models
m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true));
double thickness = 78;
if (ParentArea is Sash || ParentArea.ParentArea is Sash)
thickness = 60;
thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd");
if (m_bSplitStartVert)
{
//Aggiungo un elemento alla sottoarea principale
@@ -321,7 +321,7 @@ namespace WebWindowComplex.Models
newElemDim.SetElement(ElemDimVertList.Max(x => x.nIndex) + 1, thickness, 0);
ElemDimVertList.Add(newElemDim);
//ElemDimVertList.Add(new SplitElementDimension(this, ElemDimVertList.Max(x => x.nIndex) + 1, 78, 0));
if(nSplitQtyHoriz > 0)
if (nSplitQtyHoriz > 0)
{
// Aggiungo a tutte le sottoaree degli element
int subArea = ElemDimHorizList.Max(x => x.nSubArea) + 1;
@@ -546,12 +546,6 @@ namespace WebWindowComplex.Models
newSplit.SplitVertList.Add(SplitVertList[i].Copy());
for (int i = 0; i < SplitHorizList.Count; i++)
newSplit.SplitHorizList.Add(SplitHorizList[i].Copy());
//newSplit.SetSplitQtyVert(nSplitQtyVert);
//for (int i = 0; i < SplitVertList.Count; i++)
// newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension);
//newSplit.SetSplitQtyHoriz(nSplitQtyHoriz);
//for (int i = 0; i < SplitHorizList.Count; i++)
// newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension);
newSplit.SetSplitShape(SelSplitShape);
newSplit.SetAreaType(AreaType);
foreach (var item in ElemDimHorizList)
@@ -627,13 +621,240 @@ namespace WebWindowComplex.Models
return Split;
}
/// <summary>
/// Metodo per calcolare altezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="height"> altezza di partenza </param>
/// <param name="res"> area di ritorno </param>
/// <returns></returns>
internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(this))
{
res.m_Dimension = height;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
if (split.SplitHorizList.Count > 0)
{
double dim = height;
foreach (var elem in split.ElemDimHorizList)
dim = dim - elem.dDimension;
int index = i;
if (split.SelSplitShape is SplitShapes.GRID)
index = i % split.SplitHorizList.Count;
switch (split.SplitHorizList.ElementAt(index).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
dim = split.SplitHorizList.ElementAt(index).dDimension;
break;
}
case MeasureTypes.PROPORTIONAL:
{
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitHorizList)
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim);
break;
}
case MeasureTypes.PERCENTAGE:
{
dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100;
break;
}
}
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
double dim = height;
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
else if (area is Sash sash)
{
double bottomRail = 0;
if (sash.SashBottomRailQty > 0)
{
foreach (var bottom in sash.BottomRailElemDimList)
bottomRail = bottomRail + bottom.dDimension
- bottom.dOverlap;
}
double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension
- sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension
- bottomRail;
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else if (area is Splitted splitted)
{
double dim = height;
if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh)
{
if (sp.SplitHorizList.Count > 0)
{
dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap
+ sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap;
}
}
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateHeightSplitGroup(item, height, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
return res;
}
/// <summary>
/// Metodo per calcolare larghezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="width"> larghezza di partenza </param>
/// <param name="res"> area di ritorno </param>
/// <returns></returns>
internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(this))
{
res.m_Dimension = width;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
if (split.SplitVertList.Count > 0)
{
int index = i;
double dim = width;
foreach (var elem in split.ElemDimVertList)
dim = dim - elem.dDimension;
if (split.SelSplitShape is SplitShapes.GRID)
index = i % split.SplitHorizList.Count;
switch (split.SplitVertList.ElementAt(index).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res);
break;
}
case MeasureTypes.PROPORTIONAL:
{
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitVertList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
}
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim), res);
break;
}
case MeasureTypes.PERCENTAGE:
{
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * dim / 100, res);
break;
}
}
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateWidthSplitGroup(item, width, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
else if (area is Sash sash)
{
double widthTot = width;
double dim = 0;
if (sash.ParentArea.ParentArea is Split)
widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap
+ sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
if (sash.bIsDimensionLight)
{
widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.First().ElementDimensionList.Last().dDimension;
for (int anta = 1; anta < sash.SashList.Count; anta++)
{
widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension
+ sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
}
}
else
{
for (int anta = 1; anta < sash.SashList.Count; anta++)
{
widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
}
}
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
dim = sash.SashList.ElementAt(i).dDimension;
break;
}
case MeasureTypes.PROPORTIONAL:
{
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in sash.SashList)
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot);
break;
}
case MeasureTypes.PERCENTAGE:
{
dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100;
break;
}
}
if (!sash.bIsDimensionLight)
dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
res = CalculateWidthSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateWidthSplitGroup(item, width, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
return res;
}
internal override JsonArea Serialize(bool hideHw)
{
if (nCounterGroup < GroupId)
Area.nCounterGroup = GroupId;
JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape, GroupId);
//foreach (var SplitPosition in m_SplitPositionList)
// JsonSplit.SplitPositionList.Add(SplitPosition.Serialize());
JsonSplit.SplitStartVert = bSplitStartVert;
foreach (var SplitVert in m_SplitVertList)
JsonSplit.SplitVertList.Add(SplitVert.Serialize());
@@ -690,11 +911,10 @@ namespace WebWindowComplex.Models
{
double thickness = 78;
if (ParentArea is Sash || ParentArea.ParentArea is Sash)
thickness = 60;
thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd");
// Un Elemento per ogni dimensione principale e per ogni sotto dimensione
if (bSplitStartVert)
{
for (int subArea = 0; subArea <= QtyVert; subArea++)
{
for (int i = 0; i < QtyHoriz; i++)
@@ -741,7 +961,7 @@ namespace WebWindowComplex.Models
{
double thickness = 78;
if (ParentArea is Sash || ParentArea.ParentArea is Sash)
thickness = 60;
thickness = Window.m_ParameterList.GetValueOrDefault("Sash_Sash_Split_DimStd");
// Un Elemento per ogni dimensione principale e per ogni sotto dimensione
if (bSplitStartVert)
{
@@ -769,41 +989,6 @@ namespace WebWindowComplex.Models
m_bSplitStartVert = SplitStartVert;
}
internal double HeightFrame()
{
double dim = 0;
switch (ParentWindow.AreaList.First().SelShapeIndex)
{
case (int)Shapes.RECTANGLE:
case (int)Shapes.TRIANGLE:
case (int)Shapes.ARC_FULL:
{
dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Height").First().dDimension;
break;
}
case (int)Shapes.RIGHTCHAMFER:
{
dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
break;
}
case (int)Shapes.LEFTCHAMFER:
{
dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
break;
}
default:
{
dim = ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
break;
}
}
foreach(var elem in ElemDimHorizList)
{
dim = dim - elem.dDimension;
}
return dim;
}
internal void UpdateSubAreaSplit()
{
if (SplitHorizList.Count > 0)
@@ -816,16 +1001,16 @@ namespace WebWindowComplex.Models
List<AreaDimension> dimList = new List<AreaDimension>();
foreach (var itemDim in SplitHorizList)
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
//double width = SplitHorizList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
////double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
//AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width");
double dim = currSplitDim.dDimension;
double height = 0;
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
{
Frame frame = ParentArea.ParentWindow.AreaList[0];
if (frame != null)
height = currSplitDim.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
{
height = CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
//height = currSplitDim.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
}
foreach (var elem in ElemDimHorizList)
height = height - elem.dDimension;
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1);
@@ -850,7 +1035,10 @@ namespace WebWindowComplex.Models
{
Frame frame = ParentArea.ParentWindow.AreaList[0];
if(frame != null)
width = currSplitDim.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
{
width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//width = currSplitDim.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
}
foreach (var elem in ElemDimVertList)
width = width - elem.dDimension;
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1);
+242 -249
View File
@@ -52,12 +52,14 @@ namespace WebWindowComplex.Models
subAreaVert = m_Parent.ElemDimVertList.Min(x => x.nSubArea);
if (m_Parent.ElemDimHorizList.Count > 0)
subAreaHoriz = m_Parent.ElemDimHorizList.Min(x => x.nSubArea);
double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//double width = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
double width = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
foreach (var item in m_Parent.ElemDimVertList.Where(x=>x.nSubArea == subAreaVert))
{
width = width - item.dDimension;
}
double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
double height = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
//double height = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
foreach (var item in m_Parent.ElemDimHorizList.Where(x => x.nSubArea == subAreaHoriz))
{
height = height - item.dDimension;
@@ -225,7 +227,7 @@ namespace WebWindowComplex.Models
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = dimensions.ElementAt(i);
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot));
item.SetDimension(ad.ConvertAbsoluteIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot));
}
}
for (int i = 0; i < m_Parent.AreaList.Count; i++)
@@ -293,7 +295,8 @@ namespace WebWindowComplex.Models
splitElemList = m_Parent.ElemDimVertList;
else
splitElemList = m_Parent.ElemDimVertList.Where(x => x.nSubArea == 1).ToList();
dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
dimSplitGroup = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
}
else
{
@@ -302,7 +305,8 @@ namespace WebWindowComplex.Models
splitElemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList();
else
splitElemList = m_Parent.ElemDimHorizList;
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
dimSplitGroup = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
//dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
}
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
List<AreaDimension> adList = new List<AreaDimension>();
@@ -316,7 +320,7 @@ namespace WebWindowComplex.Models
}
if (newType is MeasureTypes.PROPORTIONAL)
{
adList = ad.CalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup);
adList = ad.RicalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup);
for (int i = 0; i < adList.Count; i++)
splitList.ElementAt(i).SetDimension(adList.ElementAt(i).dDimension);
}
@@ -342,247 +346,234 @@ namespace WebWindowComplex.Models
#region Internal Methods
/// <summary>
/// Metodo per calcolare larghezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="width"> larghezza di partenza </param>
/// <param name="res"> area di ritorno </param>
/// <returns></returns>
internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(m_Parent))
{
res.m_Dimension = width;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
if(split.SplitVertList.Count > 0)
{
int index = i;
double widthGlass = width;
foreach (var elem in split.ElemDimVertList)
widthGlass = widthGlass - elem.dDimension;
if (split.SelSplitShape is SplitShapes.GRID)
index = i % split.SplitHorizList.Count;
switch (split.SplitVertList.ElementAt(index).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res);
break;
}
case MeasureTypes.PROPORTIONAL:
{
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitVertList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
}
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass), res);
break;
}
case MeasureTypes.PERCENTAGE:
{
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * widthGlass / 100, res);
break;
}
}
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateWidthSplitGroup(item, width, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
else if (area is Sash sash)
{
double widthTot = width;
double dim = 0;
if (sash.ParentArea.ParentArea is Split)
widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap
+ sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
if (sash.bIsDimensionLight)
{
widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.First().ElementDimensionList.Last().dDimension;
for (int anta = 1; anta < sash.SashList.Count; anta++)
{
widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension
+ sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
}
}
else
{
for (int anta = 1; anta < sash.SashList.Count; anta++)
{
widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
}
}
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
dim = sash.SashList.ElementAt(i).dDimension;
break;
}
case MeasureTypes.PROPORTIONAL:
{
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in sash.SashList)
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot);
break;
}
case MeasureTypes.PERCENTAGE:
{
dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100;
break;
}
}
if (!sash.bIsDimensionLight)
dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
- sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
res = CalculateWidthSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateWidthSplitGroup(item, width, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
return res;
}
///// <summary>
///// Metodo per calcolare larghezza intero split group
///// </summary>
///// <param name="area"> area di partenza </param>
///// <param name="width"> larghezza di partenza </param>
///// <param name="res"> area di ritorno </param>
///// <returns></returns>
//internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res)
//{
// for (int i = 0; i < area.AreaList.Count; i++)
// {
// if (area.Equals(m_Parent))
// {
// res.m_Dimension = width;
// res.m_Found = true;
// return res;
// }
// Area item = area.AreaList[i];
// if (area is Split split)
// {
// if(split.SplitVertList.Count > 0)
// {
// int index = i;
// double dim = width;
// foreach (var elem in split.ElemDimVertList)
// dim = dim - elem.dDimension;
// if (split.SelSplitShape is SplitShapes.GRID)
// index = i % split.SplitHorizList.Count;
// switch (split.SplitVertList.ElementAt(index).SelMeasureType)
// {
// case MeasureTypes.ABSOLUTE:
// {
// res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res);
// break;
// }
// case MeasureTypes.PROPORTIONAL:
// {
// AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent);
// List<AreaDimension> adList = new List<AreaDimension>();
// foreach (var it in split.SplitVertList)
// {
// adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
// }
// res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim), res);
// break;
// }
// case MeasureTypes.PERCENTAGE:
// {
// res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * dim / 100, res);
// break;
// }
// }
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// else
// {
// res = CalculateWidthSplitGroup(item, width, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// }
// else if (area is Sash sash)
// {
// double widthTot = width;
// double dim = 0;
// if (sash.ParentArea.ParentArea is Split)
// widthTot = widthTot + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap
// + sash.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
// if (sash.bIsDimensionLight)
// {
// widthTot = widthTot - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension
// - sash.SashList.First().ElementDimensionList.Last().dDimension;
// for (int anta = 1; anta < sash.SashList.Count; anta++)
// {
// widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension
// - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension
// + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
// }
// }
// else
// {
// for (int anta = 1; anta < sash.SashList.Count; anta++)
// {
// widthTot = widthTot + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap;
// }
// }
// switch (sash.SashList.ElementAt(i).SelMeasureType)
// {
// case MeasureTypes.ABSOLUTE:
// {
// dim = sash.SashList.ElementAt(i).dDimension;
// break;
// }
// case MeasureTypes.PROPORTIONAL:
// {
// AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent);
// List<AreaDimension> adList = new List<AreaDimension>();
// foreach (var it in sash.SashList)
// adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
// dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot);
// break;
// }
// case MeasureTypes.PERCENTAGE:
// {
// dim = sash.SashList.ElementAt(i).dDimension * widthTot / 100;
// break;
// }
// }
// if (!sash.bIsDimensionLight)
// dim = dim - sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
// - sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
// res = CalculateWidthSplitGroup(item, dim, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// else
// {
// res = CalculateWidthSplitGroup(item, width, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// }
// return res;
//}
/// <summary>
/// Metodo per calcolare altezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="height"> altezza di partenza </param>
/// <param name="res"> area di ritorno </param>
/// <returns></returns>
internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
if (area.Equals(m_Parent))
{
res.m_Dimension = height;
res.m_Found = true;
return res;
}
Area item = area.AreaList[i];
if (area is Split split)
{
if (split.SplitHorizList.Count > 0)
{
double dim = height;
int index = i;
if (split.SelSplitShape is SplitShapes.GRID)
index = i % split.SplitHorizList.Count;
switch (split.SplitHorizList.ElementAt(index).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
dim = split.SplitHorizList.ElementAt(index).dDimension;
break;
}
case MeasureTypes.PROPORTIONAL:
{
double heigthGlass = 0;
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in split.SplitHorizList)
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
foreach (var elem in split.ElemDimHorizList)
heigthGlass = heigthGlass - elem.dDimension;
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, heigthGlass);
break;
}
case MeasureTypes.PERCENTAGE:
{
foreach(var elem in split.ElemDimHorizList)
dim = dim - elem.dDimension;
dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100;
break;
}
}
//if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
//{
// dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
//}
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
double dim = height;
//if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
//{
// dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
//}
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
else if (area is Sash sash)
{
double bottomRail = 0;
if(sash.SashBottomRailQty > 0)
{
foreach (var bottom in sash.BottomRailElemDimList)
bottomRail = bottomRail + bottom.dDimension
- bottom.dOverlap;
}
double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension
- sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension
- bottomRail;
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else if (area is Splitted splitted)
{
double dim = height;
if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh)
{
if (sp.SplitHorizList.Count > 0)
{
dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap
+ sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap;
}
}
res = CalculateHeightSplitGroup(item, dim, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
else
{
res = CalculateHeightSplitGroup(item, height, res);
if (res.m_Dimension != -1 && res.m_Found)
return res;
}
}
return res;
}
///// <summary>
///// Metodo per calcolare altezza intero split group
///// </summary>
///// <param name="area"> area di partenza </param>
///// <param name="height"> altezza di partenza </param>
///// <param name="res"> area di ritorno </param>
///// <returns></returns>
//internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res)
//{
// for (int i = 0; i < area.AreaList.Count; i++)
// {
// if (area.Equals(m_Parent))
// {
// res.m_Dimension = height;
// res.m_Found = true;
// return res;
// }
// Area item = area.AreaList[i];
// if (area is Split split)
// {
// if (split.SplitHorizList.Count > 0)
// {
// double dim = height;
// foreach (var elem in split.ElemDimHorizList)
// dim = dim - elem.dDimension;
// int index = i;
// if (split.SelSplitShape is SplitShapes.GRID)
// index = i % split.SplitHorizList.Count;
// switch (split.SplitHorizList.ElementAt(index).SelMeasureType)
// {
// case MeasureTypes.ABSOLUTE:
// {
// dim = split.SplitHorizList.ElementAt(index).dDimension;
// break;
// }
// case MeasureTypes.PROPORTIONAL:
// {
// AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent);
// List<AreaDimension> adList = new List<AreaDimension>();
// foreach (var it in split.SplitHorizList)
// adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
// dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, dim);
// break;
// }
// case MeasureTypes.PERCENTAGE:
// {
// dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100;
// break;
// }
// }
// res = CalculateHeightSplitGroup(item, dim, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// else
// {
// double dim = height;
// res = CalculateHeightSplitGroup(item, dim, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// }
// else if (area is Sash sash)
// {
// double bottomRail = 0;
// if(sash.SashBottomRailQty > 0)
// {
// foreach (var bottom in sash.BottomRailElemDimList)
// bottomRail = bottomRail + bottom.dDimension
// - bottom.dOverlap;
// }
// double dim = height - sash.SashList.First().ElementDimensionList.First().dDimension
// - sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension
// - bottomRail;
// res = CalculateHeightSplitGroup(item, dim, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// else if (area is Splitted splitted)
// {
// double dim = height;
// if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh)
// {
// if (sp.SplitHorizList.Count > 0)
// {
// dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap
// + sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap;
// }
// }
// res = CalculateHeightSplitGroup(item, dim, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// else
// {
// res = CalculateHeightSplitGroup(item, height, res);
// if (res.m_Dimension != -1 && res.m_Found)
// return res;
// }
// }
// return res;
//}
internal JsonSplitDimension Serialize()
{
@@ -623,7 +614,8 @@ namespace WebWindowComplex.Models
splitElemList = m_Parent.ElemDimVertList;
else
splitElemList = m_Parent.ElemDimVertList.Where(x => x.nSubArea == 1).ToList();
dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
//dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
dimSplitGroup = Parent.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
}
else
{
@@ -632,7 +624,8 @@ namespace WebWindowComplex.Models
splitElemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList();
else
splitElemList = m_Parent.ElemDimHorizList;
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
//dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
dimSplitGroup = (Parent.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
}
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
List<AreaDimension> adList = new List<AreaDimension>();
@@ -646,7 +639,7 @@ namespace WebWindowComplex.Models
}
if (newType is MeasureTypes.PROPORTIONAL)
{
adList = ad.CalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup);
adList = ad.RicalculatePropVal(adList, splitList.IndexOf(this), dimSplitGroup);
for (int i = 0; i < adList.Count; i++)
splitList.ElementAt(i).SetDimension(adList.ElementAt(i).dDimension);
}