Exemple #1
0
        private GpxBounds ReadGpxBounds()
        {
            if (!Reader_.IsEmptyElement)
            {
                throw new FormatException(Reader_.Name);
            }

            GpxBounds bounds = new GpxBounds();

            while (Reader_.MoveToNextAttribute())
            {
                switch (Reader_.Name)
                {
                case "minlat":
                    bounds.MinLatitude = double.Parse(Reader_.Value, CultureInfo.InvariantCulture.NumberFormat);
                    break;

                case "maxlat":
                    bounds.MaxLatitude = double.Parse(Reader_.Value, CultureInfo.InvariantCulture.NumberFormat);
                    break;

                case "minlon":
                    bounds.MinLongitude = double.Parse(Reader_.Value, CultureInfo.InvariantCulture.NumberFormat);
                    break;

                case "maxlon":
                    bounds.MaxLongitude = double.Parse(Reader_.Value, CultureInfo.InvariantCulture.NumberFormat);
                    break;
                }
            }

            return(bounds);
        }
Exemple #2
0
 private void WriteBounds(string elementName, GpxBounds bounds)
 {
     Writer_.WriteStartElement(elementName);
     Writer_.WriteAttributeString("minlat", bounds.MinLatitude.ToString(CultureInfo.InvariantCulture));
     Writer_.WriteAttributeString("minlon", bounds.MinLongitude.ToString(CultureInfo.InvariantCulture));
     Writer_.WriteAttributeString("maxlat", bounds.MaxLatitude.ToString(CultureInfo.InvariantCulture));
     Writer_.WriteAttributeString("maxlon", bounds.MaxLongitude.ToString(CultureInfo.InvariantCulture));
     Writer_.WriteEndElement();
 }