コード例 #1
0
        /// <summary>
        /// This method returns a road node position, given a string representing the actual position
        /// </summary>
        /// <param name="currentStringPosition">a string representing the position to be parsed</param>
        /// <returns></returns>
        private Vector3 GetNodePosition(string currentStringPosition)
        {
            string[] propertyStrings = currentStringPosition.Split('\t');

            Vector3 position = new Vector3();

            if (propertyStrings.Length > 0)
            {
                string[] positionValues = propertyStrings[0].Split(',');
                if (positionValues.Length != 3)
                {
                    throw new System.FormatException("Problem parsing position" + positionValues.Length);
                }
                positionValues = UTMUtility.ParseLongLatToUTM(positionValues, EdinburghUTMOrigin);
                position       = new Vector3(float.Parse(positionValues[0]), 0.01f, float.Parse(positionValues[2]));
            }
            return(position);
        }
コード例 #2
0
        /// <summary>
        /// This method returns a stop position, given a string representing the actual position + name
        /// </summary>
        /// <param name="currentStringPosition">a string containing the position to be parsed</param>
        /// <returns></returns>
        private Vector3 GetStopPosition(string currentStringPosition)
        {
            Vector3 position = new Vector3();

            string[] positionValues = currentStringPosition.Split(';');
            if (positionValues.Length != 3)
            {
                throw new System.FormatException("Problem parsing position" + positionValues.Length);
            }
            //Solving text format problems
            positionValues[1] = positionValues[1].Substring(0, positionValues[1].Length);
            positionValues[0] = positionValues[2].Substring(0, positionValues[2].Length);
            positionValues    = UTMUtility.ParseLongLatToUTM(positionValues, EdinburghUTMOrigin);
            float positionX = float.Parse(positionValues[0]);
            float positionY = float.Parse(positionValues[2]);

            position = new Vector3(positionX,
                                   0f, positionY);
            return(position);
        }
コード例 #3
0
 protected override string[] SanitizePositionValues(string[] positionValues)
 {
     //We parse Longitude and latitued coordinates to UTM values
     return(UTMUtility.ParseLongLatToUTM(positionValues, StreetMaker.EdinburghUTMOrigin));
 }