protected void DrawRebar(DovDrawings graphic, ChartStyle cs) { float x; float y; float radius; float limitXNeg = -secRec.Width * 0.5f; float limitXPos = secRec.Width * 0.5f; float limitYNeg = -secRec.Height * 0.5f; float limitYPos = secRec.Height * 0.5f; PointF loc; rebarLocLibrary = rebarLocLibrary.OrderBy(reb => reb.LocY).ToList(); float locY = 0; bool start = true; RebarLocSorted.Clear(); foreach (DovRebarLocation bars in rebarLocLibrary) { if (start) { locY = bars.LocY; start = false; } if (locY == bars.LocY) { if (!RebarLocSorted.ContainsKey(locY)) { Stack <DovRebarLocation> bar = new Stack <DovRebarLocation>(); bar.Push(bars); RebarLocSorted[locY] = bar; } else { RebarLocSorted[locY].Push(bars); } } else { locY = bars.LocY; Stack <DovRebarLocation> bar = new Stack <DovRebarLocation>(); bar.Push(bars); RebarLocSorted[locY] = bar; } x = bars.LocX; y = bars.LocY; if ((x < limitXNeg || x > limitXPos) || (y < limitYNeg || y > limitYPos)) { RebarLocationMessage = "Error: location is not within the boundary of the section"; RebarLocMsgColor = "red"; continueDesign = false; break; } else { graphic.DrwColor = "white"; graphic.LineThickness = 2; graphic.FillColorOpt = "red"; RebarLocMsgColor = ""; RebarLocationMessage = "Enter Location of rebars"; radius = bars.Diameter * 0.5f; radius = cs.ScaleX(radius); loc = cs.Point2D(new PointF(x, y)); graphic.DrawArc(loc.X, loc.Y, radius, 0, 2 * Math.PI); continueDesign = true; } foreach (KeyValuePair <float, Stack <DovRebarLocation> > rebar in RebarLocSorted) { re = rebar.Value.ToArray(); for (int i = 0; i < re.Length - 1; i++) { float xl = re[i].LocX; for (int j = i + 1; j < re.Length; j++) { if (xl == re[j].LocX) { RebarLocationMessage = "Warning: There are dublicate of bars, one of them will be used."; RebarLocMsgColor = "red"; } } } } } }