Example #1
0
 private void btn_Line_Click(object sender, RoutedEventArgs e)
 {
     Points = CGenerator.Points(10, 0, 600, 0, 400);
     GLines = Points.ToLines(GeometryEngine.GCanvas);
     GeometryEngine.Shapes["Lines"].AddRange((List <GLine>)GLines);
     GeometryEngine.Render("Lines");
 }
Example #2
0
        private void btn_point_Click(object sender, RoutedEventArgs e)
        {
            Points = CGenerator.Points(10, 0, 600, 0, 400);
            var circles = Points.ToCircles(GeometryEngine.GCanvas);

            GeometryEngine.Shapes["Points"].AddRange(circles);
            GeometryEngine.Render("Points");
        }
Example #3
0
        private void ClosestPair_Step(object sender, EventArgs e)
        {
            var myClosestPair = (ClosestPair)sender;

            GeometryEngine.Remove("ClosestPair");
            var clostPair = myClosestPair.Result.ToCircles(GeometryEngine.GCanvas, Brushes.Green, 10);

            GeometryEngine.Shapes["ClosestPair"].AddRange(clostPair);
            GeometryEngine.Render("ClosestPair");
            GeometryEngine.GCanvas.Canvas.UpdateLayout();
        }
Example #4
0
        private void btn_SegIntersect_Click(object sender, RoutedEventArgs e)
        {
            SegIntersect Segments = new SegIntersect(GLines);

            Segments.Run();
            //  var mySegments = (SegIntersect)sender;

            GeometryEngine.Remove("ClosestPair");
            var clostPair = Segments.Intersected.ToCircles(GeometryEngine.GCanvas, Brushes.Green, 10);

            GeometryEngine.Shapes["ClosestPair"].AddRange(clostPair);
            GeometryEngine.Render("ClosestPair");
        }
        private void Btn_LoadShow_Click(object sender, RoutedEventArgs e)
        {
            GeometryEngine.Remove("DistributedLoad");
            GeometryEngine.Remove("ConcentratedLoad");
            GeometryEngine.Remove("Text");

            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);
            }
            //List<string> Dead = new List<string>();
            //List<string> Live = new List<string>();
            //List<string> SD = new List<string>();

            int[] Js = new int[DistLoadAssignmentViewModel.DistLoadModelStaticCollection.Count];
            //int YPosition = 100;

            //Draw Distributed Load
            for (int i = 0; i < DistLoadAssignmentViewModel.DistLoadModelStaticCollection.Count; i++)
            {
                double startX = GComSpanValues[DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].selectedSpanNo - 1] * 20;
                double endX   = GComSpanValues[DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].selectedSpanNo] * 20;
                if (DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].selectedLoadCase
                    == (ShowLoadComboBox.SelectedItem).ToString())
                {
                    GeometryEngine.Shapes["DistributedLoad"].Add(new ArrowLoad(GeometryEngine.GCanvas
                                                                               , new Point(startX, 130), new Point(endX, 130)
                                                                               , DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].DistLoadVal * 0.50));

                    /*-----------------------Add Text-----------------------*/
                    GeometryEngine.Shapes["Text"].Add(new GText(GeometryEngine.GCanvas, new Point(startX, 70), $"{DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].DistLoadVal} KN/m"));
                }
            }
            List <double> spanList = GeometryEditorVM.GeometryEditor.GridData.Select(d => d.Span).ToList();

            //Draw Point Load
            for (int i = 0; i < PointLoadAssignmentViewModel.PointLoadModelStaticCollection.Count; i++)
            {
                //double startX = GComSpanValues[DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].selectedSpanNo - 1] * 20;
                //double endX = GComSpanValues[DistLoadAssignmentViewModel.DistLoadModelStaticCollection[i].selectedSpanNo] * 20;
                if (PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].selectedLoadCase
                    == (ShowLoadComboBox.SelectedItem).ToString() && ShowLoadComboBox.SelectedItem != null)
                {
                    var arrow = new Arrow(GeometryEngine.GCanvas,
                                          new Point(GComSpanValues[PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].selectedSpanNo - 1] * 20
                                                    + PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].RelativeDistance *
                                                    spanList[PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].selectedSpanNo - 1] * 20, 130 /**/), 60);
                    arrow.Rotate(180);
                    GeometryEngine.Shapes["ConcentratedLoad"].Add(arrow);

                    /*-----------------------Add Text-----------------------*/
                    GeometryEngine.Shapes["Text"].Add(new GText(GeometryEngine.GCanvas, new Point(GComSpanValues[PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].selectedSpanNo - 1] * 20
                                                                                                  + PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].RelativeDistance *
                                                                                                  spanList[PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].selectedSpanNo - 1] * 20, 40), $"{PointLoadAssignmentViewModel.PointLoadModelStaticCollection[i].PointLoadVal} KN"));
                }
            }

            GeometryEngine.Shapes["Text"].ForEach(d => ((GText)d).Size = 20);

            GeometryEngine.Render("DistributedLoad");
            GeometryEngine.Render("ConcentratedLoad");
            GeometryEngine.Render("Text");

            //GeometryEngine.RenderAll();
        }