添加项目文件。
This commit is contained in:
67
Sai.RvKits/RvIndependent/MetroGauges/LandXMLData/Interval.cs
Normal file
67
Sai.RvKits/RvIndependent/MetroGauges/LandXMLData/Interval.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Sai.Toolkit.Core.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user