private void gridControl1_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } var rows = gridView1.GetSelectedRows(); if (rows.Length == 1) { _currentPatch = (VBoundaryPatch)gridControl1.Views[0].GetRow(gridView1.FocusedRowHandle); } else { _currentPatch = (VBoundaryPatch)gridControl1.Views[0].GetRow(rows[0]); } UnbindCurrentPatch(); BindCurrentPatch(); }
private void gridControl1_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle < 0) return; var rows = gridView1.GetSelectedRows(); if (rows.Length == 1) { _currentPatch = (VBoundaryPatch)gridControl1.Views[0].GetRow(gridView1.FocusedRowHandle); } else { _currentPatch = (VBoundaryPatch)gridControl1.Views[0].GetRow(rows[0]); } UnbindCurrentPatch(); BindCurrentPatch(); }
public void UpdateFromProject(VProject vProject) { _vProject = vProject; var path = _fileHandler.GetPath(_vProject.ProjectDir); var data = _fileHandler.Read(path); var d = (Offwind.Sowfa.Time.FieldData.FieldData)data; _model.InternalFieldType = d.InternalFieldType; if (d.FieldClass == FieldClass.volScalarField) { _model.InternalFieldValue1 = d.InternalFieldValue[0]; } else if (d.FieldClass == FieldClass.volVectorField) { _model.InternalFieldValue1 = d.InternalFieldValue[0]; _model.InternalFieldValue2 = d.InternalFieldValue[1]; _model.InternalFieldValue3 = d.InternalFieldValue[2]; } _model.Dimensions.Mass = d.Dimensions.Mass; _model.Dimensions.Length = d.Dimensions.Length; _model.Dimensions.Time = d.Dimensions.Time; _model.Dimensions.Temperature = d.Dimensions.Temperature; _model.Dimensions.Quantity = d.Dimensions.Quantity; _model.Dimensions.Current = d.Dimensions.Current; _model.Dimensions.LuminousIntensity = d.Dimensions.LuminousIntensity; _model.Patches.Clear(); foreach (var p in d.Patches) { var vPatch = new VBoundaryPatch(); vPatch.Name = p.Name; vPatch.PatchType = p.PatchType; vPatch.GradientFieldType = p.GradientFieldType; vPatch.ValueFieldType = p.ValueFieldType; if (d.FieldClass == FieldClass.volScalarField) { vPatch.GradientValue1 = p.GradientValue[0]; vPatch.ValueValue1 = p.ValueValue[0]; } else if (d.FieldClass == FieldClass.volVectorField) { if (p.GradientValue.Length > 0) vPatch.GradientValue1 = p.GradientValue[0]; if (p.GradientValue.Length > 1) vPatch.GradientValue2 = p.GradientValue[1]; if (p.GradientValue.Length > 2) vPatch.GradientValue3 = p.GradientValue[2]; if (p.ValueValue.Length > 0) vPatch.ValueValue1 = p.ValueValue[0]; if (p.ValueValue.Length > 1) vPatch.ValueValue2 = p.ValueValue[1]; if (p.ValueValue.Length > 2) vPatch.ValueValue3 = p.ValueValue[2]; } vPatch.Rho = p.Rho; _model.Patches.Add(vPatch); } if (d.FieldClass == FieldClass.volScalarField) { txtInternalFieldValue2.Visible = false; txtInternalFieldValue3.Visible = false; txtPatchGradientValue2.Visible = false; txtPatchGradientValue3.Visible = false; txtPatchValueValue2.Visible = false; txtPatchValueValue3.Visible = false; } gridView1.FocusedRowHandle = this.gridView1.GetVisibleRowHandle(0); _model.AcceptChanges(); }
public void UpdateFromProject(VProject vProject) { _vProject = vProject; var path = _fileHandler.GetPath(_vProject.ProjectDir); var data = _fileHandler.Read(path); var d = (Offwind.Sowfa.Time.FieldData.FieldData)data; _model.InternalFieldType = d.InternalFieldType; if (d.FieldClass == FieldClass.volScalarField) { _model.InternalFieldValue1 = d.InternalFieldValue[0]; } else if (d.FieldClass == FieldClass.volVectorField) { _model.InternalFieldValue1 = d.InternalFieldValue[0]; _model.InternalFieldValue2 = d.InternalFieldValue[1]; _model.InternalFieldValue3 = d.InternalFieldValue[2]; } _model.Dimensions.Mass = d.Dimensions.Mass; _model.Dimensions.Length = d.Dimensions.Length; _model.Dimensions.Time = d.Dimensions.Time; _model.Dimensions.Temperature = d.Dimensions.Temperature; _model.Dimensions.Quantity = d.Dimensions.Quantity; _model.Dimensions.Current = d.Dimensions.Current; _model.Dimensions.LuminousIntensity = d.Dimensions.LuminousIntensity; _model.Patches.Clear(); foreach (var p in d.Patches) { var vPatch = new VBoundaryPatch(); vPatch.Name = p.Name; vPatch.PatchType = p.PatchType; vPatch.GradientFieldType = p.GradientFieldType; vPatch.ValueFieldType = p.ValueFieldType; if (d.FieldClass == FieldClass.volScalarField) { vPatch.GradientValue1 = p.GradientValue[0]; vPatch.ValueValue1 = p.ValueValue[0]; } else if (d.FieldClass == FieldClass.volVectorField) { if (p.GradientValue.Length > 0) { vPatch.GradientValue1 = p.GradientValue[0]; } if (p.GradientValue.Length > 1) { vPatch.GradientValue2 = p.GradientValue[1]; } if (p.GradientValue.Length > 2) { vPatch.GradientValue3 = p.GradientValue[2]; } if (p.ValueValue.Length > 0) { vPatch.ValueValue1 = p.ValueValue[0]; } if (p.ValueValue.Length > 1) { vPatch.ValueValue2 = p.ValueValue[1]; } if (p.ValueValue.Length > 2) { vPatch.ValueValue3 = p.ValueValue[2]; } } vPatch.Rho = p.Rho; _model.Patches.Add(vPatch); } if (d.FieldClass == FieldClass.volScalarField) { txtInternalFieldValue2.Visible = false; txtInternalFieldValue3.Visible = false; txtPatchGradientValue2.Visible = false; txtPatchGradientValue3.Visible = false; txtPatchValueValue2.Visible = false; txtPatchValueValue3.Visible = false; } gridView1.FocusedRowHandle = this.gridView1.GetVisibleRowHandle(0); _model.AcceptChanges(); }