整理代码
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ShrlAlgo.RvKits.RvIndependent.MetroGauges.LandXMLData
|
||||
{
|
||||
[XmlType("Roadway")]
|
||||
[Serializable]
|
||||
public class Roadway
|
||||
{
|
||||
public Roadway()
|
||||
{
|
||||
Speeds = new List<DesignSpeed>();
|
||||
}
|
||||
|
||||
[XmlAttribute("staStart")]
|
||||
public double StationStart { get; set; }
|
||||
|
||||
[XmlAttribute("staEnd")]
|
||||
public double StationEnd { get; set; }
|
||||
|
||||
[XmlArray("Speeds")]
|
||||
public List<DesignSpeed> Speeds { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Model LandXml { get; internal set; }
|
||||
|
||||
[XmlAttribute("CorridorID")]
|
||||
public string CorridorID { get; set; }
|
||||
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[XmlAttribute("surfaceRefs")]
|
||||
public string SurfaceRefs { get; set; }
|
||||
|
||||
[XmlAttribute("alignmentRefs")]
|
||||
public string AlignmentRefs { get; set; }
|
||||
|
||||
[XmlAttribute("aIDs")]
|
||||
public string AlignmentIDs { get; set; }
|
||||
|
||||
public void AddAlignment(Alignment alignment)
|
||||
{
|
||||
AlignmentIDs += alignment.Id;
|
||||
AlignmentRefs = AlignmentRefs + (string.IsNullOrWhiteSpace(AlignmentRefs) ? string.Empty : " ") + alignment.Name;
|
||||
alignment.Roadway = this;
|
||||
}
|
||||
|
||||
public void ConnectAlignments()
|
||||
{
|
||||
foreach (Alignment alignment in LandXml.Alignments)
|
||||
{
|
||||
alignment.Roadway = this;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAlignment(Alignment alignment)
|
||||
{
|
||||
AlignmentIDs.Replace(alignment.Id, string.Empty);
|
||||
AlignmentRefs.Replace(AlignmentRefs.StartsWith(alignment.Name) ? alignment.Name : " " + alignment.Name, string.Empty);
|
||||
alignment.Roadway = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user