예제 #1
0
        public void PathEdge_Method_SavetoDB(string Electrification, int?Length, SimSigPathDirection Direction)
        {
            Length TestLength = null;

            if (Length != null)
            {
                TestLength = new Length(Convert.ToInt32(Length));
            }

            Core.SimSig.PathEdge TestPathEdge = new Core.SimSig.PathEdge(this._TestLocationNode1, this._TestLocationNode2, this._SQLConnection);
            TestPathEdge.PathElectrification = new Electrification(Electrification);
            TestPathEdge.PathLength          = TestLength;
            TestPathEdge.PathDirection       = Direction;

            Assert.Equal(this._TestLocationNode1.ID, TestPathEdge.FromLocation.ID);
            Assert.Equal(this._TestLocationNode2.ID, TestPathEdge.ToLocation.ID);

            if (TestLength != null)
            {
                Assert.Equal(TestLength.Meters, TestPathEdge.PathLength.Meters);
            }
            else
            {
                Assert.Null(TestLength);
            }

            Assert.Equal(Direction, TestPathEdge.PathDirection);

            TestPathEdge.SaveToSQLDB();
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 /// <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;
 }