Пример #1
0
        private static void ParsePointList(DrawingPencil _dp, XmlTextReader _xmlReader, PointF _scale)
        {
            _dp.m_PointList.Clear();
            _dp.m_RescaledPointList.Clear();

            while (_xmlReader.Read())
            {
                if (_xmlReader.IsStartElement())
                {
                    if (_xmlReader.Name == "Point")
                    {
                        Point p = XmlHelper.PointParse(_xmlReader.ReadString(), ';');

                        Point adapted = new Point((int)((float)p.X * _scale.X), (int)((float)p.Y * _scale.Y));

                        _dp.m_PointList.Add(adapted);
                        _dp.m_RescaledPointList.Add(adapted);
                    }
                    else
                    {
                        // forward compatibility : ignore new fields.
                    }
                }
                else if (_xmlReader.Name == "PointList")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }
        }
Пример #2
0
        public static AbstractDrawing FromXml(XmlTextReader _xmlReader, PointF _scale)
        {
            DrawingPencil dp = new DrawingPencil();

            while (_xmlReader.Read())
            {
                if (_xmlReader.IsStartElement())
                {
                    if (_xmlReader.Name == "PointList")
                    {
                        ParsePointList(dp, _xmlReader, _scale);
                    }
                    else if (_xmlReader.Name == "LineStyle")
                    {
                        dp.m_PenStyle = LineStyle.FromXml(_xmlReader);
                    }
                    else if (_xmlReader.Name == "InfosFading")
                    {
                        dp.m_InfosFading.FromXml(_xmlReader);
                    }
                    else
                    {
                        // forward compatibility : ignore new fields.
                    }
                }
                else if (_xmlReader.Name == "Drawing")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            dp.RescaleCoordinates(dp.m_fStretchFactor, dp.m_DirectZoomTopLeft);
            return(dp);
        }