/// <summary> /// Convert granne to drawing rectangle /// </summary> /// <returns>sized rectangle</returns> internal AreaSizedRectangle ConvertToDrawingRectangle() { int width = (int)(this.sizeX * (uint)Granne.granneX); int height = (int)(this.sizeY * (uint)Granne.granneY); AreaSizedRectangle s = new AreaSizedRectangle(width, height, (int)sizeX, (int)sizeY, (int)this.indexY, (int)this.indexY); s.StartWidth = Convert.ToInt32(this.indexX); s.StartHeight = Convert.ToInt32(this.indexY); return(s); }
/// <summary> /// Construct all zones and compute total size /// </summary> /// <param name="c">column count</param> /// <param name="l">list count</param> /// <param name="list">list of rectangle the user supplied</param> /// <param name="hList">horizontal zones list</param> /// <param name="width">width</param> /// <param name="height">height</param> /// <param name="constraintWidth">constraint width</param> /// <param name="constraintHeight">constraint height</param> public static void MakeZones(uint c, uint l, List <AreaSizedRectangle> list, List <HorizontalZone> hList, uint width, uint height, EnumConstraint constraintWidth, EnumConstraint constraintHeight) { AreaSizedRectangle[,] indexes = new AreaSizedRectangle[c, l]; for (int index = 0; index < list.Count; ++index) { AreaSizedRectangle current = list[index]; indexes[current.StartWidth, current.StartHeight] = current; } double deltaWidth = width / (double)c; double deltaHeight = height / (double)l; // ranger les données dans la master page for (int pos_ligne = 0; pos_ligne < l; ++pos_ligne) { HorizontalZone hz; hz = new HorizontalZone(); hz.ConstraintWidth = constraintWidth; hz.ConstraintHeight = EnumConstraint.AUTO; hz.Width = width; int maxCountLines; uint maxHeight; maxHeight = 0; maxCountLines = 0; for (int pos_colonne = 0; pos_colonne < c; ++pos_colonne) { AreaSizedRectangle current = indexes[pos_colonne, pos_ligne]; if (current != null) { VerticalZone vz = new VerticalZone(); vz.CountLines = current.CountHeight; vz.CountColumns = current.CountWidth; vz.Width = Convert.ToUInt32(deltaWidth * current.CountWidth); vz.Height = Convert.ToUInt32(deltaHeight * current.CountHeight); vz.ConstraintWidth = constraintWidth; vz.ConstraintHeight = constraintHeight; hz.VerticalZones.Add(vz); if (maxCountLines < vz.CountLines) { maxCountLines = vz.CountLines; } if (maxHeight < vz.Height) { maxHeight = vz.Height; } } } hz.CountLines = maxCountLines; hz.Height = maxHeight; hList.Add(hz); } }