public Form1() { InitializeComponent(); CurveControl curve = new CurveControl(); curve.GetCurveURLParameters = GetCurveURLParameters; elementHost1.Child = curve; checkListControl.SetInitialData("http://calm_dev3:7803/PluginsDataFeed/", "197-118-1-1", "02.06.00"); }
private GeometryModel3D BuildYSliceGraphModel() { _ySliceCurveControl = new CurveControl { Width = ProjectedCurveSize, Height = ProjectedCurveSize, YMin = 0, YMax = _zRange, StrokeThickness = 5.0, ShowName = false }; var brush = new VisualBrush(_ySliceCurveControl); var material = new DiffuseMaterial(brush); var normal = new Vector3D(0, -1, 0); var mesh = new MeshGeometry3D { Positions = new Point3DCollection { new Point3D(0, -GraphOffset, 0), new Point3D(1, -GraphOffset, 0), new Point3D(0, -GraphOffset, 1), new Point3D(1, -GraphOffset, 1) }, Normals = new Vector3DCollection { normal, normal, normal, normal }, TriangleIndices = new Int32Collection { 0, 1, 3, 0, 3, 2 }, TextureCoordinates = new PointCollection { new Point(0, ProjectedCurveSize), new Point(ProjectedCurveSize, ProjectedCurveSize), new Point(0, 0), new Point(ProjectedCurveSize, 0), } }; _ySliceModel = new GeometryModel3D(mesh, material) { BackMaterial = material }; return(_ySliceModel); }
private void modeComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { CurveControl newCurveControl; ColorTransferMode colorTransferMode; if (modeComboBox.SelectedIndex >= 0) { colorTransferMode = (ColorTransferMode)colorTransferNames.LocalizedNameToEnumValue(modeComboBox.SelectedItem.ToString()); } else { colorTransferMode = ColorTransferMode.Rgb; } newCurveControl = curveControls[colorTransferMode]; if (curveControl != newCurveControl) { tableLayoutMain.Controls.Remove(curveControl); curveControl = newCurveControl; curveControl.Bounds = new Rectangle(0, 0, 258, 258); curveControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; //curveControl.ResetControlPoints(); tableLayoutMain.SetColumnSpan(this.curveControl, 4); curveControl.Dock = System.Windows.Forms.DockStyle.Fill; curveControl.ValueChanged += curveControlValueChangedDelegate; curveControl.CoordinatesChanged += curveControlCoordinatesChangedDelegate; tableLayoutMain.Controls.Add(curveControl, 0, 2); if (finishTokenOnDropDownChanged) { FinishTokenUpdate(); } int channels = newCurveControl.Channels; maskCheckBoxes = new CheckBox[channels]; this.tableLayoutPanelMask.Controls.Clear(); this.tableLayoutPanelMask.ColumnCount = channels; for (int i = 0; i < channels; ++i) { CheckBox checkbox = new CheckBox(); checkbox.Dock = DockStyle.Fill; checkbox.Checked = curveControl.GetSelected(i); checkbox.CheckedChanged += maskCheckChanged; checkbox.Text = curveControl.GetChannelName(i); checkbox.FlatStyle = FlatStyle.System; this.tableLayoutPanelMask.Controls.Add(checkbox, i, 0); this.tableLayoutPanelMask.ColumnStyles[i].SizeType = SizeType.Percent; this.tableLayoutPanelMask.ColumnStyles[i].Width = 100; maskCheckBoxes[i] = checkbox; } UpdateCheckboxEnables(); } }
/// <summary> /// 绘制曲线函数 /// </summary> public void initCurveControl() { //初始化控制类型,是主控还是远控 DataComponent.InitApplicationStartPath(Application.StartupPath); DataComponent.GetControlType(); //曲线初始化 int rtn = dataComponent.InitCurve(); //数据组件初始化 rtn = dataComponent.Init(); //获取正在测试的监测单元 testingTestUnit = dataComponent.GetAllTestUnit(); //testingTestUnit = dataComponent.GetAllTestingUnit(); //定义子窗口数、坐标系数、传感器数、组数 int subWindowNum, coordinateNum, sensorNum, groupNum; int i, j; subWindowNum = testingTestUnit[0].SubWindowInfo.Length; coordinateNum = testingTestUnit[0].CoordinateInfo.Length; sensorNum = testingTestUnit[0].SensorInfo.Length + testingTestUnit[0].AverageValueList.Count; groupNum = testingTestUnit[0].GroupInfo.Length; //定义一个曲线组件变量 CurveControl curveControl = new CurveControl(); //整个曲线显示组件的窗口初始化 curveControl.IniParentWindow(subWindowNum, coordinateNum, sensorNum, groupNum); //初始化子窗口接口 for (int k1 = 0; k1 < testingTestUnit[0].SubWindowInfo.Length; k1++) { curveControl.IniSubWindow(testingTestUnit[0].SubWindowInfo[k1].SubWindowNo, testingTestUnit[0].SubWindowInfo[k1].Name, testingTestUnit[0].SubWindowInfo[k1].Proportion, testingTestUnit[0].SubWindowInfo[k1].Visible); } //初始化坐标系 List <int> initAllCoor = new List <int>(); for (j = 0; j < coordinateNum; j++) { if (testingTestUnit[0].CoordinateInfo[j].SubWindowNo == subWindowNo) { curveControl.InitCoordinate(testingTestUnit[0].CoordinateInfo[j].CoordinateNo, testingTestUnit[0].CoordinateInfo[j].Name, 1, testingTestUnit[0].CoordinateInfo[j].Visible, testingTestUnit[0].CoordinateInfo[j].HighValue, testingTestUnit[0].CoordinateInfo[j].LowValue, testingTestUnit[0].CoordinateInfo[j].UpLimit, testingTestUnit[0].CoordinateInfo[j].LowLimit, testingTestUnit[0].CoordinateInfo[j].Unit); initAllCoor.Add(testingTestUnit[0].CoordinateInfo[j].CoordinateNo); } } //初始化组信息 for (i = 0; i < testingTestUnit[0].GroupInfo.Count(); i++) { Group oneGroup = new Group(); oneGroup = testingTestUnit[0].GroupInfo[i]; Boolean b = curveControl.SetGroupSelect(oneGroup.GroupNo, true); curveControl.SetGroupName(oneGroup.GroupNo, oneGroup.Name); curveControl.SetGroupStatisticSelect(oneGroup.GroupNo, oneGroup.MaxSelect, oneGroup.MinSelect, oneGroup.AverageSelect, oneGroup.IntegeraveSelect); } //确定传感器是否属于在此窗口内的坐标系 int copyCoordinate = 0; //初始化传感器信息 for (i = 0; i < testingTestUnit[0].SensorInfo.Length; i++) { if (testingTestUnit[0].SensorInfo[i].BeBorrowed == false && testingTestUnit[0].SensorInfo[i].Selected == true) { for (int z1 = 0; z1 < testingTestUnit[0].SensorInfo[i].CoordinateBelong.CoordinateNo.Length; z1++) { if (initAllCoor.Contains(testingTestUnit[0].SensorInfo[i].CoordinateBelong.CoordinateNo[z1])) { copyCoordinate = testingTestUnit[0].SensorInfo[i].CoordinateBelong.CoordinateNo[z1]; break; } } curveControl.IniSensorAttri(testingTestUnit[0].SensorInfo[i].SensorNo, testingTestUnit[0].SensorInfo[i].Name, copyCoordinate, testingTestUnit[0].SensorInfo[i].Visible, testingTestUnit[0].SensorInfo[i].Selected, testingTestUnit[0].SensorInfo[i].TotalSequenceNo, testingTestUnit[0].SensorInfo[i].DotNum); //传感器颜色 curveControl.SetSensorColorNo(testingTestUnit[0].SensorInfo[i].SensorNo, testingTestUnit[0].SensorInfo[i].ColorNo); //设置传感器组号 curveControl.SetSensorGroupNo(testingTestUnit[0].SensorInfo[i].SensorNo, testingTestUnit[0].SensorInfo[i].GroupNo); } } //添加传感器采集时间 List <float> DotHowLong = new List <float>(); float startLong = 0; for (i = 0; i < 500; i++) { startLong = (float)(i * 0.006); DotHowLong.Add(startLong); } curveControl.ReceiveDotHowLong(ref DotHowLong); //添加传感器采集数值 List <float> DotValue = new List <float>(); List <float> DotValue2 = new List <float>(); List <float> DotValue3 = new List <float>(); List <float> DotValue4 = new List <float>(); for (i = 0; i < 500; i++) { DotValue.Add((float)(0 + i * 0.05)); DotValue2.Add((float)(30 - i * 0.05)); DotValue3.Add((float)(50 - i * 0.5)); DotValue4.Add((float)(35 - i * 0.01)); } curveControl.ReceiveValue(1, ref DotValue); curveControl.ReceiveValue(2, ref DotValue); curveControl.ReceiveValue(3, ref DotValue2); curveControl.ReceiveValue(4, ref DotValue3); curveControl.ReceiveValue(15, ref DotValue4); curveControl.EnableScroll(false, this.Height); //语言 curveControl.ChangeLanguage(CurveControl.LanguageType.Chinese); //设置控件内的布局 curveControl.RefreshLayout(); //画出曲线 curveControl.DrawPicCurve(); curveControl.IsFirstListView = false; curvePanel.Controls.Add(curveControl); //this.Controls.Add(curveControl); curveControl.Dock = DockStyle.Fill; }