Exemple #1
0
        /// <summary>
        /// Reads the geometry information to the specified <see cref="XmlWriter" />.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>FlushGapProfile</returns>
        public static FlushGapProfile Deserialize(XmlReader reader)
        {
            var result = new FlushGapProfile();

            while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                case "Inlet":
                    result.Inlet = DeserializePoint(reader);
                    break;

                case "Outlet":
                    result.Outlet = DeserializePoint(reader);
                    break;

                case "Edge":
                    result.Edge = DeserializePoint(reader);
                    break;

                case "Flush":
                    result.Flush = DeserializePoint(reader);
                    break;

                case "Gap":
                    result.Gap = DeserializePoint(reader);
                    break;
                }
            }

            return(result);
        }
        /// <summary>
        /// Reads the geometry information from the specified <see cref="XmlReader" />.
        /// </summary>
        /// <param name="reader">The reader.</param>
        protected override void Deserialize(XmlReader reader)
        {
            var elementSystem = new CoordinateSystem();

            while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                case "CoordinateSystem":
                    elementSystem = CoordinateSystem.Deserialize(reader);
                    break;

                case "ReferenceProfile":
                    ReferenceProfile = FlushGapProfile.Deserialize(reader);
                    break;

                case "MeasureProfile":
                    MeasureProfile = FlushGapProfile.Deserialize(reader);
                    break;

                case "Flush":
                {
                    if (Enum.TryParse <FlushPointConnectionType>(reader.GetAttribute("ConnectionType"), out var connectionType))
                    {
                        FlushConnectionType = connectionType;
                    }

                    FlushValue = Property.ObjectToNullableDouble(reader.ReadString(), CultureInfo.InvariantCulture) ?? 0.0;

                    break;
                }

                case "Gap":
                {
                    if (Enum.TryParse <FlushPointConnectionType>(reader.GetAttribute("ConnectionType"), out var connectionType))
                    {
                        GapConnectionType = connectionType;
                    }

                    GapValue = Property.ObjectToNullableDouble(reader.ReadString(), CultureInfo.InvariantCulture) ?? 0.0;

                    break;
                }
                }
            }

            CoordinateSystem = elementSystem;
        }