Beispiel #1
0
 /// <summary>
 /// Constructs a new CALExemption.
 /// </summary>
 /// <param name="schema">The schema object containing data for this CAL exemption.</param>
 /// <param name="region">The region.</param>
 /// <param name="subArea">The ID number of the sub-area against which to resolve short object IDs.</param>
 public CALExemption(Schema.CALExemption schema, Region region, ushort subArea)
 {
     {
         TrackCircuit[] tcs = new TrackCircuit[schema.ClearTCs.Count];
         for (int i = 0; i != schema.ClearTCs.Count; ++i)
         {
             tcs[i] = region.GetTrackCircuit(schema.ClearTCs[i], subArea);
         }
         ClearTCs = Array.AsReadOnly(tcs);
     }
     {
         RoutePointPosition[] pointPositions = new RoutePointPosition[schema.PointPositions.Count];
         for (int i = 0; i != schema.PointPositions.Count; ++i)
         {
             pointPositions[i] = new RoutePointPosition(schema.PointPositions[i], region, subArea);
         }
         PointPositions = Array.AsReadOnly(pointPositions);
     }
     {
         Signal[] sigs = new Signal[schema.SignalsOn.Count];
         for (int i = 0; i != schema.SignalsOn.Count; ++i)
         {
             sigs[i] = region.GetSignal(schema.SignalsOn[i], subArea);
         }
         SignalsOn = Array.AsReadOnly(sigs);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Constructs a route from its spec.
 /// </summary>
 /// <param name="schema">The schema object containing data about this route.</param>
 /// <param name="region">The region the route exists in.</param>
 /// <param name="entrance">The signal at which this route begins.</param>
 public Route(Schema.Route schema, Region region, ControlledSignal entrance)
 {
     Entrance    = entrance;
     Exit        = region.GetSignal(schema.Exit, entrance.SubArea);
     Divergence  = schema.Divergence;
     Restricting = schema.Restricting;
     DivergenceDistanceStraightOnly = schema.DivergenceDistanceStraightOnly;
     {
         RouteElement[] elts = new RouteElement[schema.TCs.Count];
         for (int i = 0; i != schema.TCs.Count; ++i)
         {
             elts[i] = new RouteElement(schema.TCs[i], region, entrance.SubArea);
         }
         Elements = Array.AsReadOnly(elts);
     }
     {
         RoutePointPosition[] elts = new RoutePointPosition[schema.Points.Count];
         for (int i = 0; i != schema.Points.Count; ++i)
         {
             elts[i] = new RoutePointPosition(schema.Points[i], region, entrance.SubArea);
         }
         PointPositions = Array.AsReadOnly(elts);
     }
     {
         TrackCircuit[] tcs = new TrackCircuit[schema.FreeTCs.Count];
         for (int i = 0; i != schema.FreeTCs.Count; ++i)
         {
             tcs[i] = region.GetTrackCircuit(schema.FreeTCs[i], entrance.SubArea);
         }
         FreeTrackCircuits = Array.AsReadOnly(tcs);
     }
 }