Exemple #1
0
        private void ReadEvents()
        {
            if (!_nameToGroups.ContainsKey("EVENT"))
            {
                return; // There are no events in the C3D file
            }

            Int16 contextLength = GetParameter <Int16>("EVENT:USED");

            string[] contexts     = GetParameter <string[]>("EVENT:CONTEXTS");
            string[] labels       = GetParameter <string[]>("EVENT:LABELS");
            string[] descriptions = GetParameter <string[]>("EVENT:DESCRIPTIONS");
            string[] subjects     = GetParameter <string[]>("EVENT:SUBJECTS");
            float[,] times = GetParameter <float[, ]>("EVENT:TIMES");
            Int16[] icon_ids      = GetParameter <Int16[]>("EVENT:ICON_IDS");
            byte[]  generic_flags = GetParameter <byte[]>("EVENT:GENERIC_FLAGS");

            for (int i = 0; i < labels.Length; i++)
            {
                float time  = times[0, i] * 60 + times[1, i];
                int   frame = Int32.Parse((time * _header.FrameRate).ToString());

                C3dEvent c3dEvent = new C3dEvent(labels[i], contexts[i], frame);
                c3dEvent.Description = descriptions[i];
                c3dEvent.Subject     = subjects[i];
                c3dEvent.IconId      = icon_ids[i];
                c3dEvent.GenericFlag = generic_flags[i];

                _events.Add(c3dEvent);
            }
        }
Exemple #2
0
        public void AddEvent(C3dEvent e)
        {
            if (_events == null)
            {
                _events = new List <C3dEvent>();
            }

            if (e.Frame == 0)
            {
                e.Frame = _header.LastSampleNumber;
            }
            _events.Add(e);
        }