<commit_before>/*
 * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
*/

using AgGateway.ADAPT.ApplicationDataModel.ADM;
using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
using AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations;
using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
using System;
using System.Collections.Generic;
using System.Xml;

namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
{
    public class ISOGuidancePattern : ISOElement
    {
        public ISOGuidancePattern()
        {
            BoundaryPolygons = new List<ISOPolygon>();
        }

        //Attributes
        public string GuidancePatternId { get; set; }
        public string GuidancePatternDesignator { get; set; }
        public ISOGuidancePatternType GuidancePatternType { get { return (ISOGuidancePatternType)GuidancePatternTypeInt; } set { GuidancePatternTypeInt = (int)value; } }
        private int GuidancePatternTypeInt { get; set; }
        public ISOGuidancePatternOption? GuidancePatternOptions { get { return (ISOGuidancePatternOption?)GuidancePatternOptionsInt; } set { GuidancePatternOptionsInt = (int?)value; } }
        private int? GuidancePatternOptionsInt { get; set; }
        public ISOGuidancePatternPropagationDirection? PropagationDirection { get { return (ISOGuidancePatternPropagationDirection?)PropagationDirectionInt; } set { PropagationDirectionInt = (int?)value; } }
        private int? PropagationDirectionInt { get; set; }
        public ISOGuidancePatternExtension? Extension { get { return (ISOGuidancePatternExtension?)ExtensionInt; } set { ExtensionInt = (int?)value; } }
        private int? ExtensionInt { get; set; }
        public decimal? Heading { get; set; }
        public uint? Radius { get; set; }
        public ISOGuidancePatternGNSSMethod? GNSSMethod { get { return (ISOGuidancePatternGNSSMethod?)GNSSMethodInt; } set { GNSSMethodInt = (int?)value; } }
        private int? GNSSMethodInt { get; set; }
        public decimal? HorizontalAccuracy { get; set; }
        public decimal? VerticalAccuracy { get; set; }
        public string BaseStationRef { get; set; }
        public string OriginalSRID { get; set; }
        public uint? NumberOfSwathsLeft { get; set; }
        public uint? NumberOfSwathsRight { get; set; }

        //Child Elements
        public ISOLineString LineString { get; set; }
        public List<ISOPolygon> BoundaryPolygons { get; set; }


        public override XmlWriter WriteXML(XmlWriter xmlBuilder)
        {
            xmlBuilder.WriteStartElement("GPN");
            xmlBuilder.WriteXmlAttribute("A", GuidancePatternId);
            xmlBuilder.WriteXmlAttribute("B", GuidancePatternDesignator);
            xmlBuilder.WriteXmlAttribute("C", ((int)GuidancePatternType).ToString());
            xmlBuilder.WriteXmlAttribute<ISOGuidancePatternOption>("D", GuidancePatternOptions);
            xmlBuilder.WriteXmlAttribute<ISOGuidancePatternPropagationDirection>("E", PropagationDirection);
            xmlBuilder.WriteXmlAttribute<ISOGuidancePatternExtension>("F", Extension);
            xmlBuilder.WriteXmlAttribute("G", Heading);
            xmlBuilder.WriteXmlAttribute("H", Radius);
            xmlBuilder.WriteXmlAttribute<ISOGuidancePatternGNSSMethod>("I", GNSSMethod);
            xmlBuilder.WriteXmlAttribute("J", HorizontalAccuracy);
            xmlBuilder.WriteXmlAttribute("K", VerticalAccuracy);
            xmlBuilder.WriteXmlAttribute("L", BaseStationRef);
            xmlBuilder.WriteXmlAttribute("M", OriginalSRID);
            xmlBuilder.WriteXmlAttribute("N", NumberOfSwathsLeft);
            xmlBuilder.WriteXmlAttribute("O", NumberOfSwathsRight);

            if (LineString != null)
            {
                LineString.WriteXML(xmlBuilder);
            }
            foreach (ISOPolygon item in BoundaryPolygons) { item.WriteXML(xmlBuilder); }


            xmlBuilder.WriteEndElement();
            return xmlBuilder;
        }

        public static ISOGuidancePattern ReadXML(XmlNode node)
        {<commit_msg>Serialization of enum values as number (instead of the enum value name).<commit_after>/*
 * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
*/

using AgGateway.ADAPT.ApplicationDataModel.ADM;
using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
using AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations;
using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
using System;
using System.Collections.Generic;
using System.Xml;

namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
{
    public class ISOGuidancePattern : ISOElement
    {
        public ISOGuidancePattern()
        {
            BoundaryPolygons = new List<ISOPolygon>();
        }

        //Attributes
        public string GuidancePatternId { get; set; }
        public string GuidancePatternDesignator { get; set; }
        public ISOGuidancePatternType GuidancePatternType { get { return (ISOGuidancePatternType)GuidancePatternTypeInt; } set { GuidancePatternTypeInt = (int)value; } }
        private int GuidancePatternTypeInt { get; set; }
        public ISOGuidancePatternOption? GuidancePatternOptions { get { return (ISOGuidancePatternOption?)GuidancePatternOptionsInt; } set { GuidancePatternOptionsInt = (int?)value; } }
        private int? GuidancePatternOptionsInt { get; set; }
        public ISOGuidancePatternPropagationDirection? PropagationDirection { get { return (ISOGuidancePatternPropagationDirection?)PropagationDirectionInt; } set { PropagationDirectionInt = (int?)value; } }
        private int? PropagationDirectionInt { get; set; }
        public ISOGuidancePatternExtension? Extension { get { return (ISOGuidancePatternExtension?)ExtensionInt; } set { ExtensionInt = (int?)value; } }
        private int? ExtensionInt { get; set; }
        public decimal? Heading { get; set; }
        public uint? Radius { get; set; }
        public ISOGuidancePatternGNSSMethod? GNSSMethod { get { return (ISOGuidancePatternGNSSMethod?)GNSSMethodInt; } set { GNSSMethodInt = (int?)value; } }
        private int? GNSSMethodInt { get; set; }
        public decimal? HorizontalAccuracy { get; set; }
        public decimal? VerticalAccuracy { get; set; }
        public string BaseStationRef { get; set; }
        public string OriginalSRID { get; set; }
        public uint? NumberOfSwathsLeft { get; set; }
        public uint? NumberOfSwathsRight { get; set; }

        //Child Elements
        public ISOLineString LineString { get; set; }
        public List<ISOPolygon> BoundaryPolygons { get; set; }


        public override XmlWriter WriteXML(XmlWriter xmlBuilder)
        {
            xmlBuilder.WriteStartElement("GPN");
            xmlBuilder.WriteXmlAttribute("A", GuidancePatternId);
            xmlBuilder.WriteXmlAttribute("B", GuidancePatternDesignator);
            xmlBuilder.WriteXmlAttribute("C", ((int)GuidancePatternType).ToString());
            //190503 MSp xmlBuilder.WriteXmlAttribute<ISOGuidancePatternOption>("D", GuidancePatternOptions);
            if (GuidancePatternOptions.HasValue) xmlBuilder.WriteXmlAttribute("D", ((int)GuidancePatternOptions).ToString());    //190503 MSp
            //190503 MSp xmlBuilder.WriteXmlAttribute<ISOGuidancePatternPropagationDirection>("E", PropagationDirection);   // Gets serialized as E="BothDirections"
            if (PropagationDirection.HasValue) xmlBuilder.WriteXmlAttribute("E", ((int)PropagationDirection).ToString());  //190503 MSp
            //190503 MSp xmlBuilder.WriteXmlAttribute<ISOGuidancePatternExtension>("F", Extension);
            if (Extension.HasValue) xmlBuilder.WriteXmlAttribute("F", ((int)Extension).ToString()); //190503 MSp
            xmlBuilder.WriteXmlAttribute("G", Heading);
            xmlBuilder.WriteXmlAttribute("H", Radius);
            //190503 MSp xmlBuilder.WriteXmlAttribute<ISOGuidancePatternGNSSMethod>("I", GNSSMethod);
            if (GNSSMethod.HasValue) xmlBuilder.WriteXmlAttribute("I", ((int)GNSSMethod).ToString());   //190503 MSp
            xmlBuilder.WriteXmlAttribute("J", HorizontalAccuracy);
            xmlBuilder.WriteXmlAttribute("K", VerticalAccuracy);
            xmlBuilder.WriteXmlAttribute("L", BaseStationRef);
            xmlBuilder.WriteXmlAttribute("M", OriginalSRID);
            xmlBuilder.WriteXmlAttribute("N", NumberOfSwathsLeft);
            xmlBuilder.WriteXmlAttribute("O", NumberOfSwathsRight);

            if (LineString != null)
            {
                LineString.WriteXML(xmlBuilder);
            }
            foreach (ISOPolygon item in BoundaryPolygons) { item.WriteXML(xmlBuilder); }


            xmlBuilder.WriteEndElement();
            return xmlBuilder;
        }

        public static ISOGuidancePattern ReadXML(XmlNode node)
        {
{'fraction_non_alphanumeric': 0.09471516815374056, 'fraction_numerical': 0.006405856783344772, 'mean_word_length': 3.4112008072653883, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 46}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4252997', 'n_tokens_mistral': 2391, 'n_tokens_neox': 2316, 'n_words': 495}