示例#1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ObsDoubles dbs = value as ObsDoubles;

            if (dbs == null || dbs.Count <= 1)
            {
                return(null);
            }

            double mindepth = dbs[0];                                        //顶深
            double maxdepth = dbs[dbs.Count - 1];                            //底深
            double depth    = Math.Ceiling((maxdepth - mindepth) / 10) * 10; //取底深减顶深差值,向上取整
            double top      = Math.Ceiling(dbs[0] / 10) * 10;                //顶深向上取整

            FirstScale = top - mindepth == 0 ? 10 : top - mindepth;          //第一个刻度点

            StringBuilder scaleSb = new StringBuilder();

            for (double i = FirstScale; i <= depth; i = i + MainScaleInterval)
            {
                scaleSb.Append((i + mindepth));
                scaleSb.Append("\n");
            }
            return(scaleSb);
        }
示例#2
0
文件: Well.cs 项目: songgod/gEngine
 public Well()
 {
     Columns          = new WellColumns();
     Depths           = new ObsDoubles();
     WellLayers       = new WellLayers();
     WellLayerDatas   = new WellLayerDatas();
     WellLayerDatasUI = new WellLayerDatas();
 }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            Well       owner     = values[0] as Well;
            ObsDoubles topDepths = values[1] as ObsDoubles;
            ObsDoubles thickness = values[2] as ObsDoubles;

            if (topDepths == null || thickness == null || owner == null)
            {
                return(null);
            }

            if (topDepths.Count != thickness.Count)
            {
                return(null);
            }

            double       mindepth = owner.Depths[0];
            PathGeometry geom     = new PathGeometry();

            for (int i = 0; i < topDepths.Count; i++)
            {
                double bottomDepth = topDepths[i] + thickness[i];
                double yTop        = (topDepths[i] - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion; //根据纵向比例,计算出Y值
                double yBottom     = (bottomDepth - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion;  //根据纵向比例,计算出Y值

                PathFigure fg_1 = new PathFigure();
                fg_1.StartPoint = new Point()
                {
                    X = 0, Y = yTop
                };
                LineSegment ls_1 = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 60, Y = yTop
                    }
                };
                fg_1.Segments.Add(ls_1);
                geom.Figures.Add(fg_1);

                PathFigure fg_2 = new PathFigure();
                fg_2.StartPoint = new Point()
                {
                    X = 0, Y = yBottom
                };
                LineSegment ls_2 = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 60, Y = yBottom
                    }
                };
                fg_2.Segments.Add(ls_2);
                geom.Figures.Add(fg_2);
            }
            return(geom);
        }
示例#4
0
        /// <summary>
        /// 加纵向比例
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            ObsDoubles dbs = values[0] as ObsDoubles;

            if (dbs == null || dbs.Count <= 1)
            {
                return(null);
            }

            double mindepth               = dbs[0];                                        //顶深
            double maxdepth               = dbs[dbs.Count - 1];                            //底深
            double depth                  = Math.Ceiling((maxdepth - mindepth) / 10) * 10; //取底深减顶深差值,向上取整
            double top                    = Math.Ceiling(dbs[0] / 10) * 10;                //顶深向上取整
            double firstScale             = top - mindepth == 0 ? 10 : top - mindepth;     //第一个刻度点
            int    LongitudinalProportion = int.Parse(values[1].ToString());               //纵向比例

            PathGeometry geom = new PathGeometry();

            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 1, Y = 0
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 1, Y = depth * Enums.PerMilePx / LongitudinalProportion
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }

            for (double i = firstScale; i <= depth; i = i + DepthToScaleConverter.MainScaleInterval)
            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 1, Y = i * Enums.PerMilePx / LongitudinalProportion
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 15, Y = i * Enums.PerMilePx / LongitudinalProportion
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }

            return(geom);
        }
示例#5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ObsDoubles dbs = value as ObsDoubles;

            if (dbs == null || dbs.Count <= 1)
            {
                return(null);
            }


            double mindepth   = dbs[0];                                        //顶深
            double maxdepth   = dbs[dbs.Count - 1];                            //底深
            double depth      = Math.Ceiling((maxdepth - mindepth) / 10) * 10; //取底深减顶深差值,向上取整
            double top        = Math.Ceiling(dbs[0] / 10) * 10;                //顶深向上取整
            double firstScale = top - mindepth == 0 ? 10 : top - mindepth;     //第一个刻度点

            PathGeometry geom = new PathGeometry();

            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 1, Y = 0
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 1, Y = depth
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }


            for (double i = firstScale; i <= depth; i = i + 20)
            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 1, Y = i
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = 15, Y = i
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }
            return(geom);
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            Well          owner         = values[0] as Well;
            ObsDoubles    topDepths     = values[1] as ObsDoubles;
            ObsDoubles    thickness     = values[2] as ObsDoubles;
            List <string> BoundaryNames = values[3] as List <string>;

            if (topDepths == null || thickness == null || owner == null)
            {
                return(null);
            }

            if (topDepths.Count != thickness.Count)
            {
                return(null);
            }

            double       mindepth = owner.Depths[0];
            PathGeometry geom     = new PathGeometry();

            System.Drawing.Font font = new System.Drawing.Font("微软雅黑", 12, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
            int i = 0;

            foreach (string boundaryName in BoundaryNames)
            {
                double bottomDepth = topDepths[i] + thickness[i];
                double yTop        = (topDepths[i] - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion; //根据纵向比例,计算出Y值
                double yBottom     = (bottomDepth - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion;  //根据纵向比例,计算出Y值
                //double middle = yTop + (yBottom - yTop) / 2.5;
                double       middle = yTop + ((yBottom - yTop - font.Height) / 2 < 0 ? 0 : (yBottom - yTop - font.Height) / 2);
                PathGeometry path   = GetTextPath(boundaryName, "微软雅黑", 12, middle);
                geom.AddGeometry(path);
                i++;
            }
            return(geom);
        }
示例#7
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            WellColumns    cols       = values[0] as WellColumns; //曲线数据
            ObsDoubles     depths     = values[1] as ObsDoubles;  //深度
            WellLayerDatas layerDatas = values[3] as WellLayerDatas;

            if (depths == null || depths.Count <= 1)
            {
                return(null);
            }

            double mindepth               = depths[0];                                     //顶深
            double maxdepth               = depths[depths.Count - 1];                      //底深
            double depth                  = Math.Ceiling((maxdepth - mindepth) / 10) * 10; //取底深减顶深差值,向上取整
            double top                    = Math.Ceiling(depths[0] / 10) * 10;             //顶深向上取整
            double firstScale             = top - mindepth == 0 ? 10 : top - mindepth;     //第一个刻度点
            int    LongitudinalProportion = int.Parse(values[2].ToString());               //纵向比例

            int colsCount = cols.Count + 1 + 1 + layerDatas.Count;                         //曲线条数(包括深度曲线、层号曲线和分层数据曲线)
            int colsWidth = 60;                                                            //曲线宽度,目前深度曲线宽度、层号曲线和分层数据曲线宽度也为60

            PathGeometry geom = new PathGeometry();

            {
                // 画曲线底边框线
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 0, Y = 60 + depth * Enums.PerMilePx / LongitudinalProportion
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = colsCount * colsWidth, Y = 60 + depth * Enums.PerMilePx / LongitudinalProportion
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }

            // 画各曲线道边框竖线,由于曲线名称占60高度,需增加
            for (double i = 0; i <= colsCount * colsWidth; i = i + colsWidth)
            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = i, Y = 0
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = i, Y = 60 + depth * Enums.PerMilePx / LongitudinalProportion
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }

            // 画曲线名称上下边框线,曲线名称定义的高度是50
            for (double y = 0; y <= 50; y = y + 50)
            {
                PathFigure fg = new PathFigure();
                fg.StartPoint = new Point()
                {
                    X = 0, Y = y
                };
                LineSegment ls = new LineSegment()
                {
                    Point = new Point()
                    {
                        X = colsCount * colsWidth, Y = y
                    }
                };
                fg.Segments.Add(ls);
                geom.Figures.Add(fg);
            }
            return(geom);
        }
示例#8
0
        /// <summary>
        /// 加纵向比例
        /// </summary>
        /// <param name="values"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            ObsDoubles vls   = values[0] as ObsDoubles;
            Well       owner = values[1] as Well;

            if (vls == null || owner == null)
            {
                return(null);
            }

            if (owner.Depths.Count != vls.Count)
            {
                return(null);
            }

            if (vls.Count <= 1)
            {
                return(null);
            }

            double mindepth = owner.Depths[0];

            double[] validValueList = vls.Select(s => s).Where(s => (s != InvalidValue)).ToArray();//从曲线数组中去除无效值,形成有效值数组
            double   xMin           = validValueList.Min();
            double   xMax           = validValueList.Max();

            // 曲线在使用对数时,抽稀算法无法抽稀出数据,暂时都用线性的 2017-4-7
            MathType mathType = (MathType)values[2];

            if (mathType == MathType.DEFAULT)
            {
                if (xMax - xMin > 60)
                {
                    mathType = MathType.LINER;
                }
                else
                {
                    mathType = MathType.LINER;
                }
            }

            PathGeometry geom   = new PathGeometry();
            double       StartY = (owner.Depths[vls.ToList().IndexOf(validValueList[0])] - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion;                             // 计算StartPoint的Y值,Y值为第一个有效值的深度,X值为最小值,保证闭合时连线为直线
            double       EndY   = (owner.Depths[vls.ToList().LastIndexOf(validValueList[validValueList.Length - 1])] - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion; // 增加一个结束点,Y值为最后一个有效值的深度,X值为最小值,保证闭合时连线为直线

            gTopology.PointList pointlist = new gTopology.PointList();
            pointlist.Add(new Point()
            {
                X = 0, Y = StartY
            });

            for (int i = 0; i < vls.Count; ++i)
            {
                if (vls[i] == InvalidValue)
                {
                    continue;
                }
                else
                {
                    double x = (vls[i] - xMin) * 60 / (xMax - xMin); // 横向比例默认为 (曲线最小值-曲线最大值),60代表道宽
                    if (mathType.Equals(Enums.MathType.ARITHM))
                    {
                        x = Math.Log10(vls[i]) - Math.Log10(xMin);
                    }
                    double yValue = (owner.Depths[i] - mindepth) * Enums.PerMilePx / owner.LongitudinalProportion;//根据纵向比例,计算出Y值
                    pointlist.Add(new Point()
                    {
                        X = x, Y = yValue
                    });
                }
            }

            pointlist.Add(new Point()
            {
                X = 0, Y = EndY
            });

            gTopology.PointList plist = gTopology.SimpleLine.Simplifier(pointlist, 1);

            PathFigure figure = new PathFigure()
            {
                StartPoint = plist[0], IsClosed = true
            };
            PointCollection pc  = new PointCollection(plist.GetRange(1, plist.Count - 1));
            PolyLineSegment pls = new PolyLineSegment()
            {
                Points = pc
            };

            figure.Segments.Add(pls);
            geom.Figures.Add(figure);
            return(geom);
        }
示例#9
0
 public WellLayer()
 {
     BoundaryNames = new List <string>();
     TopDepths     = new ObsDoubles();
     Thickness     = new ObsDoubles();
 }
示例#10
0
 public WellColumn()
 {
     Values = new ObsDoubles();
 }