示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <summary>
        /// 批量加载任务区 根据任务区所属的灾情id加载
        /// </summary>
        /// <param name="pMapCtr"></param>
        /// <param name="id"></param>
        public static void LoadTaskAreas(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int id)
        {
            //读取并图上显示任务区任务区信息
            Core.Map.MapHelper map = new Core.Map.MapHelper(pMapCtr);
            map.ClearAllElement();
            //灾区
            Core.DAL.TaskAreas t_dal = new Core.DAL.TaskAreas();
            list_model = new List <Core.Model.TaskAreas>();
            //交点
            Core.DAL.DisaCrossPoint          dal    = new Core.DAL.DisaCrossPoint();
            List <Core.Model.DisaCrossPoint> models = new List <Core.Model.DisaCrossPoint>();

            //集结点
            Core.DAL.DisaGatherPoint          g_dal    = new Core.DAL.DisaGatherPoint();
            List <Core.Model.DisaGatherPoint> g_models = new List <Core.Model.DisaGatherPoint>();

            IEnvelope envelope = null;

            try
            {
                list_model = t_dal.GetList(id);
                if (list_model.Count == 0)
                {
                    MessageBox.Show("该灾区尚未生成任务区!");
                    return;
                }
                //加载
                foreach (Core.Model.TaskAreas t_model in list_model)
                {
                    LoadTaskArea(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);
                    }

                    //models = dal.GetList(t_model.ID, id);
                    //foreach (Core.Model.DisaCrossPoint model in models)
                    //{
                    //    LoadCrossPoint(map, model);
                    //}

                    //g_models = g_dal.GetList(t_model.ID, id);
                    //foreach (Core.Model.DisaGatherPoint model in g_models)
                    //{
                    //    LoadGatherPoint(map, model);
                    //}
                }

                if (!envelope.IsEmpty)
                {
                    envelope.Expand(1.1, 1.1, true);
                }
                pMapCtr.Extent = envelope;
                pMapCtr.ActiveView.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("错误:" + ex);
            }
        }