コード例 #1
0
        private List <SSVehGPSDataTable> convertRawGPSToSSFormat(List <JSONVehLoc> downloadedGPSData)
        {
            List <SSVehGPSDataTable> convertedData = new List <SSVehGPSDataTable>();

            foreach (JSONVehLoc aRawGPS in downloadedGPSData)
            {
                SSVehGPSDataTable aConvertedData = new SSVehGPSDataTable();

                string routeNum = aRawGPS.routeNumber;
                string dir      = aRawGPS.dirTag == "NULL" ? "" : aRawGPS.dirTag.Split('_')[1];
                string RouteTag = aRawGPS.dirTag == "NULL" ? "" : aRawGPS.dirTag.Split('_')[2];
                string TripCode = string.Concat(routeNum, "_", RouteTag, "_", aRawGPS.VehID);

                aConvertedData.gpsID     = -1;//unassigned
                aConvertedData.GPStime   = aRawGPS.GPStime;
                aConvertedData.vehID     = Convert.ToInt32(aRawGPS.VehID);
                aConvertedData.TripCode  = TripCode;
                aConvertedData.Direction = Convert.ToInt32(dir);
                aConvertedData.Longitude = Convert.ToDouble(aRawGPS.coordinates[0]);
                aConvertedData.Latitude  = Convert.ToDouble(aRawGPS.coordinates[1]);
                aConvertedData.GPStime   = aRawGPS.GPStime;

                convertedData.Add(aConvertedData);
            }

            return(convertedData);
        }
コード例 #2
0
        private List <SSVehGPSDataTable> convertRawGPSToSSFormat(List <Vehicle> downloadedGPSData)
        {
            List <SSVehGPSDataTable> convertedData = new List <SSVehGPSDataTable>();

            foreach (Vehicle aRawGPS in downloadedGPSData)
            {
                if (aRawGPS.DirTag != null && aRawGPS.DirTag != "NULL")
                {
                    SSVehGPSDataTable aConvertedData = new SSVehGPSDataTable();

                    string routeNum = aRawGPS.RouteTag.Length > 0 ? aRawGPS.RouteTag : "-1";
                    string dir      = aRawGPS.DirTag == "NULL" ? "-1" : aRawGPS.DirTag.Split('_')[1];
                    string RouteTag = aRawGPS.DirTag == "NULL" ? "-1" : aRawGPS.DirTag.Split('_')[2];
                    string TripCode = string.Concat(routeNum, "_", RouteTag, "_", aRawGPS.Id);

                    aConvertedData.gpsID     = -1;//unassigned
                    aConvertedData.GPStime   = aRawGPS.GPStime;
                    aConvertedData.vehID     = Convert.ToInt32(aRawGPS.Id);
                    aConvertedData.TripCode  = TripCode;
                    aConvertedData.Direction = Convert.ToInt32(dir);
                    aConvertedData.Longitude = Convert.ToDouble(aRawGPS.Lon);
                    aConvertedData.Latitude  = Convert.ToDouble(aRawGPS.Lat);
                    aConvertedData.GPStime   = aRawGPS.GPStime;
                    aConvertedData.Heading   = Convert.ToInt32(aRawGPS.Heading);

                    convertedData.Add(aConvertedData);
                }
            }

            return(convertedData);
        }