public AnalogSamplesControl(C3DFile file, Int32 cid)
        {
            InitializeComponent();

            this.tcMain.SelectedIndex  = _currentTab;
            this.mnuShowMarker.Checked = _showMarker;

            this.LoadData(file, cid);
        }
Beispiel #2
0
        private void CloseFile()
        {
            this._currentFileName = null;
            this._currentFile     = null;
            this.Text             = MainForm.PROGRAM_TITLE;

            this.scMain.Panel2.Controls.Clear();
            this.Items.Nodes.Clear();
        }
Beispiel #3
0
        internal static TreeNode GetOverviewNode(C3DFile file)
        {
            TreeNode overviewNode = new TreeNode("Overview")
            {
                Tag = "OVERVIEW"
            };

            return(overviewNode);
        }
        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();
        }
Beispiel #5
0
        private void LoadData(C3DFile file)
        {
            if (file == null)
            {
                return;
            }

            if (file.Parameters != null && file.Parameters.Count > 0)
            {
                foreach (C3DParameterGroup group in file.Parameters)
                {
                    this.lvItems.Items.Add(new ListViewItem(new String[] { group.ID.ToString(), group.Name, group.Description }));
                }
            }
        }
Beispiel #6
0
        internal static TreeNode GetHeaderNode(C3DFile file)
        {
            TreeNode headerNode = new TreeNode("Header")
            {
                Tag = "HEADER"
            };
            TreeNode headerEventNode = new TreeNode("Events")
            {
                Tag = "EVENTS"
            };

            headerNode.Nodes.Add(headerEventNode);

            return(headerNode);
        }
Beispiel #7
0
        private void LoadData(C3DFile file)
        {
            if (file == null)
            {
                return;
            }

            C3DHeaderEvent[] events = file.Header.GetAllHeaderEvents();
            if (events != null && events.Length > 0)
            {
                for (Int32 i = 0; i < events.Length; i++)
                {
                    this.lvItems.Items.Add(new ListViewItem(new String[] { events[i].EventName, events[i].EventTime.ToString(), events[i].IsDisplay.ToString() }));
                }
            }
        }
Beispiel #8
0
        private void OpenFile(String filePath)
        {
            try
            {
                this._currentFileName = filePath;
                this._currentFile     = C3DFile.LoadFromFile(this._currentFileName);
                this.Text             = String.Format("{0} - {1}", this._currentFileName, MainForm.PROGRAM_TITLE);

                this.scMain.Panel2.Controls.Clear();
                this.ShowTreeList();
            }
            catch (Exception ex)
            {
                this.CloseFile();
                MessageBox.Show(String.Format("Error: {0}", ex.Message), MainForm.PROGRAM_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Beispiel #9
0
        private void LoadData(C3DFile file, Int32 type, String name)
        {
            if (file == null)
            {
                return;
            }

            if (type == 0)
            {
                C3DParameterGroup group = file.Parameters.GetGroup(name);
                this.ShowParameterGroup(group);
            }
            else if (type == 1)
            {
                C3DParameter param = file.Parameters[name];
                this.ShowParameter(param);
            }
        }
Beispiel #10
0
        public Point3DControl(C3DFile file, Int32 pid)
        {
            InitializeComponent();

            this.tcMain.SelectedIndex    = _currentTab;
            this.mnuShowResidual.Checked = _showResidual;
            this.mnuShowMarker.Checked   = _showMarker;

            this._charts = new Chart[4] {
                this.chartX, this.chartY, this.chartZ, this.chartResidual
            };
            this._points = new Dictionary <Int32, Single> [4];
            this._status = new ChartScaleStatus[4];

            this._file = file;
            this._pid  = pid;
            this.LoadData(true);
        }
Beispiel #11
0
        private void LoadData(C3DFile file)
        {
            if (file == null)
            {
                return;
            }

            C3DParameterCache parameterCache = C3DParameterCache.CreateCache(file);

            this.lvItems.Items.Add(new ListViewItem(new String[] { "File Format", file.CreateProcessorType.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Number Format", parameterCache.ScaleFactor > 0 ? "Integer" : "Float" }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Count", parameterCache.FrameCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Rate", parameterCache.FrameRate.ToString() + " FPS" }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Duration", ((Double)parameterCache.FrameCount / (Double)parameterCache.FrameRate).ToString("F3") + " s" }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "3D Point Count", parameterCache.PointCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Channel Count", parameterCache.AnalogChannelCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Samples Per Frame", parameterCache.AnalogSamplesPerFrame.ToString() }));
        }
Beispiel #12
0
        private void LoadData(C3DFile file)
        {
            if (file == null)
            {
                return;
            }

            this.lvItems.Items.Add(new ListViewItem(new String[] { "Point Count", file.Header.PointCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "First Frame Index", file.Header.FirstFrameIndex.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Last Frame Index", file.Header.LastFrameIndex.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Scale Factor", file.Header.ScaleFactor.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Frame Rate", file.Header.FrameRate.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Measurement Count", file.Header.AnalogMeasurementCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Analog Samples Per Frame", file.Header.AnalogSamplesPerFrame.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Max Interpolation Gaps", file.Header.MaxInterpolationGaps.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Has Lable Range Data", file.Header.HasLableRangeData.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Header Events Count", file.Header.HeaderEventsCount.ToString() }));
            this.lvItems.Items.Add(new ListViewItem(new String[] { "Supports 4-Chars Event Label", file.Header.IsSupport4CharsLabel.ToString() }));
        }
Beispiel #13
0
        private void LoadData(C3DFile file)
        {
            if (file == null)
            {
                return;
            }

            UInt16 pointCount = (file.Parameters != null && file.Parameters.ContainsParameter("POINT", "USED") ? file.Parameters["POINT", "USED"].GetData <UInt16>() : file.Header.PointCount);

            String[] labels       = C3DParameterHelper.LoadFromParameterArray <String>(file.Parameters["POINT", "LABELS"], pointCount);
            String[] descriptions = C3DParameterHelper.LoadFromParameterArray <String>(file.Parameters["POINT", "DESCRIPTIONS"], pointCount);

            for (Int32 i = 0; i < pointCount; i++)
            {
                this.lvItems.Items.Add(new ListViewItem(new String[] {
                    (i + 1).ToString(),
                    (labels != null && labels.Length > i ? labels[i].TrimEnd() : ""),
                    (descriptions != null && descriptions.Length > i ? descriptions[i].TrimEnd() : "")
                }));
            }
        }
Beispiel #14
0
        private void Create_Btn_Click(object sender, EventArgs e)
        {
            var Log = "正在创建C3D对象...";

            Debug += DateTime.Now + ":" + Log + "\r\n\r\n";
            C3DFile file = C3DFile.Create();//创建C3D对象

            Log    = "正在录入动作捕捉点数据...";
            Debug += DateTime.Now + ":" + Log + "\r\n\r\n";
            for (int n = 0; n < MOCAP_FRAMES.Count; n++)//时间序列
            {
                C3DPoint3DData[] c3DPoints = new C3DPoint3DData[POINTS_COUNT];
                var Points = MOCAP_FRAMES[n];
                for (int i = 0; i < POINTS_COUNT; i++)//节点数
                {
                    C3DPoint3DData point3DData = new C3DPoint3DData()
                    {
                        X = (float)Points[i].X * (float)SCALE, Y = (float)Points[i].Y * (float)SCALE, Z = (float)Points[i].Z * (float)SCALE, Residual = 0, CameraMask = 0
                    };
                    c3DPoints[i] = point3DData;
                }
                C3DFrame c3DFrame = new C3DFrame(c3DPoints);
                file.AllFrames.Add(c3DFrame);
            }
            Log    = "正在设置头信息...";
            Debug += DateTime.Now + ":" + Log + "\r\n\r\n";
            file.Header.PointCount           = (ushort)POINTS_COUNT;
            file.Header.FirstFrameIndex      = 1;
            file.Header.LastFrameIndex       = (ushort)(MOCAP_FRAMES.Count - 1);
            file.Header.IsSupport4CharsLabel = false;
            file.Parameters.SetGroup(1, "POINT", "");
            file.Parameters[1].Add("FRAMES", "").SetData <Int16>((short)(MOCAP_FRAMES.Count - 1));
            file.Parameters[1].Add("USED", "").SetData <Int16>((short)POINTS_COUNT);
            Log    = "正在保存到C3D文件...";
            Debug += DateTime.Now + ":" + Log + "\r\n\r\n";
            file.SaveTo(System.AppDomain.CurrentDomain.BaseDirectory + "output.c3d");
            Log    = "保存成功!已在程序根目录下生成'output.c3d'文件!";
            Debug += DateTime.Now + ":" + Log + "\r\n\r\n";
        }
Beispiel #15
0
        internal static TreeNode GetAnalogDataNode(C3DFile file)
        {
            TreeNode treeNode = new TreeNode("Analog Data")
            {
                Tag = "ANALOG"
            };

            String[] labels = (file.Parameters.ContainsParameter("ANALOG", "LABELS") ? file.Parameters["ANALOG", "LABELS"].GetData <String[]>() : null);

            if (file.AllFrames.Count > 0)
            {
                for (Int32 i = 0; i < file.AllFrames[0].AnalogSamples.Length; i++)
                {
                    String   name      = (labels != null && labels.Length > i ? labels[i].TrimEnd() : String.Format("CHANNEL {0}", i.ToString()));
                    TreeNode treePoint = new TreeNode(String.Format("{0}<{1}>", (i + 1).ToString(), name))
                    {
                        Tag = "ANALOG|" + i.ToString()
                    };
                    treeNode.Nodes.Add(treePoint);
                }
            }

            return(treeNode);
        }
Beispiel #16
0
 public EventsControl(C3DFile file)
 {
     InitializeComponent();
     this.LoadData(file);
 }
Beispiel #17
0
 public OverviewControl(C3DFile file)
 {
     InitializeComponent();
     this.LoadData(file);
 }
Beispiel #18
0
 public AnalogLabelsControl(C3DFile file)
 {
     InitializeComponent();
     this.LoadData(file);
 }
Beispiel #19
0
 public ParameterGroupControl(C3DFile file)
 {
     InitializeComponent();
     this.LoadData(file);
 }
Beispiel #20
0
 public ParameterControl(C3DFile file, Int32 type, String name)
 {
     InitializeComponent();
     this.LoadData(file, type, name);
 }