Ejemplo n.º 1
0
        private void toolStripLabel9_Click(object sender, EventArgs e)
        {
            //设置进度条
            tempProgressBar.Refresh();
            tempProgressBar.Visible = true;
            tempProgressBar.Minimum = 1;
            tempProgressBar.Maximum = dataGridViewTimewindow.RowCount;
            tempProgressBar.Step    = 1;
            //重置累加覆盖率
            dal_satelliteResault.Refresh(schemeidInt);

            //遍历数据表记录选中的id
            string resaultIDs = "";

            for (int row = 0; row <= dataGridViewTimewindow.RowCount - 1; row++)
            {
                if (((DataGridViewCheckBoxCell)dataGridViewTimewindow.Rows[row].Cells[15]).Value != null && (bool)((DataGridViewCheckBoxCell)dataGridViewTimewindow.Rows[row].Cells[15]).Value)
                {
                    resaultIDs += dataGridViewTimewindow.Rows[row].Cells[0].Value.ToString() + ",";
                }
            }
            resaultIDs = resaultIDs.Substring(0, resaultIDs.Length - 1);
            if (string.IsNullOrEmpty(resaultIDs))
            {
                MessageBox.Show("未选中任何项!");
                tempProgressBar.Visible = false;
                return;
            }
            List <CoScheduling.Core.Model.TASK_LAYOUT_LIST> taskLayoutList = new List <CoScheduling.Core.Model.TASK_LAYOUT_LIST>();

            CoScheduling.Core.DAL.TASK_LAYOUT_LIST dal_taskLayout = new CoScheduling.Core.DAL.TASK_LAYOUT_LIST();
            //方案相关任务
            taskLayoutList = dal_taskLayout.GetList(schemeidInt);

            List <CoScheduling.Core.Model.SatelliteResault> resaultList = new List <CoScheduling.Core.Model.SatelliteResault>();

            foreach (CoScheduling.Core.Model.TASK_LAYOUT_LIST taskLayout in taskLayoutList)
            {
                //如果是点目标,就不需要分析覆盖率的问题
                if (taskLayout.TASKTYPE == 0)
                {
                    continue;
                }
                //任务区域字符串
                string   taskString = "";
                string[] xyStr      = taskLayout.AREASTRING.Split(' ');
                for (int i = 0; i < xyStr.Length; i += 2)
                {
                    if (string.IsNullOrEmpty(xyStr[i]))
                    {
                        continue;
                    }
                    double lat = Convert.ToDouble(xyStr[i]);
                    double lon = Convert.ToDouble(xyStr[i + 1]);
                    taskString += lon + "," + lat + ";";
                }
                taskString += xyStr[1] + "," + xyStr[0];
                //生成任务区域Polygon
                IPolygon taskPolygon = SatelliteResaultHelper.StringToPolygon(taskString);
                double   taskArea    = SatelliteResaultHelper.getPolygonArea(taskPolygon);
                //获取观测结果列表
                resaultList = dal_satelliteResault.GetList("taskid=" + taskLayout.TASKID + " and lstr_seqid in(" + resaultIDs + ")");
                IPolygon unionPolygon = SatelliteResaultHelper.UnionPolygon(null, null);
                double   accuArea     = 0;
                //遍历列表计算累加覆盖率
                foreach (CoScheduling.Core.Model.SatelliteResault satelliteResault in resaultList)
                {
                    tempProgressBar.PerformStep();
                    if (accuArea >= taskArea)
                    {
                        satelliteResault.ACCUCOVERAGE = 1;
                    }
                    else
                    {
                        //结果面字符串
                        string[] satResaultStr  = satelliteResault.POLYGONSTRING.Split(';');
                        string   resaultStr     = satelliteResault.POLYGONSTRING + satResaultStr[0];
                        IPolygon resaultPolygon = SatelliteResaultHelper.StringToPolygon(resaultStr);

                        unionPolygon = SatelliteResaultHelper.UnionPolygon(unionPolygon, resaultPolygon);
                        IPolygon intersectPolygon = SatelliteResaultHelper.IntersectPolygon(taskPolygon, unionPolygon);
                        accuArea = SatelliteResaultHelper.getPolygonArea(intersectPolygon);
                        double ratio = accuArea / taskArea;
                        if (ratio > 1)
                        {
                            satelliteResault.ACCUCOVERAGE = 1;
                        }
                        else
                        {
                            satelliteResault.ACCUCOVERAGE = Convert.ToDecimal(ratio);
                        }
                    }
                    dal_satelliteResault.Update(satelliteResault);
                }
            }
            MessageBox.Show("累加分析统计完成!");
            //隐藏进度条
            tempProgressBar.Visible = false;
            dataRefresh();
        }
Ejemplo n.º 2
0
        private void toolStripLabel3_Click(object sender, EventArgs e)
        {
            //获取当前分析方案的id
            if (schemeid == "")
            {
                schemeid    = dal_taskScheme.GetLatestSchemeid().ToString();
                schemeidInt = Convert.ToInt32(schemeid);
            }
            List <CoScheduling.Core.Model.TASK_LAYOUT_LIST> taskLayoutList = new List <CoScheduling.Core.Model.TASK_LAYOUT_LIST>();

            CoScheduling.Core.DAL.TASK_LAYOUT_LIST dal_taskLayout = new CoScheduling.Core.DAL.TASK_LAYOUT_LIST();
            //方案相关任务
            taskLayoutList = dal_taskLayout.GetList(schemeidInt);
            List <CoScheduling.Core.Model.SatelliteResault> satelliteResaultList = new List <CoScheduling.Core.Model.SatelliteResault>();

            //遍历任务,分别分析
            foreach (CoScheduling.Core.Model.TASK_LAYOUT_LIST taskLayout in taskLayoutList)
            {
                if (taskLayout.TASKTYPE == 0)
                {
                    continue;
                }
                //获取任务相关观测结果
                satelliteResaultList = dal_satelliteResault.GetListByTaskID(taskLayout.TASKID);

                //设置进度条
                tempProgressBar.Refresh();
                tempProgressBar.Visible = true;
                tempProgressBar.Minimum = 1;
                tempProgressBar.Maximum = satelliteResaultList.Count;
                tempProgressBar.Step    = 1;

                //任务区域字符串
                string   taskString = "";
                string[] xyStr      = taskLayout.AREASTRING.Split(' ');
                for (int i = 0; i < xyStr.Length; i += 2)
                {
                    if (string.IsNullOrEmpty(xyStr[i]))
                    {
                        continue;
                    }
                    double lat = Convert.ToDouble(xyStr[i]);
                    double lon = Convert.ToDouble(xyStr[i + 1]);
                    taskString += lon + "," + lat + ";";
                }
                taskString += xyStr[1] + "," + xyStr[0];
                //生成任务区域Polygon
                IPolygon taskPolygon = SatelliteResaultHelper.StringToPolygon(taskString);
                double   taskArea    = SatelliteResaultHelper.getPolygonArea(taskPolygon);
                //遍历观测结果,逐个分析
                foreach (CoScheduling.Core.Model.SatelliteResault satelliteResault in satelliteResaultList)
                {
                    tempProgressBar.PerformStep();
                    //调用AE分析覆盖面积与任务面积比
                    //结果面字符串
                    string[] satResaultStr    = satelliteResault.POLYGONSTRING.Split(';');
                    string   resaultStr       = satelliteResault.POLYGONSTRING + satResaultStr[0];
                    IPolygon resaultPolygon   = SatelliteResaultHelper.StringToPolygon(resaultStr);
                    IPolygon intersectPolygon = SatelliteResaultHelper.IntersectPolygon(taskPolygon, resaultPolygon);
                    double   intersectArea;
                    if (intersectPolygon != null)
                    {
                        intersectArea = SatelliteResaultHelper.getPolygonArea(intersectPolygon);
                    }
                    else
                    {
                        intersectArea = 0;
                    }

                    double ratio = (intersectArea / taskArea > 1) ? 1 : (intersectArea / taskArea);
                    satelliteResault.COVERAGE = Convert.ToDecimal(ratio);
                    //更新观测结果
                    dal_satelliteResault.Update(satelliteResault);
                }

                //隐藏进度条
                tempProgressBar.Visible = false;
            }
            //刷新表格
            dataRefresh();
            MessageBox.Show("分析完成!");
        }