private void LoadData(C3DFile file, Int32 cid) { if (file == null) { return; } C3DParameterCache cache = C3DParameterCache.CreateCache(file); C3DHeaderEvent[] events = file.Header.GetAllHeaderEvents(); UInt16 firstFrameIndex = file.Header.FirstFrameIndex; UInt16 lastFrameIndex = file.Header.LastFrameIndex; UInt16 samplePerFrame = cache.AnalogSamplesPerFrame; this._points = new Dictionary <Single, Single>(); this._status = new ChartScaleStatus(firstFrameIndex, lastFrameIndex, Single.MaxValue, Single.MinValue); for (Int32 i = 0; i < samplePerFrame; i++) { this.lvItems.Columns.Add(new ColumnHeader() { Text = String.Format("SP {0}", (i + 1).ToString()), Width = 70 }); } for (Int32 i = 0; i < file.AllFrames.Count; i++) { Int32 index = firstFrameIndex + i; C3DAnalogSamples point3D = file.AllFrames[i].AnalogSamples[cid]; for (Int32 j = 0; j < point3D.SampleCount; j++) { this._points[index + (Single)(j) / (Single)(point3D.SampleCount)] = point3D[j]; this._status.Mins[1] = Math.Min(this._status.Mins[1], point3D[j]); this._status.Maxs[1] = Math.Max(this._status.Maxs[1], point3D[j]); } String[] item = new String[file.AllFrames[i].AnalogSamples[cid].SampleCount + 1]; item[0] = (file.Header.FirstFrameIndex + i).ToString(); for (Int32 j = 1; j < item.Length; j++) { item[j] = point3D[j - 1].ToString("F3"); } this.lvItems.Items.Add(new ListViewItem(item)); } this._status.Maxs[0] = (this._status.Maxs[0] == this._status.Mins[0] ? this._status.Maxs[0] + 1 : this._status.Maxs[0]); this._status.Maxs[1] = (this._status.Maxs[1] == this._status.Mins[1] ? this._status.Maxs[1] + 1 : this._status.Maxs[1]); ChartBindingHelper.BindDataToChart <Single, Single>(this.chartView, this._points, this._status.Mins[0], this._status.Maxs[0], this._status.Mins[1], this._status.Maxs[1]); this.ShowStripLine(events, cache.FrameRate); this.SetMarker(); }
private void LoadData(Boolean isFirstLoad) { if (this._file == null) { return; } C3DParameterCache cache = C3DParameterCache.CreateCache(this._file); C3DHeaderEvent[] events = this._file.Header.GetAllHeaderEvents(); UInt16 firstFrameIndex = this._file.Header.FirstFrameIndex; UInt16 lastFrameIndex = this._file.Header.LastFrameIndex; #region 第一次初始化 if (isFirstLoad) { for (Int32 i = 0; i < 4; i++) { this._status[i] = new ChartScaleStatus(firstFrameIndex, lastFrameIndex, Single.MaxValue, Single.MinValue); } this.ShowStripLine(events, cache.FrameRate); this.SetMarker(); } #endregion #region 列表内容填充 for (Int32 i = 0; i < 4; i++) { this._points[i] = new Dictionary <Int32, Single>(); this._status[i].Mins[1] = Single.MaxValue; this._status[i].Maxs[1] = Single.MinValue; this._status[i].Maxs[0] = (this._status[i].Maxs[0] == this._status[i].Mins[0] ? this._status[i].Maxs[0] + 1 : this._status[i].Maxs[0]); this._status[i].Maxs[1] = (this._status[i].Maxs[1] == this._status[i].Mins[1] ? this._status[i].Maxs[1] + 1 : this._status[i].Maxs[1]); } this._status[3].Mins[1] = -1.0F; this._status[3].Maxs[1] = Math.Max(this._status[3].Maxs[1], 1.0F); for (Int32 i = 0; i < this._file.AllFrames.Count; i++) { Int32 index = firstFrameIndex + i; C3DPoint3DData point3D = this._file.AllFrames[i].Point3Ds[this._pid]; if (_showResidual || point3D.Residual > -1) { this._points[0][index] = point3D.X; this._points[1][index] = point3D.Y; this._points[2][index] = point3D.Z; for (Int32 j = 0; j < 3; j++) { this._status[j].Mins[1] = Math.Min(this._status[j].Mins[1], this._points[j][index]); this._status[j].Maxs[1] = Math.Max(this._status[j].Maxs[1], this._points[j][index]); } } this._points[3][index] = point3D.Residual; this._status[3].Maxs[1] = Math.Max(this._status[3].Maxs[1], point3D.Residual); if (isFirstLoad) { this.lvItems.Items.Add(new ListViewItem(new String[] { (index).ToString(), point3D.X.ToString("F3"), point3D.Y.ToString("F3"), point3D.Z.ToString("F3"), point3D.Residual.ToString("F3"), point3D.CameraMaskInfo })); } } #endregion #region 绑定数据 for (Int32 i = 0; i < 4; i++) { ChartBindingHelper.BindDataToChart <Int32, Single>(this._charts[i], this._points[i], this._status[i].Mins[0], this._status[i].Maxs[0], this._status[i].Mins[1], this._status[i].Maxs[1]); } #endregion }