public Station(string name, int leaving, int entering, float distFromLondon, Electrification electrification, ControlType controlType) { Name = name; Leaving = leaving; Entering = entering; DistFromLondon = distFromLondon; Electrification = electrification; ControlType = ControlType; }
/// <summary> /// Instantiates a new PathEdge object from the supplied values /// </summary> /// <param name="FromLocation">The start location node of the path</param> /// <param name="ToLocation">The end location node of the path</param> /// <param name="SQLConnector">A connector to the GroundFrame.SQL database</param> /// <param name="PathElectrification">An electrification object representing the type of electrification along the path</param> /// <param name="PathLength">The path length</param> /// <param name="PathDirection">The path direction</param> public PathEdge(LocationNode FromLocation, LocationNode ToLocation, Electrification PathElectrification, Length PathLength, SimSigPathDirection PathDirection, GFSqlConnector SQLConnector) { //Validate Arguments ArgumentValidation.ValidateSQLConnector(SQLConnector, Globals.UserSettings.GetCultureInfo()); this._FromLocation = FromLocation; this._ToLocation = ToLocation; this._SQLConnector = new GFSqlConnector(SQLConnector); this.PathDirection = PathDirection; this.PathElectrification = PathElectrification; this.PathLength = PathLength; }
/// <summary> /// Adds a Path Edge to the supplied To Location Node /// </summary> /// <param name="ToLocationNode">The Location Node at the end of the path</param> /// <param name="PathElectrifcation">The available electrification of the path</param> /// <param name="PathLength">The path length</param> /// <param name="PathDirection">The path direction</param> public void AddPathEdge(LocationNode ToLocationNode, Electrification PathElectrifcation, Length PathLength, SimSigPathDirection PathDirection) { //Validate arguments ArgumentValidation.ValidateLocationNode(ToLocationNode, Globals.UserSettings.GetCultureInfo()); if (this.ID == 0) { ExceptionHelper.GetStaticException("AddPathEdgeFromLocationNodeError", null, Globals.UserSettings.GetCultureInfo()); } if (ToLocationNode.ID == 0) { ExceptionHelper.GetStaticException("AddPathEdgeToLocationNodeError", null, Globals.UserSettings.GetCultureInfo()); } PathEdge NewPathEdge = new PathEdge(this, ToLocationNode, PathElectrifcation, PathLength, PathDirection, this._SQLConnector); NewPathEdge.SaveToSQLDB(); this._PathEdges.Add(NewPathEdge); }
/// <summary> /// Instantiates a new Location node object from the supplied arguments /// </summary> /// <param name="SimulationID">The GroundFrame.SQL database id of the simulation</param> /// <param name="LocationSimSigCode">The SimSig location code of the location</param> /// <param name="EraID">The GroundFrame.SQL database id of the simulation era</param> /// <param name="Version">The version of SimSig this created under</param> /// <param name="Platform">The platform</param> /// <param name="Electrification">The valid electrification options for this location node</param> /// <param name="LocationType">The location type of for this location node</param> /// <param name="Length">A length object representing the length for this location node</param> /// <param name="FreightOnly">Flag to indicate whether the location is freight only</param> /// <param name="Line">The line code</param> /// <param name="Path">The path code</param> /// <param name="SQLConnector">The GFSqlConnector to the GroundFrame.SQL database</param> public LocationNode(int SimulationID, string LocationSimSigCode, int EraID, Version Version, string Platform, Electrification Electrification, SimSigLocationType LocationType, Length Length, bool FreightOnly, string Line, string Path, GFSqlConnector SQLConnector) { CultureInfo Culture = Globals.UserSettings.GetCultureInfo(); //Check Arguments ArgumentValidation.ValidateSQLConnector(SQLConnector, Culture); this._SQLConnector = new GFSqlConnector(SQLConnector); ArgumentValidation.ValidateVersion(Version, Culture); if (SimulationID == 0) { throw new ArgumentException(ExceptionHelper.GetStaticException("CreateLocationNodeUnsavedSimError", null, Culture)); } this._SimID = SimulationID; //Load simulation into a SimSig Simulation object using SimulationExtension LocNodeSimulation = new SimulationExtension(this.SimID, this._SQLConnector); //Validate locations and eras if (LocNodeSimulation.Locations.Any(x => x.SimSigCode == LocationSimSigCode) == false) { throw new ArgumentException(ExceptionHelper.GetStaticException("CreateLocationNodeInvalidLocationError", null, Culture)); } if (LocNodeSimulation.GetSimulationEras().Any(x => x.ID == EraID) == false) { throw new ArgumentException(ExceptionHelper.GetStaticException("CreateLocationNodeInvalidSimEraError", null, Culture)); } //Set Properties this._LocationSimSigCode = LocationSimSigCode; this._LocationID = LocNodeSimulation.Locations.Find(x => x.SimSigCode == this._LocationSimSigCode).ID; this._EraID = EraID; this._Version = Version; this.Platform = Platform; this.Electrification = Electrification; this.LocationType = LocationType; this.Length = Length; this.FreightOnly = FreightOnly; this.Line = Line; this.Path = Path; }