using System.Xml.Serialization; namespace ShrlAlgoToolkit.RevitAddins.RvIndependent.MetroGauges.LandXMLData { [XmlInclude(typeof(Curve))] [XmlInclude(typeof(Spiral))] [XmlInclude(typeof(Line))] [Serializable] public abstract class Interval { [XmlElement("Start")] public TextPoint2D Start { get => _points[0]; set => _points[0] = value; } [XmlElement("End")] public TextPoint2D End { get => _points[1]; set => _points[1] = value; } [XmlAttribute("length")] public double Length { get; set; } [XmlIgnore] internal List _points { get; set; } public abstract double GetDirectionAtPoint(double station); public void Transform(GeometryTransformations transformations) { Length *= transformations.ScaleFactor; Line line = this as Line; if (line != null) { line.Dir += transformations.Phi; } else { Curve curve = this as Curve; if (curve != null) { curve.DirStart += transformations.Phi; curve.DirEnd += transformations.Phi; curve.Radius *= transformations.ScaleFactor; } else { Spiral spiral = this as Spiral; if (spiral != null) { spiral.Dir += transformations.Theta; } } } foreach (TextPoint2D textPoint2D in _points) { textPoint2D.Transform(transformations, false); } } } }