/// <summary> /// 加载单个任务区 根据任务区实体类加载 /// </summary> /// <param name="map"></param> /// <param name="model"></param> public static void LoadSatelliteTaskArea(Core.Map.MapHelper map, Core.Model.TASK_LAYOUT_LIST model) { if (model.TASKTYPE == 0) { ISymbol symbol = map.CreateSimpleSymbol(Color.OrangeRed, 4, esriSimpleMarkerStyle.esriSMSCross); IPoint pPoint = new PointClass(); pPoint.PutCoords(Convert.ToDouble(model.LON), Convert.ToDouble(model.LAT)); //SatelliteResaultAreas = new List<IPolygon>(); //SatelliteResaultAreas.Add(pPolygon); //添加任务区点 map.AddElement(pPoint, symbol, "TaskArea"); map.AddTextElement(pPoint, getTextElement(model.TASKNAME), "TaskAreaMark"); } else { ISymbol symbol = map.CreateSimpleFillSymbol(Color.OrangeRed, 4, esriSimpleFillStyle.esriSFSHollow); string[] points = model.AREASTRING.Split(' '); string polygon = ""; for (int i = 0; i < points.Length - 1; i += 2) { polygon += points[i + 1] + "," + points[i] + ";"; } IPolygon pPolygon = Core.Generic.Convertor.ToPolygon(polygon); SatelliteResaultAreas = new List <IPolygon>(); SatelliteResaultAreas.Add(pPolygon); //添加任务区多边形 map.AddElement(pPolygon, symbol, "TaskArea"); map.AddTextElement(pPolygon, getTextElement(model.TASKNAME), "TaskAreaMark"); } }
private void cmiSatTask_Click(object sender, EventArgs e) { if (Main.MainInterface.SelectedNodeSat == null) //如果未选中任何结点,则显示观测方案管理界面 { MessageBox.Show("请先选择要显示的观测方案下的具体观测任务再进行操作!"); return; } else { try { string tag = Main.MainInterface.SelectedNodeSat.Tag.ToString(); if (tag.StartsWith("S")) //显示观测任务所对应的观测方案信息 { MessageBox.Show("请先选择要显示的观测任务再进行操作!"); } else if (tag.StartsWith("T")) //显示观测任务所对应的观测方案信息 { int id; int.TryParse(Main.MainInterface.SelectedNodeSat.Tag.ToString().Substring(3), out id); Main.Program.SetStatusLabel("正在加载任务... ..."); Core.Model.TASK_LAYOUT_LIST taskLayoutList = new Core.Model.TASK_LAYOUT_LIST(); Core.DAL.TASK_LAYOUT_LIST dal_taskLayoutList = new Core.DAL.TASK_LAYOUT_LIST(); taskLayoutList = dal_taskLayoutList.GetModel(id); //读取并图上显示卫星观测区信息 Core.Map.MapHelper map = new Core.Map.MapHelper(Main.Program.myMap); //map.ClearAllElement(); Coverage.SatelliteResaultHelper.LoadSatelliteTaskArea(map, taskLayoutList); Coverage.SatelliteResaultHelper.PositionTaskArea(Main.Program.myMap, id); } else if (tag.StartsWith("I")) //显示具体的观测结果信息 { int id; int.TryParse(Main.MainInterface.SelectedNodeSat.Tag.ToString().Substring(3), out id); Main.Program.SetStatusLabel("正在加载任务... ..."); Core.Model.TASK_LAYOUT_LIST taskLayoutList = new Core.Model.TASK_LAYOUT_LIST(); Core.DAL.TASK_LAYOUT_LIST dal_taskLayoutList = new Core.DAL.TASK_LAYOUT_LIST(); Core.DAL.ImgLayoutTempTimewindow dal_imgTimeWindow = new Core.DAL.ImgLayoutTempTimewindow(); taskLayoutList = dal_taskLayoutList.GetModel(Convert.ToInt32(dal_imgTimeWindow.GetModel(id.ToString()).TASKID)); //读取并图上显示卫星观测区信息 Core.Map.MapHelper map = new Core.Map.MapHelper(Main.Program.myMap); //map.ClearAllElement(); Coverage.SatelliteResaultHelper.LoadSatelliteTaskArea(map, taskLayoutList); } Main.Program.SetStatusLabel("就绪."); } catch (Exception ex) { MessageBox.Show("错误:" + ex); } } }
/// <summary> /// 定位任务区 /// </summary> /// <param name="pMapCtr"></param> /// <param name="id"></param> public static void PositionTaskArea(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int id) { Core.Model.TASK_LAYOUT_LIST model = new Core.Model.TASK_LAYOUT_LIST(); Core.DAL.TASK_LAYOUT_LIST dal = new Core.DAL.TASK_LAYOUT_LIST(); try { model = dal.GetModel(id); IEnvelope envelope; if (model.TASKTYPE == 0) { IPoint taskPoint = new PointClass(); taskPoint.PutCoords(Convert.ToDouble(model.LON), Convert.ToDouble(model.LAT)); envelope = taskPoint.Envelope; } else { string[] points = model.AREASTRING.Split(' '); string polygon = ""; for (int i = 0; i < points.Length - 1; i += 2) { polygon += points[i + 1] + "," + points[i] + ";"; } IPolygon taskarea = Core.Generic.Convertor.ToPolygon(polygon); envelope = taskarea.Envelope; } if (!envelope.IsEmpty) { envelope.Expand(2, 2, true); } pMapCtr.Extent = envelope; pMapCtr.ActiveView.Refresh(); } catch (Exception ex) { throw (ex); } finally { model = null; dal = null; } }