67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
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<TextPoint2D> _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);
|
|
}
|
|
}
|
|
}
|
|
}
|