//查詢一格網點位於哪個結構物群組? //public static int WhichGroup(List<Point>[] pts, Point pt, List<Point> addional = null, int passIndex = -1) //{ // for (int i = 0; i < pts.Length; ++i) // { // List<Point> pl = pts[i]; // if (pl == null || (passIndex != -1 && i == passIndex)) // continue; // if(pl.Contains(pt)) // { // return i; // } // } // if (addional != null) // { // if (addional.Contains(pt)) // { // return passIndex; // } // } // return -1; //} public static List <Point>[] GetStructureSets(RiverSimulationProfile profile, int type) { List <Point>[] pts = null; switch (type) { case 0: pts = profile.tBarSets; break; case 1: pts = profile.bridgePierSets; break; case 2: pts = profile.groundsillWorkSets; break; case 3: pts = profile.sedimentationWeirSets; break; default: break; } return(pts); }
private void sedimentParticleSizeBtn_Click(object sender, EventArgs e) { RiverSimulationProfile p = RiverSimulationProfile.profile; int n = 0; try { n = Convert.ToInt32(sedimentParticlesNumberTxt.Text); } catch { n = -1; } if (n < 1) { MessageBox.Show("請輸入正確的泥砂顆粒數目", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } TableInputForm form = new TableInputForm(); form.SetFormMode(sedimentParticlesNumberBtn.Text, true, 1, n); if (DialogResult.OK == form.ShowDialog()) { } }
//查詢一格網點位於哪個結構物群組? public static Point WhichGroup(RiverSimulationProfile profile, Point pt, List <Point> addional = null, int passType = -1, int passIndex = -1) { for (int n = 0; n < (int)RiverSimulationProfile.StructureType.StructureTypeSize; ++n) { List <Point>[] pts = GetStructureSets(profile, n); if (null == pts) { continue; } for (int i = 0; i < pts.Length; ++i) { List <Point> pl = pts[i]; if (pl == null || (passIndex != -1 && i == passIndex)) { continue; } if (pl.Contains(pt)) { return(new Point(n, i)); } } } if (addional != null) { if (addional.Contains(pt)) { return(new Point(passType, passIndex)); } } return(new Point(-1, -1)); }
private bool ConvertStructureSetNumber() { RiverSimulationProfile p = RiverSimulationProfile.profile; int n = 0; if (p.tBarSet) { if (!ControllerUtility.CheckConvertInt32(ref n, tBarNumberTxt, "請輸入正確的丁壩數量!", ControllerUtility.CheckType.GreaterThanZero)) { return(false); } } else { n = 0; } p.tBarNumber = n; if (p.bridgePierSet) { if (!ControllerUtility.CheckConvertInt32(ref n, bridgePierNumberTxt, "請輸入正確的橋墩數量!", ControllerUtility.CheckType.GreaterThanZero)) { return(false); } } else { n = 0; } p.bridgePierNumber = n; if (p.groundsillWorkSet) { if (!ControllerUtility.CheckConvertInt32(ref n, groundsillWorkNumberTxt, "請輸入正確的固床工數量!", ControllerUtility.CheckType.GreaterThanZero)) { return(false); } } else { n = 0; } p.groundsillWorkNumber = n; if (p.sedimentationWeirSet) { if (!ControllerUtility.CheckConvertInt32(ref n, sedimentationWeirNumberTxt, "請輸入正確的攔河堰數量!", ControllerUtility.CheckType.GreaterThanZero)) { return(false); } } else { n = 0; } p.sedimentationWeirNumber = n; return(true); }
private void structureSetBtn_Click(object sender, EventArgs e) { RiverSimulationProfile p = RiverSimulationProfile.profile; if (!ConvertStructureSetNumber()) { return; } if (p.tBarNumber + p.bridgePierNumber + p.groundsillWorkNumber + p.sedimentationWeirNumber == 0) { MessageBox.Show("請設置結構物數量!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } bool alreadyShow = false; RiverSimulationProfile.StructureChangeType tp = p.CheckStructurerChanged(p.tBarSet, ref p.tBarSets, p.tBarNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.bridgePierSet, ref p.bridgePierSets, p.bridgePierNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.groundsillWorkSet, ref p.groundsillWorkSets, p.groundsillWorkNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.sedimentationWeirSet, ref p.sedimentationWeirSets, p.sedimentationWeirNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } p.ResizeStructureSets(p.tBarNumber, p.bridgePierNumber, p.groundsillWorkNumber, p.sedimentationWeirNumber); StructureSetForm form = new StructureSetForm(); form.SetFormMode(structureSetGrp.Text, (p.tBarSet) ? p.tBarNumber : 0, tBarSetChk.Text, (p.bridgePierSet) ? p.bridgePierNumber : 0, bridgePierSetChk.Text, (p.groundsillWorkSet) ? p.groundsillWorkNumber : 0, groundsillWorkSetChk.Text, (p.sedimentationWeirSet) ? p.sedimentationWeirNumber : 0, sedimentationWeirSetChk.Text); DialogResult r = form.ShowDialog(); NoticeStructureChange(); structFirstSetting = true; }
public static bool SaveProject(RiverSimulationProfile p) { if (p == null) { return(false); } RiverSimulationProfile.SerializeBinary(p, Program.GetProjectFileFullPath()); return(true); }
private void UpdateSelectedGroup(List <Point> pts, bool alert = false) { RiverSimulationProfile p = RiverSimulationProfile.profile; int index = listBox.SelectedIndex; int type = -1, count = 0; StructureSetUtility.CalcTypeCount(index, ref type, ref count, typeIndex); p.UpdateStructureSet(pts, type, count); mapPicBox.SetSelectedGrid(p.tBarSets, p.bridgePierSets, p.groundsillWorkSets, p.sedimentationWeirSets, type, count, alert); }
public static List <Point> GetStructureSet(RiverSimulationProfile profile, int type, int index) { List <Point>[] pts = GetStructureSets(profile, type); if (pts == null) { return(null); } else { return(pts[index]); } }
//檢查一群組是否與都位於空白處(不屬於任何群組) public static bool IsAllInEmpty(RiverSimulationProfile profile, List <Point> pl, int passType, int passIndex) { foreach (Point p in pl) { for (int n = 0; n < (int)RiverSimulationProfile.StructureType.StructureTypeSize; ++n) { List <Point>[] pts = null; switch (n) { case 0: pts = profile.tBarSets; break; case 1: pts = profile.bridgePierSets; break; case 2: pts = profile.groundsillWorkSets; break; case 3: pts = profile.sedimentationWeirSets; break; default: break; } if (null == pts) { continue; } for (int i = 0; i < pts.Length; ++i) { List <Point> ppl = pts[i]; if (i == passIndex || ppl == null) { continue; } if (ppl.Contains(p)) { return(false); } } } } return(true); }
private void SetPicBoxGrid(int index, bool alert) { RiverSimulationProfile p = RiverSimulationProfile.profile; mapPicBox.SelectGroup = true; if (onlySelectMode) { return; } int type = -1, count = 0; StructureSetUtility.CalcTypeCount(index, ref type, ref count, typeIndex); mapPicBox.SetSelectedGrid(p.tBarSets, p.bridgePierSets, p.groundsillWorkSets, p.sedimentationWeirSets, type, count, alert); }
private void selInputBtn_Click(object sender, EventArgs e) { RiverSimulationProfile p = RiverSimulationProfile.profile; StructureSetForm form = new StructureSetForm(); form.SetFormMode(selInputBtn.Text, -1, "", -1, "", -1, "", -1, ""); DialogResult r = form.ShowDialog(); if (DialogResult.OK == r) { foreach (Point pt in form.selectedPl) { dataGridView[pt.Y, pt.X].Value = form.selectedValue; } } }
public static void EditBottomElevation(RiverSimulationProfile profile, string title, int type, int index) { TableInputForm form = new TableInputForm(); form.SetFormMode(title, profile.inputGrid.GetJ, profile.inputGrid.GetI, "", "", "", TableInputForm.InputFormType.BottomElevationForm, 90, 120, true, false, false, profile.inputGrid.inputCoor); form.SetFormModeExtraData(GetStructureSet(profile, type, index)); DialogResult r = form.ShowDialog(); if (DialogResult.OK == r) { //p.levelProportion = (double[])form.SeparateData().Clone(); //ShowGridMap(PicBoxType.Sprate); //DrawPreview(); } }
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 UpdateStatus() { RiverSimulationProfile p = RiverSimulationProfile.profile;; if (p == null) { return; } //RiverSimulationProfile p = RiverSimulationProfile.profile; Color FinishedButton = Color.LimeGreen; Color ReadyButton = Color.Gold; Color DisableButton = Color.FromArgb(255, 174, 201); //20141117 客製化 sampleFinishedBtn.BackColor = FinishedButton; sampleReadyBtn.BackColor = ReadyButton; sampleDisableBtn.BackColor = DisableButton; //importBtn.BackColor = (p.IsImportFinished()) ? FinishedButton : (p.IsImportReady()) ? ReadyButton : DisableButton; //simulationModuleBtn.BackColor = (p.IsSimulationModuleFinished()) ? FinishedButton : (p.IsSimulationModuleReady()) ? ReadyButton : DisableButton; simulationModuleBtn.BackColor = (p.IsSimulationModuleFinished()) ? FinishedButton : (p.IsSimulationModuleReady()) ? ReadyButton : DisableButton; importBtn.BackColor = (p.IsImportFinished()) ? FinishedButton : (p.IsImportReady()) ? ReadyButton : DisableButton; waterModelingBtn.BackColor = (p.IsWaterModelingFinished()) ? FinishedButton : (p.IsWaterModelingReady()) ? ReadyButton : DisableButton; movableBedBtn.BackColor = (p.IsMovableBedFinished()) ? FinishedButton : (p.IsMovableBedReady()) ? ReadyButton : DisableButton; //movableBedBtn.Enabled = p.IsMovableBedReady(); initialConditionsBtn.BackColor = (p.IsInitialConditionsFinished()) ? FinishedButton : (p.IsInitialConditionsReady()) ? ReadyButton : DisableButton; //initialConditionsBtn.Enabled = p.IsInitialConditionsReady(); boundaryConditionsBtn.BackColor = (p.IsBoundaryConditionsFinished()) ? FinishedButton : (p.IsBoundaryConditionsReady()) ? ReadyButton : DisableButton; //boundaryConditionsBtn.Enabled = p.IsBoundaryConditionsReady(); runSimulationBtn.BackColor = (p.IsRunSimulationFinished()) ? FinishedButton : (p.IsRunSimulationReady()) ? ReadyButton : DisableButton; //runSimulationBtn.Enabled = p.IsRunSimulationReady(); simulationResultBtn.BackColor = (p.IsSimulationResultFinished()) ? FinishedButton : (p.IsSimulationResultReady()) ? ReadyButton : DisableButton; //simulationResultBtn.Enabled = p.IsSimulationResultReady(); }
public void SetFormMode(string title, int colCount, int rowCount, string tableName = "", string colName = "", string rowName = "", int colWidth = 48, int rowHeadersWidth = 64, bool onlyTable = true, bool nocolNum = false, bool noRowNum = false, object initData = null) { hideSingle = onlyTable; this.colCount = colCount; this.rowCount = rowCount; this.title = title; this.tableName = tableName; this.colName = colName; this.rowName = rowName; this.nocolNum = nocolNum; this.noRowNum = noRowNum; this.colWidth = colWidth; this.rowHeadersWidth = rowHeadersWidth; this.inputFormType = inputFormType; this.inputData = initData as RiverSimulationProfile.SideFlowObject; this.p = RiverSimulationProfile.profile; tabControl.Enabled = true; CreateData(inputData.flowData); }
public static bool OpenProjectFile(IWin32Window w, string projectPath) { OpenFileDialog dlg = new OpenFileDialog(); dlg.RestoreDirectory = true; dlg.InitialDirectory = Program.GetProjectFullPath(); dlg.Title = "開啟檔案"; // Set filter for file extension and default file extension dlg.Filter = "resed file|" + Program.projectFileFilter; string projectFile; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK && dlg.FileName != null) { // Open document projectFile = dlg.FileName; if (Path.GetDirectoryName(projectFile) != Program.GetProjectFullPath()) { MessageBox.Show("請選取專案目錄內的檔案!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } Program.projectFileName = Path.GetFileNameWithoutExtension(projectFile); } else { return(false); } try { RiverSimulationProfile.profile = RiverSimulationProfile.DeSerialize(projectFile); RiverSimulationProfile.profile.ResetGoogleStaticMap(); } catch { return(false); } return(true); }
public static void InitialGridPictureBoxByProfile(ref PictureBoxCtrl.GridPictureBox gp, RiverSimulationProfile p) { RiverSimulationProfile.BackgroundMapType t = p.GetBackgroundMapType(); if (RiverSimulationProfile.profile.inputGrid != null) { gp.Grid = p.inputGrid; } if (RiverSimulationProfile.BackgroundMapType.ImportImage == t) { gp.SetMapBackground(p.imagePath, p.sourceE, p.sourceN, p.sourceW, p.sourceH); } else if (RiverSimulationProfile.BackgroundMapType.GoogleStaticMap == t) { gp.SetMapBackground(p.tl, p.tr, p.bl, p.br); } else //if (RiverSimulationProfile.BackgroundMapType.None == t) { gp.ClearMapBackground(); } }
public void SetForm(RiverSimulationProfile profile) { p = profile; }
private void FillDataGrid(List <Point> newPl = null, bool alert = false, bool fillZ = false) { RiverSimulationProfile p = RiverSimulationProfile.profile; var rg = p.inputGrid; int type = 0, count = 0; StructureSetUtility.CalcTypeCount(selIndex, ref type, ref count, typeIndex); Point pt = new Point(); for (int i = 0; i < rg.GetI; ++i) { for (int j = 0; j < rg.GetJ; ++j) { pt.X = i; pt.Y = j; Point grpId = StructureSetUtility.WhichGroup(p, pt, newPl, (newPl == null) ? -1 : type, (newPl == null) ? -1 : count); Color cr; if (grpId.X == -1 && grpId.Y == -1) { //空白處 cr = Color.White; if (fillZ) { dataGv[j, i].Value = p.inputGrid.inputCoor[i, j].z.ToString(); dataGv[j, i].ReadOnly = true; } else { dataGv[j, i].Value = ""; dataGv[j, i].ReadOnly = true; } } else if (grpId.X == type && grpId.Y == count) { //被選取的結構物 cr = (alert) ? alertColor : selectedColor; if (fillZ) { dataGv[j, i].Value = p.inputGrid.inputCoor[i, j].z.ToString(); dataGv[j, i].ReadOnly = false; } else { dataGv[j, i].Value = structureName[grpId.X] + (grpId.Y + 1).ToString(); dataGv[j, i].ReadOnly = true; } } else { //其他結構物 cr = colorTable[grpId.X % colorTable.Length]; if (fillZ) { dataGv[j, i].Value = p.inputGrid.inputCoor[i, j].z.ToString(); dataGv[j, i].ReadOnly = false; } else { dataGv[j, i].Value = structureName[grpId.X] + (grpId.Y + 1).ToString(); dataGv[j, i].ReadOnly = true; } } dataGv[j, i].Style.BackColor = cr; } } }
private void mapPicBox_SelectedGroupChangedEvent(List <Point> pl) { RiverSimulationProfile p = RiverSimulationProfile.profile; int index = listBox.SelectedIndex; if (onlySelectMode) { InputForm dlg = new InputForm(); dlg.Text = "填入數值"; dlg.desc.Text = "請輸入數值"; dlg.inputTxt.Text = ""; if (DialogResult.OK != dlg.ShowDialog()) { return; } selectedPl = new List <Point>(pl); selectedValue = dlg.inputTxt.Text; this.DialogResult = DialogResult.OK; this.Close(); return; } int type = -1, count = 0; StructureSetUtility.CalcTypeCount(index, ref type, ref count, typeIndex); //檢查連續 if (!StructureSetUtility.IsContinuous(pl)) { UpdateSelectedGroup(pl, true); MessageBox.Show("請圈選連續區域!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); UpdateSelectedGroup(null); return; } //檢查重疊 for (int n = 0; n < StructureTypeNumber; ++n) { bool overlapping = false; switch (n) { case 0: overlapping = CheckOverlapping(pl, p.tBarSets, (n == type) ? count : -1); break; case 1: overlapping = CheckOverlapping(pl, p.bridgePierSets, (n == type) ? count : -1); break; case 2: overlapping = CheckOverlapping(pl, p.groundsillWorkSets, (n == type) ? count : -1); break; case 3: overlapping = CheckOverlapping(pl, p.sedimentationWeirSets, (n == type) ? count : -1); break; default: break; } if (!overlapping) { 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); }
private void CreateData(Object d) { RiverSimulationProfile p = RiverSimulationProfile.profile; RiverSimulationProfile.TwoInOne o = d as RiverSimulationProfile.TwoInOne; RiverSimulationProfile.TwoInOne _d = null; //第1, 3種:亞臨界流、均一值/逐點給、定量流 if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow && p.IsConstantFlowType()) { if (d == null) { _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue); _d = _data as RiverSimulationProfile.TwoInOne; } else { _data = new RiverSimulationProfile.TwoInOne(o); _d = _data as RiverSimulationProfile.TwoInOne; } if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue) { colCount = 2; rowCount = 1; _inputFormType = InputFormType.Type1; tabPage1.Parent = tabControl; tabPage2.Parent = null; tabPage3.Parent = null; tabPage1.Text = ""; if (_d.ValueNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount); } } else { colCount = inputData.sideFlowPoints.Count; rowCount = 1; _inputFormType = InputFormType.Type3; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = null; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; if (_d.ArrayNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2); } } } //第2, 4種:亞臨界流、均一值/逐點給、變量流 else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow && p.IsVariableFlowType()) { if (d == null) { _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue); _d = _data as RiverSimulationProfile.TwoInOne; } else { _data = new RiverSimulationProfile.TwoInOne(o); _d = _data as RiverSimulationProfile.TwoInOne; } if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue) { colCount = 1; rowCount = p.boundaryTime.Length; _inputFormType = InputFormType.Type2; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = null; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; if (_d.ValueNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 2); } } else { colCount = inputData.sideFlowPoints.Count; rowCount = p.boundaryTime.Length; _inputFormType = InputFormType.Type4; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = null; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; if (_d.ArrayNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2); } } } //第5, 7種:超臨界流、均一值/逐點給、定量流 else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow && p.IsConstantFlowType()) { if (d == null) { _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue); _d = _data as RiverSimulationProfile.TwoInOne; } else { _data = new RiverSimulationProfile.TwoInOne(o); _d = _data as RiverSimulationProfile.TwoInOne; } if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue) { colCount = 3; rowCount = 1; _inputFormType = InputFormType.Type5; tabPage1.Parent = tabControl; tabPage2.Parent = null; tabPage3.Parent = null; tabPage1.Text = ""; if (_d.ValueNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount); } } else { colCount = inputData.sideFlowPoints.Count; rowCount = 1; _inputFormType = InputFormType.Type7; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = tabControl; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; tabPage3.Text = "水位(m)"; if (_d.ArrayNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3); } } } //第6, 8種:超臨界流、均一值/逐點給、變量流 else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow && p.IsVariableFlowType()) { if (d == null) { _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue); _d = _data as RiverSimulationProfile.TwoInOne; } else { _data = new RiverSimulationProfile.TwoInOne(o); _d = _data as RiverSimulationProfile.TwoInOne; } if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue) { colCount = 1; rowCount = p.boundaryTime.Length; _inputFormType = InputFormType.Type6; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = tabControl; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; tabPage3.Text = "水位(m)"; if (_d.ValueNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 3); } } else { colCount = inputData.sideFlowPoints.Count; rowCount = p.boundaryTime.Length; _inputFormType = InputFormType.Type8; tabPage1.Parent = tabControl; tabPage2.Parent = tabControl; tabPage3.Parent = tabControl; tabPage1.Text = "主流方向流量(cms)"; tabPage2.Text = "側方向流量(cms)"; tabPage3.Text = "水位(m)"; if (_d.ArrayNull()) { (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3); } } } }
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); }
private void ImportTableForm_Load(object sender, EventArgs e) { if (hideGenerate) { yGridNum.Text = gridData.GetI.ToString(); xGridNum.Text = gridData.GetJ.ToString(); yGridNum.Enabled = false; xGridNum.Enabled = false; generateGridBtn.Enabled = false; tabControl.Enabled = true; DataGridViewUtility.InitializeDataGridView(dataGridViewX, colCount, rowCount, 96); DataGridViewUtility.InitializeDataGridView(dataGridViewY, colCount, rowCount, 96); DataGridViewUtility.InitializeDataGridView(dataGridViewZ, colCount, rowCount, 96); foreach (DataGridViewColumn column in dataGridViewX.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewColumn column in dataGridViewY.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewColumn column in dataGridViewZ.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } FillDataGridView(); RiverSimulationProfile p = RiverSimulationProfile.profile; if (null != p.tBarSets) { foreach (List <Point> pl in p.tBarSets) { if (pl == null) { continue; } foreach (Point pt in pl) { dataGridViewZ[pt.Y, pt.X].ReadOnly = true; dataGridViewZ[pt.Y, pt.X].Value = "99999999"; dataGridViewZ[pt.Y, pt.X].Style.BackColor = Color.LightGray; } } } if (null != p.bridgePierSets) { foreach (List <Point> pl in p.bridgePierSets) { if (pl == null) { continue; } foreach (Point pt in pl) { dataGridViewZ[pt.Y, pt.X].ReadOnly = true; dataGridViewZ[pt.Y, pt.X].Value = "99999999"; dataGridViewZ[pt.Y, pt.X].Style.BackColor = Color.LightGray; } } } if (null != p.groundsillWorkSets) { foreach (List <Point> pl in p.groundsillWorkSets) { if (pl == null) { continue; } foreach (Point pt in pl) { dataGridViewZ[pt.Y, pt.X].ReadOnly = true; dataGridViewZ[pt.Y, pt.X].Style.BackColor = Color.LightGray; } } } if (null != p.sedimentationWeirSets) { foreach (List <Point> pl in p.sedimentationWeirSets) { foreach (Point pt in pl) { dataGridViewZ[pt.Y, pt.X].ReadOnly = true; dataGridViewZ[pt.Y, pt.X].Style.BackColor = Color.LightGray; } } } //p.tBarSets, p.bridgePierSets, p.groundsillWorkSets, p.sedimentationWeirSets } }
public void SetFormMode(FormType t, string title, string colName, int colCount, int rowCount, RiverSimulationProfile profile, object initData = null) { this.formType = t; this.p = profile; this.title = title; this.colCount = colCount; this.iTitle = colName; //this.rowCount = rowCount; if (formType == FormType.FlowQuantity || formType == FormType.WaterLevel) { if (p.IsVariableFlowType()) { this.iStart = 1; this.jStart = 1; this.rowCount = rowCount; this.extraCol = (formType == FormType.FlowQuantity) ? 2 : 1; } else { this.iStart = 0; this.jStart = 1; this.rowCount = 1; this.extraCol = 1; } if (formType == FormType.FlowQuantity) { type1Btn.Text = "均勻入流"; type2Btn.Text = "非均勻入流"; } else { type1Btn.Text = "均一值"; type2Btn.Text = "逐點給"; } } else if (formType == FormType.BottomBedLoadFlux) { if (p.IsVariableFlowType()) { this.iStart = 1; this.jStart = 1; this.rowCount = rowCount; this.extraCol = 2; this.extraRow = 2; } else { this.iStart = 0; this.jStart = 1; this.rowCount = 1; this.extraCol = 2; this.extraRow = 2; } this.colCount = (p.sedimentParticlesNumber > p.inputGrid.GetJ) ? p.sedimentParticlesNumber : p.inputGrid.GetJ; } else if (formType == FormType.DepthAverageConcentration) { this.iStart = 1; this.jStart = 2; this.rowCount = rowCount; this.extraCol = 2; this.extraRow = 4; this.colCount = (p.sedimentParticlesNumber > p.inputGrid.GetJ) ? p.sedimentParticlesNumber : p.inputGrid.GetJ; } CreateData(initData); }