Exemple #1
0
        public void DrawWells()
        {
            System.Diagnostics.Debug.WriteLine("Engine [DrawWells]");

            GL.CallList(grid.welsID);

            CoordConverter cordconv = new CoordConverter(this);

            cordconv.CurrentViewMode = CurrentViewMode;

            render.Clear(Color.Transparent);

            foreach (ECL.WELLDATA well in grid.ACTIVE_WELLS)
            {
                if (well.COMPLS.Count > 0)
                {
                    render.DrawWell(well, WellsFont, Brushes.Black, cordconv, style, camera.is_mouse_shift);
                }
            }
        }
Exemple #2
0
        public void DrawWell(ECL.WELLDATA well, Font font, Brush brush, CoordConverter cordconv, Form2DModelStyle style, bool MoveMode)
        {
            PointF point = cordconv.ConvertWorldToScreen(well.XC, well.YC);

            // 100 m3 = 10 pt

            float  size = 0; // Размер круга
            float  wcut = 1; // Обводненность
            double wlpr = 0;

            Rectangle  bubble_rec      = new Rectangle(0, 0, 0, 0);
            RectangleF value_label_rec = new RectangleF(0, 0, 0, 0);
            Rectangle  point_rec       = new Rectangle(0, 0, 0, 0);

            if (style.BubbleMode == BubbleMode.Simulation)
            {
                size = (int)(Math.Abs(well.WLPR) * style.ScaleFactor * 0.01);
                if (size < min_bubble_size)
                {
                    size = min_bubble_size;
                }

                wcut = well.WLPR == 0 ? 0 : (float)(well.WWPR / well.WLPR);
                wlpr = well.WLPR;
            }

            if (style.BubbleMode == BubbleMode.Historical)
            {
                if (well.WLPR < 0)
                {
                    size = (int)(Math.Abs(well.WWPRH) * style.ScaleFactor * 0.01);
                    wlpr = Math.Abs(well.WWPRH);
                    wcut = 1;
                }
                else
                {
                    size = (int)(Math.Abs(well.WLPRH) * style.ScaleFactor * 0.01);
                    wcut = well.WLPRH == 0 ? 0 : (float)(well.WWPRH / well.WLPRH);
                    wlpr = well.WLPRH;
                }

                if (size < min_bubble_size)
                {
                    size = min_bubble_size;
                }
            }

            // Добывающие скважины

            if (well.WLPR >= 0)
            {
                if (style.ShowBubbles && !MoveMode)
                {
                    Point bubble_centr = new Point((int)(point.X - size / 2), (int)(point.Y - size / 2));
                    bubble_rec = new Rectangle(bubble_centr, new Size((int)size, (int)size));

                    gfx.DrawEllipse(new Pen(Color.Black, pen_bubble_width), bubble_rec);
                    gfx.FillPie(Brushes.BurlyWood, bubble_rec, 0, (float)Math.Round(360.0 * (1 - wcut)));
                    gfx.FillPie(Brushes.SteelBlue, bubble_rec, (float)Math.Round(360.0 * (1 - wcut)), 360 - (float)Math.Round(360.0 * (1 - wcut)));
                }


                Point  value_label_point = new Point((int)(point.X + value_label_pos_x), (int)(point.Y + value_label_pos_y));
                string value_label_text  = wlpr.ToString("N1") + " / " + (100 * wcut).ToString("N1");
                SizeF  label_size_text   = gfx.MeasureString(value_label_text, InfoFont);
                value_label_rec = new RectangleF(value_label_point, label_size_text);
                gfx.DrawString(value_label_text, InfoFont, brush, value_label_point);
            }

            // Нагнетательные скважины

            if (well.WLPR < 0) // Меньше нуля, это у нас закачка
            {
                if (style.ShowBubbles && !MoveMode)
                {
                    Point bubble_centr = new Point((int)(point.X - size / 2), (int)(point.Y - size / 2));
                    bubble_rec = new Rectangle(bubble_centr, new Size((int)size, (int)size));
                    gfx.DrawEllipse(new Pen(Color.Black, pen_bubble_width), bubble_rec);
                    gfx.FillPie(Brushes.LightBlue, bubble_rec, 0, 360);
                }

                wlpr = Math.Abs(wlpr);

                Point  value_label_point = new Point((int)(point.X + value_label_pos_x), (int)(point.Y + value_label_pos_y));
                string value_label_text  = wlpr.ToString("N1") + " / " + (100 * wcut).ToString("N1");
                SizeF  label_size_text   = gfx.MeasureString(value_label_text, InfoFont);
                value_label_rec = new RectangleF(value_label_point, label_size_text);
                gfx.DrawString(value_label_text, InfoFont, brush, value_label_point);
            }

            if (!MoveMode)
            {
                Point well_point = new Point((int)(point.X) - 4, (int)(point.Y) - 4);
                point_rec = new Rectangle(well_point, new Size(8, 8));
                gfx.FillEllipse(Brushes.White, point_rec);
                gfx.DrawEllipse(Pens.Black, point_rec);
            }

            SizeF  size_wellname_text = gfx.MeasureString(well.WELLNAME, font);
            PointF well_name_point    = new PointF(point.X + label_pos_x, point.Y + label_pos_y);

            gfx.DrawString(well.WELLNAME, font, brush, well_name_point);


            // Подготовка активного прямоугольника для обновления текстуры

            RectangleF rec = new RectangleF(well_name_point, size_wellname_text);

            if (value_label_rec.Width > 0 && value_label_rec.Height > 0)
            {
                rec = RectangleF.Union(rec, value_label_rec);
            }

            if (style.ShowBubbles && !MoveMode)
            {
                if (bubble_rec.Width > 0 && bubble_rec.Height > 0)
                {
                    rec = RectangleF.Union(rec, bubble_rec);
                }
            }

            if (!MoveMode)
            {
                if (point_rec.Width > 0 && point_rec.Height > 0)
                {
                    rec = RectangleF.Union(rec, point_rec);
                }
            }

            if (rec.X > 2)
            {
                rec.X     += -2;
                rec.Width += 4;
            }

            if (rec.Y > 2)
            {
                rec.Y      += -2;
                rec.Height += 4;
            }

            rec = RectangleF.Intersect(rec, new Rectangle(0, 0, bmp.Width, bmp.Height));

            dirty_region = Rectangle.Round(rec);

            //dirty_region = new Rectangle(0, 0, bmp.Width, bmp.Height);

            //dirty_region = Rectangle.Round(RectangleF.Union(dirty_region, new RectangleF(point, size_text)));
            //dirty_region = Rectangle.Intersect(dirty_region, new Rectangle(0, 0, bmp.Width, bmp.Height));


            //gfx.DrawRectangle(Pens.Black, Rectangle.Round(rec));

            if (dirty_region.Height > 0 && dirty_region.Width > 0)
            {
                UploadBitmap();
            }
        }