Exemplo n.º 1
0
        public void RefreshView()
        {
            if (Boreholes == null || Boreholes.Count == 0)
            {
                return;
            }

            SortBoreholesByMileage();
            SearchBoreholesTopAndBase();
            ScaleY = (ViewerHeight - 80) / TotalLength;

            LayoutRoot.Children.Clear();
            LayoutRoot.Width  = 0.0;
            LayoutRoot.Height = ViewerHeight;

            int      i          = 0;
            Brush    blackBrush = new SolidColorBrush(Colors.Black);
            Polyline pline      = new Polyline();

            pline.Stroke = blackBrush;

            foreach (Borehole bh in Boreholes)
            {
                BoreholeView bhView = new BoreholeView();
                bhView.BH_Width = bh_width;
                bhView.ScaleY   = ScaleY;
                bhView.Strata   = Strata;
                bhView.Borehole = bh;
                bhView.RefreshView();
                if (bhView.IsEmpty)
                {
                    continue;
                }

                double             bhTop     = bh.Top;
                double             y         = (Top - bhTop) * ScaleY;
                TranslateTransform translate = new TranslateTransform();
                translate.X            = i * x_space * ScaleX;
                translate.Y            = y + y_margin;
                bhView.RenderTransform = translate;

                LayoutRoot.Children.Add(bhView);
                LayoutRoot.Width += x_space * ScaleX;

                if (bh.Mileage != null)
                {
                    TextBlock tbMileage = new TextBlock();
                    tbMileage.Foreground = blackBrush;
                    tbMileage.Text       = bh.Mileage.Value.ToString("0.0");
                    Canvas.SetTop(tbMileage, ViewerHeight - 40);
                    Canvas.SetLeft(tbMileage, translate.X);
                    LayoutRoot.Children.Add(tbMileage);

                    Line tickMileageLine = new Line();
                    tickMileageLine.Stroke          = blackBrush;
                    tickMileageLine.StrokeThickness = 1;
                    tickMileageLine.X1 = translate.X + bh_width / 2;
                    tickMileageLine.Y1 = ViewerHeight - 50;
                    tickMileageLine.X2 = tickMileageLine.X1;
                    tickMileageLine.Y2 = tickMileageLine.Y1 + 10;
                    LayoutRoot.Children.Add(tickMileageLine);

                    pline.Points.Add(new Point(tickMileageLine.X2, tickMileageLine.Y2));
                }
                i++;
            }

            if (pline.Points.Count >= 2)
            {
                LayoutRoot.Children.Add(pline);
            }
        }
        public void RefreshView()
        {
            if (Boreholes == null || Boreholes.Count == 0)
                return;

            SortBoreholesByMileage();
            SearchBoreholesTopAndBase();
            ScaleY = (ViewerHeight - 80) / TotalLength;

            LayoutRoot.Children.Clear();
            LayoutRoot.Width = 0.0;
            LayoutRoot.Height = ViewerHeight;

            int i = 0;
            Brush blackBrush = new SolidColorBrush(Colors.Black);
            Polyline pline = new Polyline();
            pline.Stroke = blackBrush;

            foreach (Borehole bh in Boreholes)
            {
                BoreholeView bhView = new BoreholeView();
                bhView.BH_Width = bh_width;
                bhView.ScaleY = ScaleY;
                bhView.Strata = Strata;
                bhView.Borehole = bh;
                bhView.RefreshView();
                if (bhView.IsEmpty)
                    continue;

                double bhTop = bh.Top;
                double y = (Top - bhTop) * ScaleY;
                TranslateTransform translate = new TranslateTransform();
                translate.X = i * x_space * ScaleX;
                translate.Y = y + y_margin;
                bhView.RenderTransform = translate;

                LayoutRoot.Children.Add(bhView);
                LayoutRoot.Width += x_space * ScaleX;

                if (bh.Mileage != null)
                {
                    TextBlock tbMileage = new TextBlock();
                    tbMileage.Foreground = blackBrush;
                    tbMileage.Text = bh.Mileage.Value.ToString("0.0");
                    Canvas.SetTop(tbMileage, ViewerHeight - 40);
                    Canvas.SetLeft(tbMileage, translate.X);
                    LayoutRoot.Children.Add(tbMileage);

                    Line tickMileageLine = new Line();
                    tickMileageLine.Stroke = blackBrush;
                    tickMileageLine.StrokeThickness = 1;
                    tickMileageLine.X1 = translate.X + bh_width/2;
                    tickMileageLine.Y1 = ViewerHeight - 50;
                    tickMileageLine.X2 = tickMileageLine.X1;
                    tickMileageLine.Y2 = tickMileageLine.Y1 + 10;
                    LayoutRoot.Children.Add(tickMileageLine);

                    pline.Points.Add(new Point(tickMileageLine.X2, tickMileageLine.Y2));
                }
                i++;
            }

            if (pline.Points.Count >= 2)
                LayoutRoot.Children.Add(pline);
        }