一
、井深结构示意图绘制所有遵循的石油行业规定
- 钻头绘制:绘制一条具有波浪形状的线条
- 套管绘制:绘制一条实心线条,加上尾部一张旗帜
- 标注绘制:包括每一开次的钻头大小、长度和套管大小
二、井身结构示意图绘制步骤
- 绘制中心虚线(井眼轨迹线)
- 遍历每一开次的信息
- 绘制套管(套管用实心线表示,套管结尾用黑色小三角形符号表示)
- 绘制钻头(钻头用波浪线表示)
- 添加标注
三、井身结构示意图效果如下
四、井身结构示意图的具体绘制方法(WPF)
- 本井身结构示意图的绘制均使用Polyline ,Polyline 的使用详见《深入浅出wpf》中的绘图部分
- Polyline 的数据来源为PointCollection
- 本井身结构示意图的绘制的关键之处在于计算处于不同井深的点Point
//通过点的坐标的集合来绘制直线
public static Polyline GetPolylineByPoints(PointCollection points)
{
Polyline polyline = new Polyline();
polyline.Points = points; //设置直线的数据
polyline.Stroke = Brushes.Black; //设置直线的颜色
return polyline;
}
- 从上面的井深结构示意图可以看出,其绘制主要包括虚线的绘制、实线(曲线也是直线,只不过绘制时需要很多的点)的绘制、黑色小三角形的绘制,其绘制如下
1.虚线的绘制public static Polyline GetDashPolylineByPoints(PointCollection points){Polyline polyline = new Polyline();
polyline.Points = points; //points为绘制直线所需的数据(点的集合)polyline.Stroke = Brushes.Red; //直线的颜色polyline.StrokeDashArray = new DoubleCollection(new List<double>() { 1, 1 }); //虚线和实线的比例
return polyline;}
2.实线的绘制public static Polyline GetPolylineByPoints(PointCollection points){
Polyline polyline = new Polyline();
polyline.Points = points; //points为绘制直线所需的数据(点的集合)polyline.Stroke = Brushes.Black; //直线的颜色
return polyline;}
3.黑色三角形的绘制public static Polyline GetPolylineByPoints(PointCollection points){
Polyline polyline = new Polyline();
polyline.Points = points; //points为绘制直线所需的数据( 3个点的集合)polyline.Stroke = Brushes.Black; //直线的颜色polyline.Fill = Brushes.Black; //填充颜色
return polyline;}
五、井身结构示意图的绘制 (WPF)
无论是水平井,直井,还是定向井的绘制,其关键之处在于计算各个点的坐标,然后将其添加到一个点的集合中
points,然后再绘制直线、虚线、或三角形。
六、直井---井身结构示意图的绘制 (WPF)
直井的井身结构示意图绘制较为简单,此处只介绍示意图中曲线的绘制
private PointCollection GetZigzagPointsByPosition(Point startPoint,Point endPoint)
{
int timeTick = (int)(DateTime.Now.ToOADate() * 100000000);Random random = new Random(timeTick);
PointCollection points =new PointCollection();points.Add(startPoint);
PointcurrentPoint =startPoint;while( currentPoint .Y<endPoint.Y){Point pt = new Point((random.NextDouble() - 0.5) * 3 + currentPoint .X, random.NextDouble() * 5 + currentPoint.Y);points.Add(pt);currentPoint = pt;}
points.Add(endPoint);
returnpoints;
}
获取绘制曲线所需数据points之后,调用上面绘制实线的方法即可得到一条曲线
七、水平井---井身结构示意图的绘制 (WPF)
八、定向井---井身结构示意图的绘制 (WPF)
九、添加标记
/// <summary>
/// 添加标注
/// </summary>
/// <param name="lineStartPosition">被标注点的坐标</param>
/// <param name="lineEndPosition">标注坐标</param>
/// <param name="casingStr">套管信息</param>
/// <param name="drillStr">标注信息</param>
private void AddNotation(Point lineStartPosition, Point lineEndPosition, string casingStr, string drillStr, Canvas casingCanvas)
{
///产生线条
Line currentLine = new Line(); //标注和被标注点之间的连线
currentLine.X1 = lineStartPosition.X;
currentLine.Y1 = lineStartPosition.Y;
currentLine.X2 = lineEndPosition.X;
currentLine.Y2 = lineEndPosition.Y;
currentLine.Stroke = Brushes.DarkBlue;
currentLine.StrokeThickness = 0.5;
casingCanvas.Children.Add(currentLine);
Grid currentGrid = new Grid(); //标注
currentGrid.RowDefinitions.Add(new RowDefinition());
currentGrid.RowDefinitions.Add(new RowDefinition());
currentGrid.Background = Brushes.White;
Border border = new Border();
border.BorderBrush = Brushes.DarkBlue;
border.BorderThickness = new Thickness(0, 0, 0, 1);
currentGrid.Children.Add(border);
border.SetValue(Grid.RowProperty, 0);
Label drillLabel = new Label(); //创建标签,显示标注
drillLabel.Padding = new Thickness(0);
drillLabel.Content = casingStr;
drillLabel.Foreground = Brushes.DarkBlue;
drillLabel.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
border.Child = drillLabel;
/// 添加标注
/// </summary>
/// <param name="lineStartPosition">被标注点的坐标</param>
/// <param name="lineEndPosition">标注坐标</param>
/// <param name="casingStr">套管信息</param>
/// <param name="drillStr">标注信息</param>
private void AddNotation(Point lineStartPosition, Point lineEndPosition, string casingStr, string drillStr, Canvas casingCanvas)
{
///产生线条
Line currentLine = new Line(); //标注和被标注点之间的连线
currentLine.X1 = lineStartPosition.X;
currentLine.Y1 = lineStartPosition.Y;
currentLine.X2 = lineEndPosition.X;
currentLine.Y2 = lineEndPosition.Y;
currentLine.Stroke = Brushes.DarkBlue;
currentLine.StrokeThickness = 0.5;
casingCanvas.Children.Add(currentLine);
Grid currentGrid = new Grid(); //标注
currentGrid.RowDefinitions.Add(new RowDefinition());
currentGrid.RowDefinitions.Add(new RowDefinition());
currentGrid.Background = Brushes.White;
Border border = new Border();
border.BorderBrush = Brushes.DarkBlue;
border.BorderThickness = new Thickness(0, 0, 0, 1);
currentGrid.Children.Add(border);
border.SetValue(Grid.RowProperty, 0);
Label drillLabel = new Label(); //创建标签,显示标注
drillLabel.Padding = new Thickness(0);
drillLabel.Content = casingStr;
drillLabel.Foreground = Brushes.DarkBlue;
drillLabel.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
border.Child = drillLabel;
Label casingLabel = new Label();
casingLabel.Padding = new Thickness(0);
casingLabel.Content = drillStr;
casingLabel.Foreground = Brushes.DarkBlue;
casingLabel.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
currentGrid.Children.Add(casingLabel);
casingLabel.SetValue(Grid.RowProperty, 1);
casingCanvas.Children.Add(currentGrid);
currentGrid.SetValue(Canvas.LeftProperty, lineEndPosition.X);
currentGrid.SetValue(Canvas.TopProperty, lineEndPosition.Y - 16);
}