protected Well Convert(WellTrajectory well) { List <Vertex> wellPath = new List <Vertex>(); String wellName = well.WellName; float wellRadius = GetRadius(this.gridder); GLColor wellPathColor = new GLColor(0.0f, 1.0f, 0.0f, 1.0f);//green GLColor textColor = new GLColor(1.0F, 1.0F, 1.0F, 1.0F); foreach (WellTrajectoryItem item in well.Path) { Vertex v = new Vertex(item.XCoord, item.YCoord, item.TVDSS); wellPath.Add(v); } Well well3D = new Well(camera, wellPath, wellRadius, wellPathColor, wellName, textColor, 18); well3D.ZAxisScale = 1.0f; well3D.Transform = this.gridder.ScaleTranslateform; well3D.CreateVisualElements(this.camera); return(well3D); }
protected override Well Convert(WellSpecs wellspec, WellCompatCollection wellCompSegments = null) { if (wellspec == null) { return(null); } String wellName = wellspec.WellName; int i = -1; int j = -1; int k = -1; List <WellCompat> wellSegments = null; if (wellCompSegments != null) { wellSegments = wellCompSegments.GetWellSegments(wellName); } if (wellSegments != null && wellSegments.Count > 0) { i = wellSegments[0].PosI; j = wellSegments[0].PosJ; k = wellSegments[0].K1; } else { i = wellspec.Li; j = wellspec.Lj; k = 1; //点集K始终为1. } Vertex minCord = this.gridderSource.FlipTransform * this.gridderSource.SourceActiveBounds.Min; Vertex maxCord = this.gridderSource.FlipTransform * this.gridderSource.SourceActiveBounds.Max; Rectangle3D srcRect = new Rectangle3D(minCord, maxCord); float dx = srcRect.SizeX; float dy = srcRect.SizeY; float dz = srcRect.SizeZ; //井在完井段的第一个点 Vertex pb = this.gridderSource.FlipTransform * this.gridderSource.GetPosition(i, j, k); //well head or heal coordinates Vertex boundMin = srcRect.Min; Vertex boundMax = srcRect.Max; float surfaceZ = srcRect.Max.Z; float bottomZ = srcRect.Min.Z; //井同模型边界的垂直相交点 Vertex modelTop = new Vertex(pb.X, pb.Y, surfaceZ); //模型顶部坐标,垂直于井底坐标 Vertex modelBottom = new Vertex(pb.X, pb.Y, bottomZ); //底到顶的方向 Vertex directVect = modelTop - modelBottom; //井的高度 z的正方向 Vertex direct = directVect; direct.Normalize(); float xyextend = System.Math.Max(dx, dy); //XY平面的最大边长 float extHeight; //延长线段 if (dz < 0.1f * xyextend) //z很小 { extHeight = 0.1f * xyextend; } else if (dz < 0.2f * xyextend) { extHeight = dz * 0.5f; } else if (dz < 0.3f * xyextend) { extHeight = dz * 0.25f; } else if (dz < 0.4f * xyextend) { extHeight = dz * 0.2f; } else { extHeight = 0.2f * dz; } float maxValue = Math.Max(Math.Max(dx, dy), dz); float extraL = extHeight; direct.Normalize(); Vertex head = modelTop + (direct * extraL); float wellRadius; #region decide the well radius if (dx != dy) { float min = Math.Min(dx, dy); float max = Math.Max(dx, dy); if (min > max * 0.75f) { int n = 30; wellRadius = (min / n) * 0.5f; } else if (min >= max * 0.5f) //长方形的模型 { int n = 20; wellRadius = (min / n) * 0.5f; } else if (min >= (max * 0.25)) { int n = 15; wellRadius = (min / n) * 0.5f; } else if (min >= max * 0.16) { int n = 15; wellRadius = (min / n) * 0.5f; } else { int n = 10; wellRadius = (min / n) * 0.5f; } } else { int n = 40; wellRadius = (dx / n) * 0.5f; } #endregion float diameter = Math.Min(dx, dy) * 0.01f;//井的直径 List <Vertex> wellPath = new List <Vertex>(); wellPath.Add(head); wellPath.Add(modelTop); //计算完井段的数据 if (wellSegments != null && wellSegments.Count > 0) { foreach (WellCompat seg in wellSegments) { int posI = seg.PosI; int posJ = seg.PosJ; int posK1 = seg.K1; int posK2 = seg.K2; if (posK1 == posK2) { Vertex pnt = this.gridderSource.FlipTransform * this.gridderSource.GetPosition(posI, posJ, posK1); wellPath.Add(pnt); } else { Vertex pnt = this.gridderSource.FlipTransform * this.gridderSource.GetPosition(posI, posJ, posK1); Vertex pn2 = this.gridderSource.FlipTransform * this.gridderSource.GetPosition(posI, posJ, posK2); wellPath.Add(pnt); } } } Fluid fluid = FluidConverter.Convert(wellspec.Fluid); GLColor pipeColor = this.MapFluidToColor(fluid); Well well3d = new Well(this.camera, wellPath, wellRadius, pipeColor, wellName, null, 16); well3d.ZAxisScale = 1; well3d.Transform = this.gridderSource.ScaleTranslateform; well3d.CreateVisualElements(this.camera); return(well3d); }
protected override Well Convert(WellSpecs wellspec, WellCompatCollection wellCompSegments = null) { int locI = wellspec.Li; int locJ = wellspec.Lj; //if compat has position ,use compat List <WellCompat> segments = null; if (wellCompSegments != null) { segments = wellCompSegments.GetWellSegments(wellspec.WellName); } if (segments != null && segments.Count > 0) { locI = segments[0].PosI; locJ = segments[0].PosJ; } Vertex minCord = this.gridder.FlipTransform * this.gridder.SourceActiveBounds.Min; Vertex maxCord = this.gridder.FlipTransform * this.gridder.SourceActiveBounds.Max; Rectangle3D rectSrc = new Rectangle3D(minCord, maxCord); if (!this.gridder.IsSliceBlock(locI, locJ)) { return(null); } Vertex h1 = this.gridder.FlipTransform * this.gridder.PointFLT(locI, locJ, 1); Vertex h2 = this.gridder.FlipTransform * this.gridder.PointBRT(locI, locJ, 1); Vertex d0 = h2 - h1; float L = (float)d0.Magnitude(); d0.Normalize(); Vertex vec = d0 * (L * 0.5f); Vertex comp1 = CenterOfLine(h1, h2);; //地层完井段的起始点 Vertex modelTop = new Vertex(comp1.X, comp1.Y, rectSrc.Max.Z); float mdx = rectSrc.SizeX; float mdy = rectSrc.SizeY; float mdz = rectSrc.SizeZ; float xyextend = System.Math.Max(mdx, mdy); //XY平面的最大边长 float extHeight; //延长线段 if (mdz < 0.1f * xyextend) //z很小 { extHeight = 0.1f * xyextend; } else if (mdz < 0.2f * xyextend) { extHeight = mdz * 0.5f; } else if (mdz < 0.3f * xyextend) { extHeight = mdz * 0.25f; } else if (mdz < 0.4f * xyextend) { extHeight = mdz * 0.2f; } else { extHeight = 0.2f * mdz; } //地表坐标 Vertex direction = new Vertex(0, 0, 1.0f); Vertex head = modelTop + direction * extHeight; //确定井的半径 float wellRadius; #region decide the well radius if (mdx < mdy) { if (mdy * 0.5f >= mdx) //长方形的模型 { int n = gridder.NX; if (n >= 10) { wellRadius = (mdx / n) * 0.5f; } else { wellRadius = (mdx / n) * 0.35f; } } else { int n = gridder.NX; if (n >= 10) { n = 10; wellRadius = (mdx / n) * 0.5f; } else { wellRadius = (mdx / n) * 0.35f; } } } else if (mdx == mdy) { int n = Math.Min(gridder.NX, gridder.NY); if (n >= 10) { n = 10; wellRadius = (mdx / n) * 0.85f; } else { wellRadius = (mdx / n) * 0.5f; } } else { if (mdx * 0.5f >= mdy) { int n = gridder.NY; if (n > 10) { n = 10; wellRadius = (mdy / n) * 0.5f; } else { wellRadius = (mdy / n) * 0.35f; } } else { int n = gridder.NY; if (n > 10) { n = 10; wellRadius = (mdx / n) * 0.5f; } else { wellRadius = (mdx / n) * 0.35f; } } } #endregion Fluid fluid = FluidConverter.Convert(wellspec.Fluid); GLColor pipeColor = MapFluidToColor(fluid); GLColor textColor = new GLColor(1.0f, 1.0f, 1.0f, 1.0f); string wellName = wellspec.WellName; List <Vertex> wellPath = new List <Vertex>(); wellPath.Add(head); wellPath.Add(modelTop); #region start decide the trajery of the well { int lastI = locI; int lastJ = locJ; int lastK = -1; Vertex lastVertex = comp1; int segCount = segments.Count; for (int i = 0; i < segCount; i++) { WellCompat compseg = segments[i]; int compI = compseg.PosI; int compJ = compseg.PosJ; int compK1 = compseg.K1; int compK2 = compseg.K2; if (compK1 == compK2)//同一网格上 { if ((lastI != compI) || (lastJ != compJ) || (lastK != compK1)) { Vertex s1 = gridder.FlipTransform * gridder.PointFLT(compI, compJ, compK1); Vertex s2 = gridder.FlipTransform * gridder.PointBRT(compI, compJ, compK1); Vertex point = CenterOfLine(s1, s2); wellPath.Add(point); lastI = compI; lastJ = compJ; lastK = compK1; } } else //compK1 != compK2 { //k1 coord if ((lastI != compI) || (lastJ != compJ) || (lastK != compK1)) { Vertex s1 = gridder.FlipTransform * gridder.PointFLT(compI, compJ, compK1); Vertex s2 = gridder.FlipTransform * gridder.PointBRT(compI, compJ, compK1); Vertex point = CenterOfLine(s1, s2); wellPath.Add(point); } lastI = compI; lastJ = compJ; lastK = compK1; if ((lastI != compI) || (lastJ != compJ) || (lastK != compK2)) { Vertex s1 = gridder.FlipTransform * gridder.PointFLT(compI, compJ, compK2); Vertex s2 = gridder.FlipTransform * gridder.PointBRT(compI, compJ, compK2); Vertex point = CenterOfLine(s1, s2); wellPath.Add(point); } lastI = compI; lastJ = compJ; lastK = compK2; } }//end for Well well3d = new Well(this.camera, wellPath, wellRadius, pipeColor, wellName, textColor, 12, wellName.Length * 10); well3d.ZAxisScale = 1; well3d.Transform = this.gridder.ScaleTranslateform; well3d.CreateVisualElements(this.camera); return(well3d); } #endregion }