private void loopDifflection(NAngleEmprovedForm owner) { if (owner.getAngleStart() == 2 || owner.getAngleStart() == 3 || owner.getAngleStart() == 4 || owner.getAngleEnd() == 2 || owner.getAngleEnd() == 3 || owner.getAngleEnd() == 4) { if (cells is CircleCells) { circleDrawer = new CircleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, 0); } if (cells is RectangleCells) { rectDrawer = new RectangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer); } else if (cells is TriangleCells) { triangleDrawer = new TriangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer); } else { cellsDraw = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, 0); } calculation(owner); } else { double DeflectionStart = owner.getDeflectionStart(); double DeflectionEnd = owner.getDeflectionEnd(); double DeflectionStep = owner.getDeflectionStep(); if (DeflectionStart > DeflectionEnd && DeflectionStep < 0) { for (double i = DeflectionStart; i >= DeflectionEnd; i = i + DeflectionStep) { cellsDraw = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, i); //cells.SetCellsV((FreeClass.body.GetV() * i) / 100); calculation(owner); } } else if (DeflectionStart <= DeflectionEnd && DeflectionStep > 0) { for (double i = DeflectionStart; i <= DeflectionEnd; i = i + DeflectionStep) { cellsDraw = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, i); //cells.SetCellsV((FreeClass.body.GetV() * i) / 100); calculation(owner); } } else if (DeflectionStep == 0) { cellsDraw = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, DeflectionStart); //cells.SetCellsV((FreeClass.body.GetV() * DeflectionStart) / 100); calculation(owner); } else { throw new Exception(); } //angle //calculation(owner); } }
private void drawButton_Click(object sender, EventArgs e) { if (cells == null) { MessageBox.Show("Расчёты не были произведены. Невозможно построить ячеистую структуру"); return; } if (FreeClass.bodyDrawer == null) { MessageBox.Show("Тело не было построенно. Невозможно построить ячеистую структуру"); return; } if (!cells.isAvailable()) { MessageBox.Show("Невозможно построить структуру. Проверьте вычисления"); return; } if (loopBuildRadioButton.Checked) { DialogResult dialogResult = MessageBox.Show("Выбрано циклическое построение. Будет выполненно только одно " + "построение (самое последнее). Продолжить?", "Предупреждение", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } } int angel = Convert.ToInt16(difflectAngleStartTextBox.Text); if (cells is CircleCells) { circleDrawer = new CircleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, 0); circleDrawer.SetCells((CircleCells)cells); FreeClass.cells = circleDrawer; circleDrawer.drawCells(); } else if (cells is RectangleCells) { rectDrawer = new RectangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer); rectDrawer.SetCells((RectangleCells)cells); FreeClass.cells = rectDrawer; rectDrawer.drawCells(); } else if (cells is TriangleCells) { triangleDrawer = new TriangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer); triangleDrawer.SetCells((TriangleCells)cells); FreeClass.cells = triangleDrawer; triangleDrawer.drawCells(); } else { drawer = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, angel); drawer.SetCells((AbstractRelationAngle)cells); FreeClass.cells = drawer; drawer.drawCells(); } /*if (drawer != null) { FreeClass.cells = drawer; drawer.drawCells(); } * else { FreeClass.cells = triangleDrawer; triangleDrawer.drawCells(); } * /*drawer = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, angel); * drawer.SetCells((AbstractRelationAngle)cells);*/ //FreeClass.cells = drawer; drawer.drawCells(); //FreeClass.cells = drawer; //drawer.SetCells(cells); drawer.drawCells(); }