Esempio n. 1
0
        public void WriteXml(XmlWriter w, SerializationFilter filter)
        {
            if (ShouldSerializeCore(filter))
            {
                w.WriteElementString("Start", XmlHelper.WritePointF(points["a"]));
                w.WriteElementString("End", XmlHelper.WritePointF(points["b"]));

                TypeConverter enumConverter = TypeDescriptor.GetConverter(typeof(TrackExtraData));
                string        xmlExtraData  = enumConverter.ConvertToString(trackExtraData);
                w.WriteElementString("ExtraData", xmlExtraData);

                w.WriteStartElement("MeasureLabel");
                miniLabel.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeStyle(filter))
            {
                w.WriteStartElement("DrawingStyle");
                style.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeFading(filter))
            {
                w.WriteStartElement("InfosFading");
                infosFading.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeAll(filter))
            {
                // Spreadsheet support.
                w.WriteStartElement("Measure");

                PointF a = CalibrationHelper.GetPoint(new PointF(points["a"].X, points["a"].Y));
                PointF b = CalibrationHelper.GetPoint(new PointF(points["b"].X, points["b"].Y));

                float  len            = GeometryHelper.GetDistance(a, b);
                string value          = String.Format("{0:0.00}", len);
                string valueInvariant = String.Format(CultureInfo.InvariantCulture, "{0:0.00}", len);

                w.WriteAttributeString("UserLength", value);
                w.WriteAttributeString("UserLengthInvariant", valueInvariant);
                w.WriteAttributeString("UserUnitLength", CalibrationHelper.GetLengthAbbreviation());

                w.WriteEndElement();
            }
        }
Esempio n. 2
0
        public void WriteXml(XmlWriter w, SerializationFilter filter)
        {
            if (ShouldSerializeCore(filter))
            {
                w.WriteElementString("CenterPoint", XmlHelper.WritePointF(points["0"]));

                TypeConverter enumConverter = TypeDescriptor.GetConverter(typeof(TrackExtraData));
                string        xmlExtraData  = enumConverter.ConvertToString(trackExtraData);
                w.WriteElementString("ExtraData", xmlExtraData);

                w.WriteStartElement("MeasureLabel");
                miniLabel.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeStyle(filter))
            {
                w.WriteStartElement("DrawingStyle");
                style.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeFading(filter))
            {
                w.WriteStartElement("InfosFading");
                infosFading.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeAll(filter))
            {
                // Spreadsheet support.
                w.WriteStartElement("Coordinates");

                PointF p      = new PointF(points["0"].X, points["0"].Y);
                PointF coords = CalibrationHelper.GetPoint(p);
                w.WriteAttributeString("UserX", String.Format("{0:0.00}", coords.X));
                w.WriteAttributeString("UserXInvariant", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", coords.X));
                w.WriteAttributeString("UserY", String.Format("{0:0.00}", coords.Y));
                w.WriteAttributeString("UserYInvariant", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", coords.Y));
                w.WriteAttributeString("UserUnitLength", CalibrationHelper.GetLengthAbbreviation());

                w.WriteEndElement();
            }
        }
Esempio n. 3
0
        public void WriteXml(XmlWriter w, SerializationFilter filter)
        {
            if (ShouldSerializeCore(filter))
            {
                w.WriteElementString("Start", XmlHelper.WritePointF(points["a"]));
                w.WriteElementString("End", XmlHelper.WritePointF(points["b"]));
                w.WriteElementString("MeasureVisible", ShowMeasurableInfo.ToString().ToLower());
            }

            if (ShouldSerializeStyle(filter))
            {
                w.WriteStartElement("DrawingStyle");
                style.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeFading(filter))
            {
                w.WriteStartElement("InfosFading");
                infosFading.WriteXml(w);
                w.WriteEndElement();
            }


            if (ShouldSerializeAll(filter))
            {
                // Spreadsheet support.
                w.WriteStartElement("Measure");

                PointF a = CalibrationHelper.GetPoint(new PointF(points["a"].X, points["a"].Y));
                PointF b = CalibrationHelper.GetPoint(new PointF(points["b"].X, points["b"].Y));

                float  len            = GeometryHelper.GetDistance(a, b);
                string value          = String.Format("{0:0.00}", len);
                string valueInvariant = String.Format(CultureInfo.InvariantCulture, "{0:0.00}", len);

                w.WriteAttributeString("UserLength", value);
                w.WriteAttributeString("UserLengthInvariant", valueInvariant);
                w.WriteAttributeString("UserUnitLength", CalibrationHelper.GetLengthAbbreviation());

                w.WriteEndElement();
            }
        }
Esempio n. 4
0
        public void WriteXml(XmlWriter w, SerializationFilter filter)
        {
            if (ShouldSerializeCore(filter))
            {
                w.WriteElementString("CenterPoint", XmlHelper.WritePointF(points["0"]));
                w.WriteElementString("CoordinatesVisible", ShowMeasurableInfo.ToString().ToLower());
            }

            if (ShouldSerializeStyle(filter))
            {
                w.WriteStartElement("DrawingStyle");
                style.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeFading(filter))
            {
                w.WriteStartElement("InfosFading");
                infosFading.WriteXml(w);
                w.WriteEndElement();
            }

            if (ShouldSerializeAll(filter))
            {
                // Spreadsheet support.
                w.WriteStartElement("Coordinates");

                PointF p      = new PointF(points["0"].X, points["0"].Y);
                PointF coords = CalibrationHelper.GetPoint(p);
                w.WriteAttributeString("UserX", String.Format("{0:0.00}", coords.X));
                w.WriteAttributeString("UserXInvariant", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", coords.X));
                w.WriteAttributeString("UserY", String.Format("{0:0.00}", coords.Y));
                w.WriteAttributeString("UserYInvariant", String.Format(CultureInfo.InvariantCulture, "{0:0.00}", coords.Y));
                w.WriteAttributeString("UserUnitLength", CalibrationHelper.GetLengthAbbreviation());

                w.WriteEndElement();
            }
        }