Example #1
0
 private void btn_Clear_Click(object sender, RoutedEventArgs e)
 {
     GeometryEngine.RemoveAll();
 }
        private void Btn_Ok_Click(object sender, RoutedEventArgs e)
        {
            if (GeometryEditorVM.GeometryEditor.GridData.Count < 1)
            {
                return;
            }
            DrawingHelper.GLineList.Clear();
            List <double> GComSpanValues = new List <double>();

            GComSpanValues.Clear();
            GComSpanValues.Add(0);
            double cumulativeSpans = 0;

            for (int i = 0; i < GeometryEditorVM.GeometryEditor.NumberOfSpans; i++)
            {
                cumulativeSpans += GeometryEditorVM.GeometryEditor.GridData[i].Span;

                GComSpanValues.Add(cumulativeSpans);
            }


            if (GeometryEditorVM.GeometryEditor.NumberOfSpans < 1)
            {
                return;
            }
            GeometryEngine.RemoveAll();

            for (int i = 0; i < GeometryEditorVM.GeometryEditor.NumberOfSpans; i++)
            {
                GeometryEngine.Shapes["Beams"].Add(new GLine(GeometryEngine.GCanvas, new Point(GComSpanValues[i] * 20, 130)
                                                             , new Point(GComSpanValues[i + 1] * 20, 130)));
                // GeometryEngine.Shapes["Beams"].ForEach(d => { d.Scale = 10;d.New(); });
                //new Hinged(GeometryEngine.GCanvas, new Point(GComSpanValues[i] * 20, 100));
            }


            for (int i = 0; i < GeometryEditorVM.GeometryEditor.RestraintsCollection.Count; i++)
            {
                switch (GeometryEditorVM.GeometryEditor.RestraintsCollection[i].SelectedRestraint)
                {
                case Restraints.Fixed:
                    //Revise
                    GeometryEngine.Shapes["Supports"].Add(
                        new Fixed(GeometryEngine.GCanvas, new Point(GComSpanValues[i] * 20, 130), 20));
                    break;

                case Restraints.Hinged:
                    GeometryEngine.Shapes["Supports"].Add(
                        new Hinged(GeometryEngine.GCanvas, new Point(GComSpanValues[i] * 20, 130)));
                    break;

                case Restraints.Roller:
                    GeometryEngine.Shapes["Supports"].Add(
                        new Roller(GeometryEngine.GCanvas, new Point(GComSpanValues[i] * 20, 130)));
                    break;

                case Restraints.NoRestraints:
                    break;

                default:
                    break;
                }
            }

            GeometryEngine.RenderAll();
            GeometryEngine.Shapes["Supports"].ForEach(d => d.SetScale(0.75));
            //GeometryEngine.Shapes.Add("li", new List<GShape>()); Add List in Real Time
            this.Close();
        }