/// <summary> /// 绘制地球对象上的图层 /// </summary> /// <param name="renderable"></param> /// <param name="priority"></param> /// <param name="drawArgs"></param> private void Render(RenderableObject renderable, RenderPriority priority, DrawArgs drawArgs) { //若是绘制星星,则返回,因为星星图层已经绘制过了 //if (!renderable.IsOn || (renderable.Name != null && renderable.Name.Equals("Starfield"))) if (!renderable.IsOn || (renderable.Name != null && renderable.Name.Equals("星空"))) { return; } //绘制Icon图层 if (priority == RenderPriority.Icons && renderable is Icons) { renderable.Render(drawArgs); } else if (priority == RenderPriority.GCPs && renderable is GCPs) { renderable.Render(drawArgs); } //绘制RenderableObjectList类型图层下的所有子图层 else if (renderable is RenderableObjectList) { RenderableObjectList rol = (RenderableObjectList)renderable; for (int i = 0; i < rol.ChildObjects.Count; i++) { Render((RenderableObject)rol.ChildObjects[i], priority, drawArgs); } } //绘制RenderPriority.SurfaceImages类型的图层 else if (priority == RenderPriority.TerrainMappedImages) { if (renderable.RenderPriority == RenderPriority.SurfaceImages || renderable.RenderPriority == RenderPriority.TerrainMappedImages) { renderable.Render(drawArgs); } } //绘制RenderPriority.LinePaths和RenderPriority.AtmosphericImages类型的图层 else if (renderable.RenderPriority == priority) { renderable.Render(drawArgs); } }
/// <summary> /// 2.绘制星星 /// </summary> /// <param name="drawArgs"></param> /// <param name="renderable"></param> private void RenderStars(DrawArgs drawArgs, RenderableObject renderable) { if (renderable is RenderableObjectList) { RenderableObjectList rol = (RenderableObjectList)renderable; for (int i = 0; i < rol.ChildObjects.Count; i++) { RenderStars(drawArgs, (RenderableObject)rol.ChildObjects[i]); } } //else if (renderable.Name != null && renderable.Name.Equals("Starfield")) else if (renderable.Name != null && renderable.Name.Equals("星空")) { try { renderable.Render(drawArgs); } catch (Exception ex) { throw new Exception("绘制星星失败!\n" + ex.ToString()); } } }