コード例 #1
0
        public void ToXml(XmlTextWriter _xmlWriter, Metadata _ParentMetadata, Point _origin)
        {
            // In addition to the native data (the one that will be used when reading back the trajectory.)
            // we also add the data in user units as attributes.
            // This will be used when exporting to spreadsheet.

            _xmlWriter.WriteStartElement("TrackPosition");

            // Data in user units.
            // - The origin of the coordinates system is given as parameter.
            // - X goes left (same than internal), Y goes up (opposite than internal).
            double userX = _ParentMetadata.CalibrationHelper.GetLengthInUserUnit((double)X - (double)_origin.X);
            double userY = _ParentMetadata.CalibrationHelper.GetLengthInUserUnit((double)_origin.Y - (double)Y);
            string userT = _ParentMetadata.m_TimeStampsToTimecodeCallback(T, TimeCodeFormat.Unknown, false);

            _xmlWriter.WriteAttributeString("UserX", String.Format("{0:0.00}", userX));
            _xmlWriter.WriteAttributeString("UserY", String.Format("{0:0.00}", userY));
            _xmlWriter.WriteAttributeString("UserTime", userT);

            // Native data.
            _xmlWriter.WriteString(X.ToString() + ";" + Y.ToString() + ";" + T.ToString());
            _xmlWriter.WriteEndElement();
        }
コード例 #2
0
        public void ToXmlString(XmlTextWriter _xmlWriter)
        {
            _xmlWriter.WriteStartElement("Keyframe");

            // Position
            _xmlWriter.WriteStartElement("Position");
            string userTime = m_ParentMetadata.m_TimeStampsToTimecodeCallback(m_Position, TimeCodeFormat.Unknown, false);

            _xmlWriter.WriteAttributeString("UserTime", userTime);
            _xmlWriter.WriteString(m_Position.ToString());
            _xmlWriter.WriteEndElement();

            // Title
            _xmlWriter.WriteStartElement("Title");
            _xmlWriter.WriteString(Title);
            _xmlWriter.WriteEndElement();

            _xmlWriter.WriteStartElement("Comment");
            _xmlWriter.WriteString(m_CommentRtf);
            _xmlWriter.WriteEndElement();

            // Drawings
            if (m_Drawings.Count > 0)
            {
                _xmlWriter.WriteStartElement("Drawings");
                foreach (AbstractDrawing drawing in m_Drawings)
                {
                    drawing.ToXmlString(_xmlWriter);
                }
                _xmlWriter.WriteEndElement();
            }


            // </Keyframe>
            _xmlWriter.WriteEndElement();
        }