Esempio n. 1
0
        /// <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");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 加载集结点
        /// </summary>
        /// <param name="map"></param>
        /// <param name="model"></param>
        public static void LoadGatherPoint(Core.Map.MapHelper map, Core.Model.DisaGatherPoint model)
        {
            ISymbol symbol = map.CreateSimpleSymbol(Color.Blue, 8, ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle);
            IPoint  pPoint = new PointClass();

            pPoint.PutCoords(model.LON, model.LAT);
            map.AddElement(pPoint, symbol, "GatherPoint|" + model.PID);
        }
Esempio n. 3
0
        /// <summary>
        /// 加载单个任务区 根据任务区实体类加载
        /// </summary>
        /// <param name="map"></param>
        /// <param name="model"></param>
        public static void LoadTaskArea(Core.Map.MapHelper map, Core.Model.TaskAreas model)
        {
            ISymbol  symbol   = map.CreateSimpleFillSymbol(Color.Red, 4, esriSimpleFillStyle.esriSFSHollow);
            IPolygon pPolygon = Core.Generic.Convertor.ToPolygon(model.PolygonString);

            TaskAreas = new List <IPolygon>();
            TaskAreas.Add(pPolygon);
            //添加任务区多边形
            map.AddElement(pPolygon, symbol, "TaskArea");
            map.AddTextElement(pPolygon, getTextElement(model.Name), "TaskAreaMark");
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
        public static bool op = false;//fale--单元格数量创建灾区;true--单元格大小创建灾区


        /// <summary>
        /// 生成任务区域
        /// </summary>
        /// <param name="DID">灾区ID</param>
        /// <param name="GridHeight">单元格高度</param>
        /// <param name="GridWidth">单元格长度</param>
        /// <param name="pMapCtr">地图控件</param>
        public static void GenerateTask(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int DID,
                                        double GridWidth, double GridHeight)
        {
            Core.Model.DisaAreaInfo di;
            Core.DAL.DisaAreaInfo   dal = new Core.DAL.DisaAreaInfo();
            try
            {
                di = dal.GetModel(DID);
                if (di == null)
                {
                    throw (new Exception("读取灾区数据时出错"));
                }
                IPoint pnt = new ESRI.ArcGIS.Geometry.Point();
                pnt.X = di.LON;
                pnt.Y = di.LAT;
                Core.Map.MapHelper   maphelper = new Core.Map.MapHelper(pMapCtr);
                System.Drawing.Color color     = Color.Blue;
                ISymbol symbol = maphelper.CreateSimpleFillSymbol(color, 1, esriSimpleFillStyle.esriSFSHollow);
                double  radius = di.AffectedRadius / Core.Generic.SysEnviriment.LengthPerRad;
                MonitorTask.TaskAreaHelper th = new MonitorTask.TaskAreaHelper();
                th.LoadMapData();
                th.SetDisasterArea(di.LON - radius, di.LAT - radius, di.LON + radius, di.LAT + radius);
                th.GenerateTask(GridWidth, GridHeight);

                InitGrid = th.InitGrids;
                DataGrid = th.DataGrids;
                IEnvelope env = new Envelope() as IEnvelope;
                //foreach (MonitorTask.Geometry.Grid grid in InitGrid)
                //{
                //    env = new Envelope() as IEnvelope;
                //    env.XMin = grid.XMin;
                //    env.YMin = grid.YMin;
                //    env.XMax = grid.XMax;
                //    env.YMax = grid.YMax;
                //    maphelper.AddElement(env, symbol, "grid");
                //}
                //color = Color.Brown;
                //symbol = maphelper.CreateSimpleFillSymbol(color, 1, esriSimpleFillStyle.esriSFSDiagonalCross);
                //foreach (MonitorTask.Geometry.Grid grid in DataGrid)
                //{
                //    env = new Envelope() as IEnvelope;
                //    env.XMin = grid.XMin;
                //    env.YMin = grid.YMin;
                //    env.XMax = grid.XMax;
                //    env.YMax = grid.YMax;
                //    maphelper.AddElement(env, symbol, "grid");
                //}
            }
            catch (Exception ex) { throw (ex); }
        }
Esempio n. 7
0
        /// <summary>
        /// 加载单个任务区 根据任务区实体类加载
        /// </summary>
        /// <param name="map"></param>
        /// <param name="model"></param>
        public static void LoadSatelliteResaultArea(Core.Map.MapHelper map, Core.Model.SatelliteResault model)
        {
            CoScheduling.Core.Model.ImgLayoutTempTimewindow img     = new CoScheduling.Core.Model.ImgLayoutTempTimewindow();
            CoScheduling.Core.DAL.ImgLayoutTempTimewindow   dal_img = new CoScheduling.Core.DAL.ImgLayoutTempTimewindow();
            img = dal_img.GetModel(model.LSTR_SEQID.ToString());
            ISymbol  symbol   = map.CreateSimpleFillSymbol(Color.Blue, 1, esriSimpleFillStyle.esriSFSHollow);
            IPolygon pPolygon = Core.Generic.Convertor.ToPolygon(model.POLYGONSTRING);

            SatelliteResaultAreas = new List <IPolygon>();
            SatelliteResaultAreas.Add(pPolygon);
            //添加任务区多边形
            map.AddElement(pPolygon, symbol, "TaskArea");
            map.AddElement(pPolygon, symbol, "SatResaultInfo|" + img.LSTR_SEQID);
            //map.AddTextElement(pPolygon, getTextElement(img.SAT_STKNAME+"/"+img.SENSOR_STKNAME), "TaskAreaMark");
        }
Esempio n. 8
0
        /// <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);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 定位操作函数
        /// </summary>
        public void positionSat()
        {
            string tag = Main.MainInterface.SelectedNodeSat.Tag.ToString();

            if (Main.MainInterface.SelectedNodeSat == null)
            {
                MessageBox.Show("请先选择要显示的内容再进行操作!");
                return;
            }
            if (tag.StartsWith("S")) //观测方案
            {
                //int id;
                //int.TryParse(tag.Substring(3), out id);
                //Satellite.SatelliteResaultHelper.PositionResaultAreasBySchemeID(this.myMap, id);
                //Core.Map.MapHelper map = new Core.Map.MapHelper(myMap);
                MessageBox.Show("请选择具体的观测区域再进行定位");
            }
            else if (tag.StartsWith("T"))       //观测任务
            {
                if (tag.Substring(1, 1) == "0") //为任务空结点
                {
                    MessageBox.Show("未生成观测结果区域");
                }
                else
                {
                    //int id;
                    //int.TryParse(tag.Substring(3), out id);
                    //Satellite.SatelliteResaultHelper.PositionResaultAreasByTaskID(this.myMap, id);
                    //利用助手加载任务信息并定位
                    MessageBox.Show("请选择具体的观测区域再进行定位");
                }
            }
            else if (tag.StartsWith("I")) //观测区域
            {
                int id;
                int.TryParse(tag.Substring(3), out id);
                Coverage.SatelliteResaultHelper.PositionResaultArea(Main.Program.myMap, id);
                Core.Map.MapHelper map = new Core.Map.MapHelper(Main.Program.myMap);
            }
        }
Esempio n. 10
0
        private void FormMap_Load(object sender, EventArgs e)
        {
            Main.Program.SetStatusLabel(" 正在加载数据...");
            try
            {
                pMapHelper = new Core.Map.MapHelper(this.myMap);

                //加载配置文件中的地图服务列表
                pMapHelper.LoadMapService();

                //加载配置文件中的SHP文件列表
                //pMapHelper.LoadShape();

                //在规划调度模块中加载地图
                //if (CP.WinFormsUI.Docking.FloatWindow.ribbonControl.SelectedPage.Name == "CoScheduling")
                //{
                //加载配置文件中的mxd
                pMapHelper.LoadMapDocument();
                //}

                //利用配置文件中的InitExten信息初始化地图范围
                //pMapHelper.InitExtent();
                //加载DEM
                //pMapHelper.LoadDEM();
                //将地图控件传到Program
                Main.Program.myMap = this.myMap;
            }
            catch (Exception ex)
            {
                MessageBox.Show("错误:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Main.Program.SetStatusLabel("就绪!");
                Program.gProgressBar.Visible = false;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 获取交点
        /// </summary>
        /// <param name="TaskAreas"></param>
        /// <param name="map"></param>
        public static void getIntersect(ESRI.ArcGIS.Controls.AxMapControl pMapCtr)
        {
            Core.Map.MapHelper map = new Core.Map.MapHelper(pMapCtr);
            Core.Generic.myXML xml = new Core.Generic.myXML(System.Windows.Forms.Application.StartupPath + "\\Setting.xml");
            try
            {
                IFeatureClass             pFeatureClass = null;
                Core.Model.DisaCrossPoint gatherPoint   = new Core.Model.DisaCrossPoint();
                Core.DAL.DisaCrossPoint   dal           = new Core.DAL.DisaCrossPoint();
                //删除以前生成的交点
                dal.Deletes(list_model[0].PID);

                map.getNetWorkData(ref pFeatureClass);
                if (list_model.Count == 0)
                {
                    MessageBox.Show("该灾区尚未生成任务区!");
                    return;
                }
                //pIntersectPoint = new List<IPoint>();
                string   Roadtype    = xml.GetElement("FilterPara", "RoadType");
                string[] typeArray   = Roadtype.Split(',');
                string   whereclause = "";
                if (Roadtype != null)
                {
                    for (int i = 0; i < typeArray.Length; i++)
                    {
                        if (i != (typeArray.Length - 1))
                        {
                            whereclause += "Type=" + typeArray[i] + " or ";
                        }
                        else
                        {
                            whereclause += "Type=" + typeArray[i];
                        }
                    }
                }
                foreach (Core.Model.TaskAreas taskarea in list_model)
                {
                    IPolygon pPolygon = CoScheduling.Core.Generic.Convertor.ToPolygon(taskarea.PolygonString);
                    //过滤道路网
                    IGeometry      pGeometry      = pPolygon as IGeometry;
                    ISpatialFilter pSpatialfilter = new SpatialFilterClass();
                    pSpatialfilter.Geometry      = pGeometry;
                    pSpatialfilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;
                    pSpatialfilter.WhereClause   = whereclause;
                    pSpatialfilter.GeometryField = "Shape";

                    IFeatureCursor FeatureCursor = pFeatureClass.Search(pSpatialfilter, false);
                    IFeature       pFeature      = FeatureCursor.NextFeature();

                    int count = 1;
                    while (pFeature != null)
                    {
                        IPolyline pPolyline = pFeature.ShapeCopy as IPolyline;

                        ITopologicalOperator pTopologicalOperator = pPolyline as ITopologicalOperator;
                        IGeometry            pGeometry1           =
                            pTopologicalOperator.Intersect(pPolygon, esriGeometryDimension.esriGeometry0Dimension) as
                            IGeometry;

                        if (!pGeometry1.IsEmpty)
                        {
                            IPointCollection Pc     = pGeometry1 as IPointCollection;
                            ISymbol          symbol = map.CreateSimpleSymbol(Color.Red, 8, ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle);
                            for (int i = 0; i < Pc.PointCount; i++)
                            {
                                //将交点显示在地图上
                                IPoint point = Pc.get_Point(i);

                                map.AddElement(Pc.get_Point(i), symbol, "Intersect|" + taskarea.ID + "|" + taskarea.PID);

                                //将交点存储到数据库中
                                gatherPoint.LON   = point.X;
                                gatherPoint.LAT   = point.Y;
                                gatherPoint.PID   = taskarea.ID;
                                gatherPoint.PName = "交点(" + count++ + ")";
                                dal.Add(gatherPoint);
                                //pIntersectPoint.Add(Pc.get_Point(i));
                            }
                        }
                        pFeature = FeatureCursor.NextFeature();
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            finally
            {
                TaskAreas = null;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 获取交点
        /// </summary>
        /// <param name="pMapCtr"></param>
        /// <param name="id"></param>
        public static void getIntersect(ESRI.ArcGIS.Controls.AxMapControl pMapCtr, int id)
        {
            Core.Map.MapHelper map = new Core.Map.MapHelper(pMapCtr);
            Core.Generic.myXML xml = new Core.Generic.myXML(System.Windows.Forms.Application.StartupPath + "\\Setting.xml");
            try
            {
                IFeatureClass           pFeatureClass = null;
                Core.Model.DisaAreaInfo model         = new Core.Model.DisaAreaInfo();
                Core.DAL.DisaAreaInfo   dal0          = new Core.DAL.DisaAreaInfo();


                Core.Model.DisaCrossPoint gatherPoint = new Core.Model.DisaCrossPoint();
                Core.DAL.DisaCrossPoint   dal         = new Core.DAL.DisaCrossPoint();
                //删除以前生成的交点
                dal.Deletes(id);

                map.getNetWorkData(ref pFeatureClass);

                //pIntersectPoint = new List<IPoint>();
                string   Roadtype    = xml.GetElement("FilterPara", "RoadType");
                string[] typeArray   = Roadtype.Split(',');
                string   whereclause = "";
                if (Roadtype != null)
                {
                    for (int i = 0; i < typeArray.Length; i++)
                    {
                        if (i != (typeArray.Length - 1))
                        {
                            whereclause += "Type=" + typeArray[i] + " or ";
                        }
                        else
                        {
                            whereclause += "Type=" + typeArray[i];
                        }
                    }
                }

                //生成灾区影响范围Geometry
                model = dal0.GetModel(id);
                IPoint pPoint = new PointClass();
                pPoint.PutCoords(model.LON, model.LAT);

                ITopologicalOperator pTopoOp   = default(ITopologicalOperator);
                IGeometry            geoBuffer = null;
                pTopoOp   = pPoint as ITopologicalOperator;
                geoBuffer = pTopoOp.Buffer(model.AffectedRadius / Core.Generic.SysEnviriment.LengthPerRad);

                ISpatialFilter pSpatialfilter = new SpatialFilterClass();
                pSpatialfilter.Geometry      = geoBuffer;
                pSpatialfilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelCrosses;
                pSpatialfilter.WhereClause   = whereclause;
                pSpatialfilter.GeometryField = "Shape";

                IFeatureCursor FeatureCursor = pFeatureClass.Search(pSpatialfilter, false);
                IFeature       pFeature      = FeatureCursor.NextFeature();

                int count = 1;
                while (pFeature != null)
                {
                    IPolyline pPolyline = pFeature.ShapeCopy as IPolyline;

                    ITopologicalOperator pTopologicalOperator = pPolyline as ITopologicalOperator;
                    IGeometry            pGeometry1           =
                        pTopologicalOperator.Intersect(geoBuffer as IPolygon, esriGeometryDimension.esriGeometry0Dimension) as
                        IGeometry;

                    if (!pGeometry1.IsEmpty)
                    {
                        IPointCollection Pc     = pGeometry1 as IPointCollection;
                        ISymbol          symbol = map.CreateSimpleSymbol(Color.Red, 8, ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle);
                        for (int i = 0; i < Pc.PointCount; i++)
                        {
                            //将交点显示在地图上
                            IPoint point = Pc.get_Point(i);

                            map.AddElement(Pc.get_Point(i), symbol, "Intersect|" + id);

                            //将交点存储到数据库中
                            gatherPoint.LON   = point.X;
                            gatherPoint.LAT   = point.Y;
                            gatherPoint.PID   = id;
                            gatherPoint.PName = "交点(" + count++ + ")";
                            dal.Add(gatherPoint);
                            //pIntersectPoint.Add(Pc.get_Point(i));
                        }
                    }
                    pFeature = FeatureCursor.NextFeature();
                }
                pMapCtr.ActiveView.Refresh();
            }
            catch (Exception ex) { throw ex; }
            finally
            {
                TaskAreas = null;
            }
        }
Esempio n. 13
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);
            }
        }