private void UpdateVertices() { m_verticalExaggeration = World.Settings.VerticalExaggeration; if(m_altitudeMode == AltitudeMode.ClampedToGround) { if(m_polygon != null) { m_polygon.Remove = true; m_polygon = null; } m_polygon = new Polygon(); m_polygon.outerBoundary = m_outerRing; m_polygon.innerBoundaries = m_innerRings; m_polygon.PolgonColor = m_polygonColor; m_polygon.Fill = m_fill; m_polygon.ParentRenderable = this; this.World.ProjectedVectorRenderer.Add(m_polygon); if(m_vertices != null) m_vertices = null; if(m_lineFeature != null) { m_lineFeature[0].Dispose(); m_lineFeature = null; } return; } getTessellation(); if(m_extrude || m_outline) { m_lineFeature = new LineFeature[1 + (m_innerRings != null && m_innerRings.Length > 0 ? m_innerRings.Length : 0)]; Point3d[] linePoints = new Point3d[m_outerRing.Points.Length + 1]; for(int i = 0; i < m_outerRing.Points.Length; i++) { linePoints[i] = m_outerRing.Points[i]; } linePoints[linePoints.Length - 1] = m_outerRing.Points[0]; m_lineFeature[0] = new LineFeature(Name, World, linePoints, m_polygonColor); m_lineFeature[0].DistanceAboveSurface = m_distanceAboveSurface; m_lineFeature[0].MinimumDisplayAltitude = m_minimumDisplayAltitude; m_lineFeature[0].MaximumDisplayAltitude = m_maximumDisplayAltitude; m_lineFeature[0].AltitudeMode = AltitudeMode; m_lineFeature[0].Opacity = Opacity; m_lineFeature[0].Outline = m_outline; m_lineFeature[0].LineColor = m_outlineColor; m_lineFeature[0].Extrude = m_extrude; if(m_innerRings != null && m_innerRings.Length > 0) { for(int i = 0; i < m_innerRings.Length; i++) { Point3d[] innerPoints = new Point3d[m_innerRings[i].Points.Length + 1]; for(int j = 0; j < m_innerRings[i].Points.Length; j++) { innerPoints[j] = m_innerRings[i].Points[j]; } innerPoints[innerPoints.Length - 1] = m_innerRings[i].Points[0]; m_lineFeature[1 + i] = new LineFeature(Name, World, innerPoints, m_polygonColor); m_lineFeature[1 + i].DistanceAboveSurface = m_distanceAboveSurface; m_lineFeature[1 + i].MinimumDisplayAltitude = m_minimumDisplayAltitude; m_lineFeature[1 + i].MaximumDisplayAltitude = m_maximumDisplayAltitude; m_lineFeature[1 + i].AltitudeMode = AltitudeMode; m_lineFeature[1 + i].Opacity = Opacity; m_lineFeature[1 + i].Outline = m_outline; m_lineFeature[1 + i].LineColor = m_outlineColor; m_lineFeature[1 + i].Extrude = m_extrude; } } } else { if(m_lineFeature != null && m_lineFeature.Length > 0) { for(int i = 0; i < m_lineFeature.Length; i++) { if(m_lineFeature[i] != null) { m_lineFeature[i].Dispose(); m_lineFeature[i] = null; } } m_lineFeature = null; } } }
private void UpdateVertices() { m_verticalExaggeration = World.Settings.VerticalExaggeration; if (m_altitudeMode == AltitudeMode.ClampedToGround) { if (m_polygon != null) { m_polygon.Remove = true; m_polygon = null; } m_polygon = new Polygon(); m_polygon.outerBoundary = m_outerRing; m_polygon.innerBoundaries = m_innerRings; m_polygon.PolgonColor = m_polygonColor; m_polygon.Fill = m_fill; m_polygon.ParentRenderable = this; this.World.ProjectedVectorRenderer.Add(m_polygon); if (m_vertices != null) { m_vertices = null; } if (m_lineFeature != null) { m_lineFeature[0].Dispose(); m_lineFeature = null; } return; } getTessellation(); if (m_extrude || m_outline) { m_lineFeature = new LineFeature[1 + (m_innerRings != null && m_innerRings.Length > 0 ? m_innerRings.Length : 0)]; Point3d[] linePoints = new Point3d[m_outerRing.Points.Length + 1]; for (int i = 0; i < m_outerRing.Points.Length; i++) { linePoints[i] = m_outerRing.Points[i]; } linePoints[linePoints.Length - 1] = m_outerRing.Points[0]; m_lineFeature[0] = new LineFeature(Name, World, linePoints, m_polygonColor); m_lineFeature[0].DistanceAboveSurface = m_distanceAboveSurface; m_lineFeature[0].MinimumDisplayAltitude = m_minimumDisplayAltitude; m_lineFeature[0].MaximumDisplayAltitude = m_maximumDisplayAltitude; m_lineFeature[0].AltitudeMode = AltitudeMode; m_lineFeature[0].Opacity = Opacity; m_lineFeature[0].Outline = m_outline; m_lineFeature[0].LineColor = m_outlineColor; m_lineFeature[0].Extrude = m_extrude; if (m_innerRings != null && m_innerRings.Length > 0) { for (int i = 0; i < m_innerRings.Length; i++) { Point3d[] innerPoints = new Point3d[m_innerRings[i].Points.Length + 1]; for (int j = 0; j < m_innerRings[i].Points.Length; j++) { innerPoints[j] = m_innerRings[i].Points[j]; } innerPoints[innerPoints.Length - 1] = m_innerRings[i].Points[0]; m_lineFeature[1 + i] = new LineFeature(Name, World, innerPoints, m_polygonColor); m_lineFeature[1 + i].DistanceAboveSurface = m_distanceAboveSurface; m_lineFeature[1 + i].MinimumDisplayAltitude = m_minimumDisplayAltitude; m_lineFeature[1 + i].MaximumDisplayAltitude = m_maximumDisplayAltitude; m_lineFeature[1 + i].AltitudeMode = AltitudeMode; m_lineFeature[1 + i].Opacity = Opacity; m_lineFeature[1 + i].Outline = m_outline; m_lineFeature[1 + i].LineColor = m_outlineColor; m_lineFeature[1 + i].Extrude = m_extrude; } } } else { if (m_lineFeature != null && m_lineFeature.Length > 0) { for (int i = 0; i < m_lineFeature.Length; i++) { if (m_lineFeature[i] != null) { m_lineFeature[i].Dispose(); m_lineFeature[i] = null; } } m_lineFeature = null; } } }
/// <summary> /// Helper class that updates history trail and model position /// </summary> protected virtual void updateSubObjects() { if (this.IsSurfaceTrack) { this.Altitude = 0; this.IsAGL = true; // force this just in case so we aren't under terrain } // Save current values PosData pos = new PosData(); pos.lat = this.Latitude; pos.lon = this.Longitude; pos.alt = this.Altitude; pos.spd = this.Speed; pos.hdg = this.Rotation.Degrees; pos.sourceTime = this.m_sourceTime; pos.updateTime = this.m_updateTime; try { this.m_history.AddFirst(pos); if (this.m_history.Count > this.MaxPoints) { this.m_history.RemoveLast(); } // Add to line feature if (this.RenderTrail && this.m_lineFeature == null) { this.m_lineFeature = new LineFeature(this.name + "_trail", DrawArgs.CurrentWorldStatic, null, null); this.m_lineFeature.LineColor = System.Drawing.Color.White; this.m_lineFeature.MaxPoints = this.MaxPoints; if (this.IsAGL) { this.m_lineFeature.AltitudeMode = AltitudeMode.RelativeToGround; } else { this.m_lineFeature.AltitudeMode = AltitudeMode.Absolute; } this.m_lineFeature.Opacity = 128; this.m_lineFeature.LineWidth = 3; if (this.IsSurfaceTrack) { this.m_lineFeature.Extrude = false; this.m_lineFeature.ExtrudeHeight = 0; this.m_lineFeature.LineWidth = 1; } else { this.m_lineFeature.Extrude = true; this.m_lineFeature.ExtrudeHeight = 1; this.m_lineFeature.LineWidth = 1; this.m_lineFeature.ExtrudeToGround = false; } } if (this.RenderTrail) { this.m_lineFeature.AddPoint(this.Longitude, this.Latitude, this.Altitude); } if (this.RenderModel && this.m_modelFeature != null) { this.m_modelFeature.Longitude = (float)this.Longitude; this.m_modelFeature.Latitude = (float)this.Latitude; this.m_modelFeature.Altitude = (float)this.Altitude; float rot = (float)(180 - this.Rotation.Degrees); if (rot < 0) { rot += 360; } this.m_modelFeature.RotZ = rot; } } catch { } }