/// <summary> /// 蛇形管道(井)+文字显示 /// </summary> /// <param name="pipe"></param> /// <param name="pipeRadius"></param> /// <param name="pipeColor"></param> /// <param name="name"></param> /// <param name="position"></param> /// <param name="camera"></param> public Well(IScientificCamera camera, List <Vertex> pipe, float pipeRadius, GLColor pipeColor, String name, Vertex position, GLColor textColor = null, int fontSize = 32, int maxRowWidth = 256) { this.wellPipeElement = new WellPipe(pipe, pipeRadius, pipeColor, camera); this.textElement = new PointSpriteStringElement(camera, name, position, textColor, fontSize, maxRowWidth); }
/// <summary> /// support recreate the visual elements /// </summary> /// <param name="camera"></param> public void CreateVisualElements(IScientificCamera camera) { ClearVisualElements(); Vertex srcTop = this.wellInitPath[0]; srcTop.Z = this.wellPathMaxDisplayZ; Vertex destTop = this.Transform * srcTop; //create well path dispay max z bool isValid = false; List <Vertex> destPath = new List <Vertex>(); for (int i = 0; i < this.wellInitPath.Count - 1; i++) { Vertex p = this.Transform * this.wellInitPath[i]; Vertex p2 = this.Transform * this.wellInitPath[i + 1]; if (!isValid) { if (p.Z >= destTop.Z && p2.Z <= destTop.Z) { isValid = true; p.Z = destTop.Z; } else if (p.Z <= destTop.Z) { isValid = true; p.Z = destTop.Z; } } if (isValid) { destPath.Add(p); if ((i + 1) == (this.wellInitPath.Count - 1)) { destPath.Add(p2); } } } if (destPath.Count < 2) { return; } float wellRadius = this.wellInitRadius * this.radiusScale; Vertex wellNameAnnotationLocation = new Vertex(destPath[0].X, destPath[0].Y, destPath[0].Z + this.wellNameAnnotationSpace); this.wellPipeElement = new WellPipe(destPath, wellRadius, this.wellPathColor, camera); this.textElement = new PointSpriteStringElement(camera, this.wellName, wellNameAnnotationLocation, this.textColor, this.fontSize, this.maxRowWidth); this.wellPipeElement.ZAxisScale = this.ZAxisScale; this.textElement.ZAxisScale = this.ZAxisScale; this.AddChild(this.wellPipeElement); this.AddChild(this.textElement); }
private void ClearVisualElements() { if (this.wellPipeElement != null) { //dispose后移除,还是移除后Dispose if (this.wellPipeElement is IDisposable) { this.wellPipeElement.Dispose(); } this.RemoveChild(this.wellPipeElement); this.wellPipeElement = null; } if (this.textElement != null) { if (textElement is IDisposable) { this.textElement.Dispose(); } this.RemoveChild(this.textElement); this.textElement = null; } }