/// <summary> /// Open 3D graph form by index /// </summary> /// <param name="index"></param> public void Open3DGraphForm(int index) { var isopen = false; for (int i = 0; i < this.graph3DList.Count; i++) { if (this.graph3DList[i].Index == index) { this.graph3DList[i].Focus(); isopen = true; break; } } if (isopen) return; Graph3DLib.WayType waytype = Graph3DLib.WayType.LEFT; int angle = 0; if (index == 1) { angle = 180; } else if (index == 2) { waytype = Graph3DLib.WayType.RIGHT; angle = 90; } else if (index == 3) { angle = 90; } var g = new frmGraph3D(this.log, index) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, Top = this.graph3DControllerForm.Top + this.graph3DControllerForm.Height, Left = this.graph3DControllerForm.Left }; g.FormClosed += new FormClosedEventHandler(graph3D_FormClosed); g.Resize += new EventHandler(graph_Resize); g.RotatebyAngle(waytype, angle); this.graph3DList.Add(g); if (this.graph3DList.Count == 1) this.graph3DList[0].OnAnimationCompleted += new frmGraph3D.AnimationCompletedEventHandler(frmGraph3D_OnAnimationCompleted); this.graph3DList[this.graph3DList.Count - 1].SetData(this.dataList[0].ToArray()); this.graph3DList[this.graph3DList.Count - 1].CreateAnimation(); this.graph3DList[this.graph3DList.Count - 1].Show(); this.ArrangeGraphForms(); }
/// <summary> /// フォームロードイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmAnalyzeController_Load(object sender, EventArgs e) { if (this.log != null) this.log.PutLog("frmAnalyzeController.frmAnalyzeController_Load() - 解析制御画面のロードを開始しました。"); try { AppResource.SetControlsText(this); this.mode = this.AnalyzeData.MeasureSetting.Mode; // ラベル表示等 this.lblMode.Text = AppResource.GetString("TXT_MODE" + this.mode.ToString()); if (this.mode == 1) { this.lblSamplingTiming.Visible = false; this.lblSamplingTiming_Title.Visible = false; } else if (this.mode == 2) { this.lblSamplingTiming.Text = CommonLib.CommonMethod.GetSamplingTimingString(this.AnalyzeData.MeasureSetting.SamplingTiming_Mode2); } else if (this.mode == 3) { this.lblSamplingTiming.Text = CommonLib.CommonMethod.GetSamplingTimingString(this.AnalyzeData.MeasureSetting.SamplingTiming_Mode3); } this.lblMeasureStartDateTime.Text = this.AnalyzeData.MeasureData.StartTime.ToString(AppResource.GetString("TXT_DATETIME_FORMAT")); this.lblMeasureEndDateTime.Text = this.AnalyzeData.MeasureData.EndTime.ToString(AppResource.GetString("TXT_DATETIME_FORMAT")); this.lblTrackValueTitle.Visible = this.lblTrackValue.Visible = this.lblScrollValueTitle.Visible = this.lblScrollValue.Visible = SystemSetting.SystemConfig.IsDebugMode; //this.btnPrintScreen.Visible = SystemSetting.SystemConfig.IsDebugMode; int calcCount = 0; bool found = false; // 2Dグラフの設定 for (int i = 0; i < this.AnalyzeData.MeasureSetting.GraphSettingList.Length; i++) { if (this.AnalyzeData.MeasureSetting.GraphSettingList[i] != null && this.AnalyzeData.MeasureSetting.GraphSettingList[i].IsValid) { this.graph2DList[i] = new frmGraph2D(this.log, i) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, CurrentValueLineChanged = Graph2DCurrentValueLineChanged, FormHidden = Graph2DFormHidden }; this.graph2DList[i].OnAppIdleCallBack = this.graph_OnAppIdleCallBack; this.graph2DList[i].ResizeEnd += new EventHandler(this.graph_Resize); this.graph2DList[i].VisibleChanged += new EventHandler(this.graph_Visible); this.graph2DList[i].OnOverShotAxisYZoomed = this.OverShotAxisYZoomed; this.graph2DList[i].OnOverShotMouseDragZoomed = this.OverShotMouseDragZoomed; //get calc tag list if (calcCount < 10) { for (int m = 0; m < 10; m++) { // if (this.AnalyzeData.DataTagSetting.GetTagKind(this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo) == 2) { for (int k = 0; k < calcCount; k++) { if (this.calcTagArray[k] > -1 && this.calcTagArray[k] == this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo) { found = true; break; } } if (!found && calcCount < 10) { this.calcTagArray[calcCount] = this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo; //this.graphGroupIndex[calcCount] = i; //this.graphIndex[calcCount] = m; calcCount++; } found = false; } } } } } // 各種画面の設定 this.tagValueListForm = new frmTagValueList(this.log, this.AnalyzeData) { MdiParent = (Form)this.MdiParent, Top = this.Height, Left = 0 }; this.graphControllerForm = new frmGraphController(this.log) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, Left = 0, GraphFormList = this.graph2DList, GraphZoomInOccurred = this.Graph2DZoomIn, GraphZoomOutOccurred = this.Graph2DZoomOut, GraphArrangeOccurred = this.Graph2DArrange, GraphSettingChanged = this.Graph2SSettingChanged, GraphLineDotChanged = this.Graph2DLineDotChanged }; this.tagValueListForm.PrepareCalculateTag(this.calcTagArray); // スクロールバーの設定 this.trackMain.Visible = (this.mode == 2); // 3D表示画面の設定 if (this.mode == 2) { // Calculate Degree1 and Degree2 with Shot.10 data - 入角度,出角度を計算する(ショット10のデータを使用する) CalculateDegrees(); // 3D制御画面 this.graph3DControllerForm = new frm3DGraphController(this.log, this) { MdiParent = (Form)this.MdiParent, Top = this.Height, Left = this.tagValueListForm.Width }; this.graph3DControllerForm.Graph3DList = this.graph3DList; this.graph3DControllerForm.ControlStateStatus = frm3DGraphController.ControlState.DisableAll; var f = new frmGraph3D(this.log, 0) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, Top = this.graph3DControllerForm.Top + this.graph3DControllerForm.Height, Left = this.graph3DControllerForm.Left }; f.FormClosed += new FormClosedEventHandler(this.graph3D_FormClosed); f.Resize += new EventHandler(this.graph_Resize); this.graph3DList.Add(f); // Mode2 this.trackMain.Minimum = 0; this.trackMain.Maximum = this.AnalyzeData.MeasureData.SamplesCount - 1; // Total Shot this.trackMain.SmallChange = 1; this.trackMain.LargeChange = 1; this.trackMain.Value = 0; this.lblShotMin.Visible = this.lblShotMax.Visible = true; this.lblShotMin.Text = ((int)this.trackMain.Minimum + 1).ToString(); this.lblShotMax.Text = ((int)this.trackMain.Maximum + 1).ToString(); // Mode2の重ね書きショット数で全グラフの中の最大数を求める GetMaxOverShotCountForMode2(); // Show Degree1 and Degree2 as limit of scrollbar - 入角度,出角度をスクロールバーの上下限値として表示する this.lblScrollMin.Text = this.AnalyzeData.ChannelsSetting.ChannelMeasSetting.Degree1.ToString("##0.0"); this.lblScrollMax.Text = this.AnalyzeData.ChannelsSetting.ChannelMeasSetting.Degree2.ToString("##0.0"); // ショット番号を初期化して2Dグラフを更新する ChangeShot(0); isSensorData3D = Check3DSensorAndData(); if (isSensorData3D) { // 自動アニメーション用スレッド生成 if (this.graph3DList.Count > 0) { this.graph3DList[0].OnAnimationCompleted += new frmGraph3D.AnimationCompletedEventHandler(this.frmGraph3D_OnAnimationCompleted); } //this.bw3Dgraph = new BackgroundWorker(); //this.bw3Dgraph.WorkerSupportsCancellation = true; //this.bw3Dgraph.WorkerReportsProgress = false; //this.bw3Dgraph.DoWork += new DoWorkEventHandler(this.bw3DGraph_Animation); //this.bw3Dgraph.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw3DGraph_WorkerCompleted); // 3Dグラフへデータセット if (this.dataList != null && this.dataList.Count > 0 && this.dataList[0] != null) { SetDataToGraph3D(); Create3DAnimation(); this.graph3DControllerForm.ControlStateStatus = frm3DGraphController.ControlState.Stop; } } } else { // Mode1, 3 decimal maxx = 0; if (this.AnalyzeData.MeasureSetting.GraphSettingList[0] != null) { var incx = GetIncrementX(); if (incx == 0) incx = 1; decimal modeval = 0; if (this.mode == 1) modeval = this.AnalyzeData.MeasureSetting.GraphSettingList[0].MaxX_Mode1; else modeval = this.AnalyzeData.MeasureSetting.GraphSettingList[0].MaxX_Mode3; maxx = Convert.ToDecimal((double)modeval / incx); } //mode 1 index is start from 1 var index = 0; var count = 0; if (this.mode == 1) index = 1; else count = 1; this.ScrollSub.Maximum = this.AnalyzeData.MeasureData.SamplesCount - count; this.scaleX = ((int)maxx < this.ScrollSub.Maximum) ? (int)maxx : this.ScrollSub.Maximum; if (this.scaleX == 0) this.scaleX = 1; this.ScrollSub.LargeChange = this.scaleX + count; this.ScrollSub.Minimum = index; this.ScrollSub.Value = index; // Show Low/High limit values of scrollbar - スクロールバーの上下限値を表示する this.lblScrollMin.Text = this.ScrollSub.Minimum.ToString(); this.lblScrollMax.Text = (this.mode == 1) ? this.ScrollSub.Maximum.ToString() : ((int)this.ScrollSub.Maximum * (this.AnalyzeData.MeasureSetting.SamplingTiming_Mode3 / 1000.0)).ToString(); // 2Dグラフを更新する UpdateGraph2D(); } //initial 2D Current line position at start degree for (int i = 0; i < this.graph2DList.Length; i++) { if (this.graph2DList[i] != null) { try { this.graph2DList[i].CurrentLine = this.currentIndex; } catch { } } } // グラフ表示位置調整 ArrangeGraphForms(); //Set maximum size of graph form. this.MdiParent.Resize += new EventHandler(this.frmAnalyzeMain_Resize); SetMaximumGraphArea(null); } catch (Exception ex) { ShowErrorMessage(ex); } // アイコン表示 InitButtonImage(); if (this.log != null) this.log.PutLog("frmAnalyzeController.frmAnalyzeController_Load() - 解析制御画面のロードを終了しました。"); }