private void SetPicBoxGrid(int index, bool alert)
        {
            int type = 0, count = 0;

            GetTypeAndCount(index, ref type, ref count);

            mapPicBox.SelectGroup = true;
            mapPicBox.SetSelectedGrid((sideOutObjects == null) ? null : SideFlowtUtility.GetSideFlowSets(sideOutObjects), (sideInObjects == null) ? null : SideFlowtUtility.GetSideFlowSets(sideInObjects), null, null, type, count, alert);
            if (type == 0)
            {
                if (sideOutObjects[count].criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow)
                {
                    subTypeRdo.Checked = true;
                }
                else
                {
                    superTypeRdo.Checked = true;
                }
            }
            else
            {
                if (sideInObjects[count].criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow)
                {
                    subTypeRdo.Checked = true;
                }
                else
                {
                    superTypeRdo.Checked = true;
                }
            }
        }
        private void UpdateSelectedGroup(List <Point> pts, bool alert = false)
        {
            RiverSimulationProfile p = RiverSimulationProfile.profile;
            int index = listBox.SelectedIndex;
            int type = 0, count = 0;

            GetTypeAndCount(index, ref type, ref count);

            if (type == 0)
            {
                sideOutObjects[count].sideFlowPoints = pts;
            }
            else
            {
                sideInObjects[count].sideFlowPoints = pts;
            }

            mapPicBox.SetSelectedGrid((sideOutObjects == null) ? null : SideFlowtUtility.GetSideFlowSets(sideOutObjects), (sideInObjects == null) ? null : SideFlowtUtility.GetSideFlowSets(sideInObjects), null, null, type, count, alert);
        }
        private void mapPicBox_SelectedGroupChangedEvent(List <Point> pl)
        {
            RiverSimulationProfile p = RiverSimulationProfile.profile;
            int index = listBox.SelectedIndex;

            if (!SideFlowtUtility.TrimToEdge(ref pl, p.inputGrid.GetI, p.inputGrid.GetJ))
            {
                UpdateSelectedGroup(pl, true);
                MessageBox.Show("請圈選邊界!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                UpdateSelectedGroup(null);
                return;
            }

            int type = 0, count = 0;

            GetTypeAndCount(index, ref type, ref count);

            //檢查連續
            if (!SideFlowtUtility.IsContinuous(pl))
            {
                UpdateSelectedGroup(pl, true);
                MessageBox.Show("請圈選連續區域!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                UpdateSelectedGroup(null);
                return;
            }

            //檢查重疊
            if (!CheckOverlapping(pl, SideFlowtUtility.GetSideFlowSets(sideOutObjects), count))
            {
                return;
            }
            if (!CheckOverlapping(pl, SideFlowtUtility.GetSideFlowSets(sideInObjects), count))
            {
                return;
            }


            //最後確認 [20141121]更新客製化需求 回報問題 新增規格
            if (DialogResult.OK == MessageBox.Show("請確認以此次圈選範圍取代原先資料。", "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.None))
            {
                UpdateSelectedGroup(pl);
            }
            //StructureSetUtility.EditBottomElevation(p, "編輯" + structureName[type] + (1 + count).ToString() + "高程", type, count);
            //if (StructureSetUtility.IsOverlapping(rg, pl, index))
            //{
            //    UpdateSelectedGroup(pl, true);
            //    if (DialogResult.Yes == MessageBox.Show("圈選到重覆區域,是否刪減重複範圍(選「否」將放棄此次圈選)", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
            //    {
            //        StructureSetUtility.RemoveOverlapping(ref pl, rg, index);
            //        if (!StructureSetUtility.IsContinuous(pl))
            //        {
            //            UpdateSelectedGroup(pl, true);
            //            MessageBox.Show("刪減後不是連續區域,請重新選取!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //            UpdateSelectedGroup(null);
            //            return;
            //        }
            //    }
            //    else
            //    {
            //        UpdateSelectedGroup(null);
            //        return;
            //    }
            //}

            //UpdateSelectedGroup(pl);
        }