Esempio n. 1
0
 /// <summary>
 /// Creates the mapped location in the Target Simulation
 /// </summary>
 /// <param name="SQLConnector">The target simulation where the location should be created</param>
 /// <param name="TargetSimulation">A GFSqlConnector object connected to the GroundFrame.SQL database</param>
 public void CreateLocation(ref GroundFrame.Core.SimSig.Simulation TargetSimulation, GFSqlConnector SQLConnector)
 {
     //Validate Arguments
     ArgumentValidation.ValidateSQLConnector(SQLConnector, Globals.UserSettings.GetCultureInfo());
     ArgumentValidation.ValidateSimulation(TargetSimulation, Globals.UserSettings.GetCultureInfo());
     //Instantiate Location
     GroundFrame.Core.SimSig.Location NewLocation = new SimSig.Location(TargetSimulation, this.Name, null, this.SimSigCode, this.IsEntryPoint, SimSig.SimSigLocationType.Unknown, SQLConnector);
     //Save to GroundFrame.SQL database
     NewLocation.SaveToSQLDB();
     //Add location to MapperLocation
     this._Location = NewLocation;
     //Dispose
     NewLocation.Dispose();
 }
Esempio n. 2
0
        /// <summary>
        /// Creates the mapped location in the Target Simulation
        /// </summary>
        /// <param name="SQLConnector">The target simulation where the location should be created</param>
        /// <param name="TargetSimulation">A GFSqlConnector object connected to the GroundFrame.SQL database</param>
        /// <param name="Version">The version under which the location node was created</param>
        /// <param name="SimEra">The era for which the location node is valid</param>
        /// <param name="Location">The location against which the location node will be created</param>
        public void CreateLocationNode(ref SimSig.SimulationExtension TargetSimulation, GFSqlConnector SQLConnector, SimSig.Location Location, SimSig.Version Version, SimSig.SimulationEra SimEra)
        {
            //Validate Arguments
            ArgumentValidation.ValidateSQLConnector(SQLConnector, Globals.UserSettings.GetCultureInfo());
            ArgumentValidation.ValidateSimulation(TargetSimulation, Globals.UserSettings.GetCultureInfo());
            ArgumentValidation.ValidateVersion(Version, Globals.UserSettings.GetCultureInfo());
            ArgumentValidation.ValidateLocation(Location, Globals.UserSettings.GetCultureInfo());
            ArgumentValidation.ValidateSimEra(SimEra, Globals.UserSettings.GetCultureInfo());

            //Default Value
            Electrification DefaultElectrification = new Electrification("D");

            //Instantiate Location Node
            SimSig.LocationNode NewLocationNode = new SimSig.LocationNode(TargetSimulation.ID, Location.ID, SimEra.ID, Version, this.Platform, DefaultElectrification, SimSig.SimSigLocationType.Unknown, null, false, this.Line, this.Path, SQLConnector);

            if (TargetSimulation.LocationNodes.Exists(NewLocationNode) == false)
            {
                //Save to GroundFrame.SQL database
                NewLocationNode.SaveToSQLDB();
                //Add location node to MapperLocationNode
                this._LocationNode = NewLocationNode;
                //Add location to the simulation
                TargetSimulation.LocationNodes.Add(NewLocationNode);
            }

            //Dispose
            NewLocationNode.Dispose();
        }