Esempio n. 1
0
        /*
         * add a new trip to the end of trippool
         */
        public void add(IKmlFolder trip)
        {
            IKmlFolder     addTrip     = trip;
            IKmlObjectList points      = trip.getFeatures().getChildNodes();
            IKmlPlacemark  startPoint  = (IKmlPlacemark)points.item(0);
            IKmlPlacemark  finishPoint = (IKmlPlacemark)points.item(points.getLength() - 1);
            String         startTime   = startPoint.getName();
            String         finishTime  = finishPoint.getName();
            String         startLong   = Module.getCoordinates(startPoint)["lon"].ToString();
            String         startLat    = Module.getCoordinates(startPoint)["lat"].ToString();
            String         time        = (DateTime.Parse(finishTime) - DateTime.Parse(startTime)).ToString();
            String         distance    = Module.calDistance(trip).ToString();
            String         finishLong  = Module.getCoordinates(finishPoint)["lon"].ToString();
            String         finishLat   = Module.getCoordinates(finishPoint)["lat"].ToString();

            String[] timeSplit = new String[3];
            timeSplit = time.ToString().Split(':');
            double coEff = (3600 / (double)((Convert.ToInt32(timeSplit[0]) * 3600) + (Convert.ToInt32(timeSplit[1]) * 60) + (Convert.ToInt32(timeSplit[2]))));
            String speed = Math.Round((double.Parse(distance) * coEff), 3).ToString();

            _core.Add(addTrip);
            //_attr.Add(addAtt);
            TripDetails.Rows.Add(tripCount, Day, "-", HouseHoldID, "-", Date, WeekDay, startTime, finishTime, time, distance, speed, startLong, startLat, finishLong, finishLat, "-");
            ++tripCount;
        }
Esempio n. 2
0
        public void addAtPosition(IKmlFolder trip, int tripNumber)
        {
            IKmlFolder     addTrip     = trip;
            IKmlObjectList points      = trip.getFeatures().getChildNodes();
            IKmlPlacemark  startPoint  = (IKmlPlacemark)points.item(0);
            IKmlPlacemark  finishPoint = (IKmlPlacemark)points.item(points.getLength() - 1);
            String         startTime   = startPoint.getName();
            String         finishTime  = finishPoint.getName();
            String         startLong   = Module.getCoordinates(startPoint)["lon"].ToString();
            String         startLat    = Module.getCoordinates(startPoint)["lat"].ToString();
            String         time        = (DateTime.Parse(finishTime) - DateTime.Parse(startTime)).ToString();
            String         distance    = Module.calDistance(trip).ToString();
            String         finishLong  = Module.getCoordinates(finishPoint)["lon"].ToString();
            String         finishLat   = Module.getCoordinates(finishPoint)["lat"].ToString();

            String[] timeSplit = new String[3];
            timeSplit = time.ToString().Split(':');
            double coEff = (3600 / (double)((Convert.ToInt32(timeSplit[0]) * 3600) + (Convert.ToInt32(timeSplit[1]) * 60) + (Convert.ToInt32(timeSplit[2]))));
            String speed = Math.Round((double.Parse(distance) * coEff), 3).ToString();
            //          _core.Add(addTrip);
            //_attr.Add(addAtt);
            DataRow newRow = NewRowDataTableCustom();

            newRow["KMLTrip"]     = tripCount;
            newRow["HouseHoldID"] = HouseHoldID;
            newRow["Trip"]        = "-";
            newRow["Person"]      = "-";
            newRow["Day"]         = Day;
            newRow["Date"]        = Date;
            newRow["WeekDay"]     = WeekDay;
            newRow["Start Time"]  = startTime;
            newRow["Finish Time"] = finishTime;
            newRow["Time"]        = time;
            newRow["Distance"]    = distance;
            newRow["Speed"]       = speed;
            newRow["StartLong"]   = startLong;
            newRow["StartLat"]    = startLat;
            newRow["Finishlong"]  = finishLong;
            newRow["FinishLat"]   = finishLat;
            newRow["Remain"]      = "-";
            TripDetails.Rows.InsertAt(newRow, tripNumber);
            resetTripCount();
        }
Esempio n. 3
0
        public void resetTripData(String trip)
        {
            IKmlFolder tripData = getByName(trip);

            for (int i = 0; i != TripDetails.Rows.Count; ++i)
            {
                if (TripDetails.Rows[i]["KMLTrip"].ToString().Trim().Equals(Module.getIndex(trip).ToString()))
                {
                    //                   MessageBox.Show("FCKING "+trip);
                    IKmlFolder     addTrip     = tripData;
                    IKmlObjectList points      = tripData.getFeatures().getChildNodes();
                    IKmlPlacemark  startPoint  = (IKmlPlacemark)points.item(0);
                    IKmlPlacemark  finishPoint = (IKmlPlacemark)points.item(points.getLength() - 1);
                    String         startTime   = startPoint.getName();
                    String         finishTime  = finishPoint.getName();
                    String         startLong   = Module.getCoordinates(startPoint)["lon"].ToString();
                    String         startLat    = Module.getCoordinates(startPoint)["lat"].ToString();
                    String         time        = (Convert.ToDateTime(finishTime) - Convert.ToDateTime(startTime)).ToString();
                    String         distance    = Module.calDistance(tripData).ToString();
                    String         finishLong  = Module.getCoordinates(finishPoint)["lon"].ToString();
                    String         finishLat   = Module.getCoordinates(finishPoint)["lat"].ToString();
                    String[]       timeSplit   = new String[3];
                    timeSplit = time.ToString().Split(':');
                    double coEff = (3600 / (double)((Convert.ToInt32(timeSplit[0]) * 3600) + (Convert.ToInt32(timeSplit[1]) * 60) + (Convert.ToInt32(timeSplit[2]))));
                    String speed = Math.Round((double.Parse(distance) * coEff), 3).ToString();
                    TripDetails.Rows[i]["Start Time"]  = startTime;
                    TripDetails.Rows[i]["Finish Time"] = finishTime;
                    TripDetails.Rows[i]["Time"]        = time;
                    TripDetails.Rows[i]["Distance"]    = distance;
                    TripDetails.Rows[i]["Speed"]       = speed;
                    TripDetails.Rows[i]["StartLong"]   = startLong;
                    TripDetails.Rows[i]["StartLat"]    = startLat;
                    TripDetails.Rows[i]["Finishlong"]  = finishLong;
                    TripDetails.Rows[i]["FinishLat"]   = finishLat;
                    TripDetails.Rows[i]["Remain"]      = "-";
                }
            }
        }