| | |
| | | using Yw.Ahart; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace Yw.WinFrmUI.Phart |
| | | { |
| | |
| | | this.gridView1.SetDefaultEditView(); |
| | | this.gridView1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; |
| | | |
| | | this.repImgCmbFeatType.Items.Add("穿过点", Yw.Ahart.eFeatType.Through, -1); |
| | | this.repImgCmbFeatType.Items.Add("穿过点", Yw.Ahart.eFeatType.Through, -1); |
| | | this.repImgCmbFeatType.Items.Add("二次拟合", Yw.Ahart.eFeatType.Quadratic, -1); |
| | | this.repImgCmbFeatType.Items.Add("三次拟合", Yw.Ahart.eFeatType.Cubic, -1); |
| | | this.repImgCmbFeatType.Items.Add("四次拟合", Yw.Ahart.eFeatType.Quartic, -1); |
| | |
| | | { |
| | | this.gridView1.FocusedRowHandle = index; |
| | | }; |
| | | |
| | | this.Enabled = false; |
| | | } |
| | | |
| | | |
| | |
| | | this.colX.Caption = axis_x_title; |
| | | this.colY.Caption = axis_y_title; |
| | | |
| | | this.universalEditChart1.AxisXTitle = axis_x_title; |
| | | this.universalEditChart1.AxisYTitle = axis_y_title; |
| | | this.universalEditChart1.AxisXTitle = axis_x_title; |
| | | this.universalEditChart1.AxisYTitle = axis_y_title; |
| | | |
| | | this.barEditModel.EditValue = 0; |
| | | this.barFeatType.EditValue = _feat_type; |
| | | this.bindingSource1.DataSource = _def_pt_list; |
| | | this.bindingSource1.ResetBindings(false); |
| | | this.Enabled = true; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (def_pt_list == null || def_pt_list.Count < 4) |
| | | { |
| | | this.universalEditChart1.Clear(); |
| | | this.universalEditChart1.Clear(); |
| | | return; |
| | | } |
| | | var fit_pt_list = def_pt_list.GetPointList(feat_type); |
| | |
| | | private void barEditModel_EditValueChanged(object sender, EventArgs e) |
| | | { |
| | | var index = (int)this.barEditModel.EditValue; |
| | | this.universalEditChart1.MouseModel = index == 0; |
| | | this.universalEditChart1.MouseModel = index == 0; |
| | | } |
| | | |
| | | //添加点 |
| | |
| | | private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_def_pt_list == null || !_def_pt_list.Any()) |
| | | return; |
| | | return; |
| | | var row = this.gridView1.GetCurrentViewModel(_def_pt_list); |
| | | if (row == null) |
| | | return; |
| | | return; |
| | | var count = _def_pt_list.Count - 1; |
| | | switch (_feat_type) |
| | | { |
| | | case Ahart.eFeatType.Cubic: |
| | | { |
| | | if (count < 4) |
| | | { |
| | | TipFormHelper.ShowInfo("点数少于4个点"); |
| | | return; |
| | | } |
| | | } |
| | | break; |
| | | case Ahart.eFeatType.Through: |
| | | { |
| | | if (count < 1) |
| | | { |
| | | TipFormHelper.ShowInfo("点数少于1个点"); |
| | | return; |
| | | } |
| | | } |
| | | break; |
| | | case Ahart.eFeatType.Quadratic: |
| | | { |
| | | if (count < 3) |
| | | { |
| | | TipFormHelper.ShowInfo("点数少于3个点"); |
| | | return; |
| | | } |
| | | } |
| | | break; |
| | | case Ahart.eFeatType.Quartic: |
| | | { |
| | | if (count < 5) |
| | | { |
| | | TipFormHelper.ShowInfo("点数少于5个点"); |
| | | return; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | var bol = PhartVerifyHelper.VerifyCount(_feat_type, count); |
| | | if (!bol) |
| | | return; |
| | | |
| | | _def_pt_list.Remove(row); |
| | | this.bindingSource1.ResetBindings(false); |
| | | SetChart(_feat_type, _def_pt_list); |
| | | } |
| | | |
| | | //粘贴板覆盖 |
| | | private void barBtnPastePlateCovering_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (!ClipboardCurveTextUIHelper.CopyDouble(out List<List<double?>> list)) |
| | | return; |
| | | if (list == null || list.Count < 1) |
| | | return; |
| | | if (list.Count != 2) |
| | | { |
| | | TipFormHelper.ShowError("数据不完整"); |
| | | return; |
| | | } |
| | | var cell_count = list.Count; |
| | | var min_row_count = list.Min(x => x.Count); |
| | | var pt_list = new List<Yw.Geometry.Point2d>(min_row_count); |
| | | for (int i = 0; i < min_row_count; i++) |
| | | { |
| | | var x = list[0][i]; |
| | | var y = list[1][i]; |
| | | if (x.HasValue && y.HasValue) |
| | | { |
| | | pt_list.Add(new Geometry.Point2d(x.Value, y.Value)); |
| | | } |
| | | } |
| | | |
| | | var bol = PhartVerifyHelper.VerifyCount(_feat_type, pt_list.Count); |
| | | if (!bol) |
| | | return; |
| | | _def_pt_list.Clear(); |
| | | _def_pt_list.AddRange(pt_list); |
| | | this.bindingSource1.ResetBindings(false); |
| | | SetChart(_feat_type, _def_pt_list); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取数据 |
| | |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | |
| | | } |
| | | |