/// <summary> /// 定位观测区 /// </summary> /// <param name="pMapCtr"></param> /// <param name="id"></param> public static void PositionResaultArea(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int id) { Core.Model.SatelliteResault model = new Core.Model.SatelliteResault(); Core.DAL.SatelliteResault dal = new Core.DAL.SatelliteResault(); try { model = dal.GetModel(id); IPolygon taskarea = Core.Generic.Convertor.ToPolygon(model.POLYGONSTRING); IEnvelope envelope; 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; } }
/// <summary> /// 批量加载卫星观测区 根据卫星观测区所属的任务id加载 /// </summary> /// <param name="pMapCtr"></param> /// <param name="id"></param> public static void LoadSatelliteResaultAreasByTaskID(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int id, DateTime begin, DateTime end) { //读取并图上显示卫星观测区信息 Core.Map.MapHelper map = new Core.Map.MapHelper(pMapCtr); map.ClearAllElement(); //卫星观测区域 Core.DAL.SatelliteResault dal_satelliteResault = new Core.DAL.SatelliteResault(); list_model = new List <Core.Model.SatelliteResault>(); IEnvelope envelope = null; try { list_model = dal_satelliteResault.GetListByTaskID(id, begin, end); if (list_model.Count == 0) { MessageBox.Show("该灾区尚未生成任务区!"); return; } //加载 foreach (Core.Model.SatelliteResault t_model in list_model) { try { LoadSatelliteResaultArea(map, t_model); IPolygon pPolygon = Core.Generic.Convertor.ToPolygon(t_model.POLYGONSTRING); //获取多个Polygon的Envelope外包矩形 if (envelope == null) { envelope = pPolygon.Envelope; } else { envelope.Union(pPolygon.Envelope); } } catch (Exception ex) { continue; } } if (!envelope.IsEmpty) { envelope.Expand(1.1, 1.1, true); } pMapCtr.Extent = envelope; pMapCtr.ActiveView.Refresh(); } catch (Exception ex) { MessageBox.Show("错误:" + ex); } }
/// <summary> /// 加载观测区域列表 /// </summary> /// <param name="pnode"></param> public static void LoadSatelliteResaultList(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, TreeNode pnode, bool timeChecked) { int pid; int.TryParse(pnode.Tag.ToString().Substring(3), out pid); Core.DAL.SatelliteResault dal = new Core.DAL.SatelliteResault(); List <Core.Model.SatelliteResault> list_model = new List <Core.Model.SatelliteResault>(); TreeNode node; try { if (timeChecked) { list_model = dal.GetListByTaskIDTime(pid); } else { list_model = dal.GetListByTaskID(pid); } if (list_model.Count != 0) { pnode.Nodes.Clear(); } foreach (Core.Model.SatelliteResault model in list_model) { Core.Model.ImgLayoutTempTimewindow imgLayoutTempTimewindow = new Core.Model.ImgLayoutTempTimewindow(); Core.DAL.ImgLayoutTempTimewindow dal_imgLayoutTempTimewindow = new Core.DAL.ImgLayoutTempTimewindow(); imgLayoutTempTimewindow = dal_imgLayoutTempTimewindow.GetModel(model.LSTR_SEQID.ToString()); node = new TreeNode(); node.Text = imgLayoutTempTimewindow.STARTTIME.ToString("yyyy-MM-dd HH:mm:ss") + "\\" + imgLayoutTempTimewindow.SAT_STKNAME + "\\" + imgLayoutTempTimewindow.SENSOR_STKNAME; node.Tag = "I1|" + model.LSTR_SEQID;//I--表示观测结果,model.LSTR_SEQID--表示为观测结果ID node.ImageIndex = 4; node.SelectedImageIndex = 5; pnode.Nodes.Add(node); } } catch (Exception ex) { throw (ex); } finally { list_model = null; dal = null; } }
/// <summary> /// 在地图上显示成像区域 /// </summary> public void showSatelliteResault() { if (Main.MainInterface.SelectedNodeSat == null) { MessageBox.Show("请先选择观测方案再进行操作!"); return; } try { string tag = Main.MainInterface.SelectedNodeSat.Tag.ToString(); if (tag.StartsWith("S")) //任务结点 { int id; int.TryParse(Main.MainInterface.SelectedNodeSat.Tag.ToString().Substring(3), out id); Main.Program.SetStatusLabel("正在加载任务... ..."); Coverage.SatelliteResaultHelper.LoadSatelliteResaultAreas(Main.Program.myMap, id, this.dateTimePicker1.Value, this.dateTimePicker2.Value); } else if (tag.StartsWith("T")) //任务结点 { int id; int.TryParse(Main.MainInterface.SelectedNodeSat.Tag.ToString().Substring(3), out id); Main.Program.SetStatusLabel("正在加载任务... ..."); Coverage.SatelliteResaultHelper.LoadSatelliteResaultAreasByTaskID(Main.Program.myMap, id, this.dateTimePicker1.Value, this.dateTimePicker2.Value); } else if (tag.StartsWith("I")) //结果点 { int id; int.TryParse(Main.MainInterface.SelectedNodeSat.Tag.ToString().Substring(3), out id); Main.Program.SetStatusLabel("正在加载任务... ..."); Core.Model.SatelliteResault satelliteResault = new Core.Model.SatelliteResault(); Core.DAL.SatelliteResault dal_satelliteResault = new Core.DAL.SatelliteResault(); satelliteResault = dal_satelliteResault.GetModel(id); //读取并图上显示卫星观测区信息 Core.Map.MapHelper map = new Core.Map.MapHelper(Main.Program.myMap); //map.ClearAllElement(); Coverage.SatelliteResaultHelper.LoadSatelliteResaultArea(map, satelliteResault); } Main.Program.SetStatusLabel("就绪."); } catch (Exception ex) { MessageBox.Show("错误:" + ex); } }
private void tvSatelliteResault_AfterSelect(object sender, TreeViewEventArgs e) { Main.MainInterface.SelectedNodeSat = e.Node; string tag = Main.MainInterface.SelectedNodeSat.Tag.ToString(); Core.Model.TASK_SCHEME_LIST taskScheme = new Core.Model.TASK_SCHEME_LIST(); Core.DAL.TASK_SCHEME_LIST dal_taskScheme = new Core.DAL.TASK_SCHEME_LIST(); Core.DAL.SatelliteResault dal_satelliteResault = new Core.DAL.SatelliteResault(); int schemeid = 0; if (tag.StartsWith("S")) //任务结点 { int id; int.TryParse(tag.Substring(3), out id); schemeid = id; } else if (tag.StartsWith("T")) //任务结点 { int id; int.TryParse(tag.Substring(3), out id); schemeid = dal_satelliteResault.getSchemeidByTaskid(id); } else if (tag.StartsWith("I")) //结果点 { int id; int.TryParse(tag.Substring(3), out id); schemeid = dal_satelliteResault.getSchemeidByLstrseqid(id); } if (schemeid != 0) { taskScheme = dal_taskScheme.GetModel(schemeid); this.dateTimePicker1.MaxDate = DateTimePicker.MaximumDateTime; this.dateTimePicker1.MinDate = DateTimePicker.MinimumDateTime; this.dateTimePicker1.MaxDate = taskScheme.SCHEMEETIME; this.dateTimePicker1.MinDate = taskScheme.SCHEMEBTIME; this.dateTimePicker2.MaxDate = DateTimePicker.MaximumDateTime; this.dateTimePicker2.MinDate = DateTimePicker.MinimumDateTime; this.dateTimePicker2.MaxDate = taskScheme.SCHEMEETIME; this.dateTimePicker2.MinDate = taskScheme.SCHEMEBTIME; this.dateTimePicker1.Value = taskScheme.SCHEMEBTIME; this.dateTimePicker2.Value = taskScheme.SCHEMEETIME; } }
/// <summary> /// 根据观测方案定位观测区域 /// </summary> /// <param name="pMapCtr"></param> /// <param name="DID"></param> public static void PositionResaultAreasByTaskID(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int DID) { Core.DAL.SatelliteResault dal = new Core.DAL.SatelliteResault(); List <Core.Model.SatelliteResault> list_model = new List <Core.Model.SatelliteResault>(); try { list_model = dal.GetListBySchemeID(DID); } catch (Exception ex) { throw (ex); } finally { list_model = null; dal = null; } }