Exemple #1
0
        /*
         * add a new trip to a particular position of trippool defined by its name index
         */
        public void add(String name, IKmlFolder trip, String[] att)
        {
            de_highlight();
            int index = Module.getIndex(name);

            _core.Insert(index - 1, trip);
            //_attr.Insert(index - 1, att);
        }
Exemple #2
0
        public void remove(String name)
        {
            de_highlight();
            int index = Module.getIndex(name);

            _core.RemoveAt(index - 1);
            //_attr.RemoveAt(index - 1);
            TripDetails.Rows[index - 1].Delete();
        }
Exemple #3
0
        /*
         * insert 2 trips into trippool and remove the old trip at the same index of first trip ( this is used by split )
         */
        public void insert(int index, IKmlFolder trip1, String[] att1, IKmlFolder trip2, String[] att2)
        {
            int t = Module.getIndex(trip1.getName());

            _core.RemoveAt(t - 1);

            //_attr.RemoveAt(t - 1);


            _core.Insert(t - 1, trip1);
            //_attr.Insert(t - 1, att1);

            _core.Insert(t, trip2);
            //_attr.Insert(t, att2);
        }
Exemple #4
0
        public Boolean join(String t_name1, String t_name2)
        {
            try
            {
                IKmlFolder temp  = ge.createFolder("");
                String[]   trip1 = t_pool.getTripDetailsForTrip(Module.getIndex(t_name1).ToString());
                String[]   trip2 = t_pool.getTripDetailsForTrip(Module.getIndex(t_name2).ToString());

                IKmlPlacemark point = t_pool.getStart(t_pool.getByName(t_name2));

                String[] trip = (String[])trip1.Clone();

                /*               trip[5] = trip2[5];
                 *             trip[6] = Module.duration(trip[4], trip[5]);
                 *             trip[11] = trip2[11];
                 *             trip[12] = trip2[12];
                 */
                Hashtable cord1 = Module.getCoordinates(t_pool.getFinish(t_pool.getByName(t_name1)));
                Hashtable cord2 = Module.getCoordinates(t_pool.getStart(t_pool.getByName(t_name2)));

/*
 *              trip[7] = (double.Parse(trip1[7]) + double.Parse(trip2[7]) + DistanceAlgorithm.DistanceBetweenPlaces((double)cord1["lat"], (double)cord1["lon"]
 *                          , (double)cord2["lat"], (double)cord2["lon"])).ToString();
 *
 *              trip[8] = Math.Round((double.Parse(trip[7]) / Module.durationConverter(trip[6])), 3).ToString();
 */
                String         style = t_pool.insert(t_name1, temp, trip, ge.createStyle(""));
                IKmlObjectList days  = ge.getFeatures().getChildNodes();
                IKmlDocument   day   = (IKmlDocument)days.item(0);
                day.getFeatures().appendChild(temp);

                ArrayList data = new ArrayList();
                data.Add(t_name1);
                data.Add(point);
                data.Add(trip1);
                data.Add(trip2);
                data.Add(style);
                record.joi_trip(data);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #5
0
        public Boolean delete(String name)
        {
            try
            {
                ArrayList  trip  = new ArrayList();
                IKmlFolder _trip = t_pool.getByName(name);

                String[] att = t_pool.getTripDetailsForTrip(Module.getIndex(name).ToString());
                _trip.setVisibility(0);
                trip.Add(name);
                trip.Add(_trip);
                trip.Add(att);

                t_pool.remove(name);
                record.del_trip(trip);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #6
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"]      = "-";
                }
            }
        }
Exemple #7
0
        public Boolean test_undo_insert()
        {
            bool gflag = true;
            bool fflag = true;
            //Store all the actions into a hashtable
            Hashtable temp = record.undo();

            //Checking for the option insert
            if (temp["opt"] == "ins")
            {
                //Declarations for the data structures and variables
                ArrayList data = (ArrayList)temp["data"];
                String    name = (String)data[0];
                String[]  att  = (String[])data[2];

                int      ts_init = t_pool.getSize();
                int      l_t1    = t_pool.getByName(name).getFeatures().getChildNodes().getLength();
                int      l_t2    = t_pool.getByName("Trip_" + (Module.getIndex(name) + 1)).getFeatures().getChildNodes().getLength();
                String[] att1    = t_pool.getAttByName(name);
                String[] att2    = t_pool.getAttByName("Trip_" + (Module.getIndex(name) + 1));
                //              MessageBox.Show(l_t1 + "   " + l_t2 + "  " + t_pool.getByName(name).getFeatures().getChildNodes().getLength());

                core.undo(record.undo());
                try
                {
                    Assert.AreEqual(ts_init, t_pool.getSize() + 1);
                    //                  MessageBox.Show(l_t1 + "   " + l_t2 + "  " + t_pool.getByName(name).getFeatures().getChildNodes().getLength());
                    //                  Assert.AreEqual(t_pool.getByName(name).getFeatures().getChildNodes().getLength(), l_t1 + l_t2);
                    Console.WriteLine("#Passed undo the previous insert on GUI level <<<<<<<<<<<<");
                }
                catch
                {
                    Console.WriteLine("#Failed Failed to undo the previous insert on GUI level <-----------");
                    gflag = false;
                }
                try
                {
                    try
                    {
                        Assert.AreEqual(att[4], att1[4]);
                        Assert.AreEqual(att[5], att2[5]);

                        Console.WriteLine("#Passed to compute the correct start and finish time for inserted trip <<<<<<<<<<<<");
                    }
                    catch
                    {
                        Console.WriteLine("#Failed to compute the correct start and finish time for inserted trip<-----------");
                        fflag = false;
                    }

                    try
                    {
                        Assert.AreEqual(Module.durationConverter(att[9]), att1[9]);
                        Assert.AreEqual(Module.durationConverter(att[10]), att1[10]);
                        Assert.AreEqual(Module.durationConverter(att[11]), att2[11]);
                        Assert.AreEqual(Module.durationConverter(att[12]), att2[12]);
                        Console.WriteLine("#Passed to compute the correct start and finish coordinates inserted trip");
                    }
                    catch
                    {
                        Console.WriteLine("     -----------> Failed to compute the correct start and finish coordinates inserted trip");
                        fflag = false;
                    }
                    Assert.AreEqual(fflag, true);
                    Console.WriteLine("#Passed the test for undo the previous inserted trip on file level <<<<<<<<<<<<");
                }
                catch
                {
                    Console.WriteLine("#Failed Failed the test for undo the previous inserted trip on file level <-----------");
                }
            }
            return(gflag && fflag);
        }
Exemple #8
0
        public Boolean test_undo()
        {
            bool      gflag = true;
            bool      fflag = true;
            Hashtable temp  = record.undo();

            if (temp["opt"] == "spl")
            {
                ArrayList data = (ArrayList)temp["data"];
                String    name = (String)data[0];
                //          String[] att = (String[])data[2];

                int ts_init = t_pool.getSize();
                int l_t1    = t_pool.getByName(name).getFeatures().getChildNodes().getLength();
                int l_t2    = t_pool.getByName("Trip_" + (Module.getIndex(name) + 1)).getFeatures().getChildNodes().getLength();

                String t_f = t_pool.getFinish(t_pool.getByName(name)).getName().ToString();
                String t_s = t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 1))).getName().ToString();

                core.undo(temp);
                MessageBox.Show(l_t1 + "   " + l_t2 + "  " + t_pool.getByName(name).getFeatures().getChildNodes().getLength());

                try
                {
                    Assert.AreEqual(ts_init, t_pool.getSize() + 1);
                    //                  MessageBox.Show(l_t1 + "   " + l_t2 + "  " + t_pool.getByName(name).getFeatures().getChildNodes().getLength());
                    //                  Assert.AreEqual(t_pool.getByName(name).getFeatures().getChildNodes().getLength(), l_t1 + l_t2);
                    Console.WriteLine("#Passed undo the previous split on GUI level");
                }
                catch
                {
                    Console.WriteLine("#Failed to undo the previous split on GUI level ");
                    gflag = false;
                }
                try
                {
                    IKmlObjectList days        = ge.getFeatures().getChildNodes();
                    IKmlDocument   day         = (IKmlDocument)days.item(0);
                    String         r_start     = txtedit.getViewer().Rows[0]["Start"].ToString();
                    String         r_finsih    = txtedit.getViewer().Rows[1]["Finish"].ToString();
                    String         r_duration1 = txtedit.getViewer().Rows[0]["Time"].ToString();
                    String         r_duration2 = txtedit.getViewer().Rows[1]["Time"].ToString();

                    double gap = ((Convert.ToDateTime(txtedit.getViewer().Rows[1]["Start"].ToString()) - Convert.ToDateTime(txtedit.getViewer().Rows[0]["Finish"].ToString()))).TotalSeconds;

                    String r_slon = txtedit.getViewer().Rows[0]["sLongitude"].ToString();
                    String r_flon = txtedit.getViewer().Rows[1]["fLongitude"].ToString();
                    String r_slat = txtedit.getViewer().Rows[0]["sLatitude"].ToString();
                    String r_flat = txtedit.getViewer().Rows[1]["fLatitude"].ToString();

                    txtedit.joinTrips(day.getName(), name, "Trip_" + (Module.getIndex(name) + 1), t_pool);
                    try
                    {
                        Assert.AreEqual(txtedit.getViewer().Rows[0]["Finish"].ToString(), t_f);
                        Assert.AreEqual(txtedit.getViewer().Rows[0]["Start"].ToString(), t_s);

                        Console.WriteLine("#Passed to compute the correct start and finish time");
                    }
                    catch
                    {
                        Console.WriteLine("#Failed to compute the correct start and finish time ");
                        fflag = false;
                    }
                    String flon = txtedit.getViewer().Rows[0]["fLongitude"].ToString();
                    String slat = txtedit.getViewer().Rows[0]["sLatitude"].ToString();


                    try
                    {
                        //                                Assert.AreEqual(flon, r_slon);
                        //                               Assert.AreEqual(slat, r_flon);
                        Console.WriteLine("#Passed to compute the correct start and finish coordinates");
                    }
                    catch
                    {
                        Console.WriteLine("#Failed to compute the correct start and finish coordinates");
                        fflag = false;
                    }
                    Assert.AreEqual(fflag, true);
                    Console.WriteLine("#Passed the test for undo the previous split on file level ");
                }
                catch
                {
                    Console.WriteLine("#Failed the test for undo the previous split on file level -");
                }
            }
            else if (temp["opt"] == "ins")
            {
                String name    = (String)temp["data"];
                int    ts_init = t_pool.getSize();

                MessageBox.Show(name);
                core.undo(temp);

                MessageBox.Show(ts_init + "   " + t_pool.getSize());
                try
                {
                    Assert.AreEqual(ts_init, t_pool.getSize() + 1);
                    //                  MessageBox.Show(l_t1 + "   " + l_t2 + "  " + t_pool.getByName(name).getFeatures().getChildNodes().getLength());
                    //                  Assert.AreEqual(t_pool.getByName(name).getFeatures().getChildNodes().getLength(), l_t1 + l_t2);
                    Console.WriteLine("#Passed undo the previous insert on GUI level ");
                }
                catch
                {
                    Console.WriteLine("#Failed to undo the previous insert on GUI level ");
                    gflag = false;
                }
            }


            return(gflag && fflag);
        }
Exemple #9
0
        public Boolean insert_test(String name)
        {
            String _name = "Trip_" + (Module.getIndex(name) + 1);
            //create a kml folder by tripname
            IKmlFolder temp  = t_pool.getByName(name);
            IKmlFolder temp2 = t_pool.getByName(_name);

            // // get the current placemark and the pre placemark at a given index
            //// IKmlPlacemark sst = (IKmlPlacemark)temp.getFeatures().getChildNodes().item(index - 1);
            // //IKmlPlacemark st = (IKmlPlacemark)temp.getFeatures().getChildNodes().item(index);

            // get trip size, number of trips and number of columns(lat,long ,elapse time etc)
            int pt_size     = temp.getFeatures().getChildNodes().getLength();
            int init_size_t = t_pool.getSize();
            int init_size_a = t_pool.getAttrs().Count;

            // //get the attribute data by trip name
            // String[] att = t_pool.getAttByName(name);

            // MessageBox.Show((Module.getIndex(name) + 1).ToString());
            core.insert(name, _name);


            //get index + 1 of the current trip


            Boolean gflag = true;

            // Boolean fflag = true;
            try
            {
                int final_size_t = t_pool.getSize();

                //CASE 1: compare the initial size of the t pool against the final t pool.
                Assert.AreEqual(init_size_t, final_size_t - 1);
                //Case 2: Trip is inserted between the two selected trips
                Assert.AreEqual(temp, t_pool.getByName(name));
                Assert.AreEqual(temp2, t_pool.getByName("Trip_" + (Module.getIndex(name) + 2)));

                Console.WriteLine("#Passed the test for insert the trip on GUI level ");
            }
            catch
            {
                Console.WriteLine("#Failed  the test for insert the trip on GUI level ");
                gflag = false;
            }


            try
            {
                // Test start point of newly inserted trip start pt= end pt of previous trip, finish pt = start pt of next trip


                String tp1_flon = Module.getCoordinates(t_pool.getFinish(t_pool.getByName(name)))["lon"].ToString();
                String tp1_flat = Module.getCoordinates(t_pool.getFinish(t_pool.getByName(name)))["lat"].ToString();
                String tp2_slon = Module.getCoordinates(t_pool.getStart(t_pool.getByName(_name)))["lon"].ToString();
                String tp2_slat = Module.getCoordinates(t_pool.getStart(t_pool.getByName(_name)))["lat"].ToString();

                String tp2_flon = Module.getCoordinates(t_pool.getFinish(t_pool.getByName(_name)))["lon"].ToString();
                String tp2_flat = Module.getCoordinates(t_pool.getFinish(t_pool.getByName(_name)))["lat"].ToString();
                String tp3_slon = Module.getCoordinates(t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 2))))["lon"].ToString();
                String tp3_slat = Module.getCoordinates(t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 2))))["lat"].ToString();


                Assert.AreEqual(tp2_slon, tp1_flon); Assert.AreEqual(tp2_slat, tp1_flat); //Start trip 2(lon,lat) = End trip 1(lon,lat)
                Assert.AreEqual(tp2_flon, tp3_slon); Assert.AreEqual(tp2_flat, tp3_slat); // End trip 2(lon,lat) = Start trip 3(lon,lat)


                Console.WriteLine("#Passed to compute the correct start and finish coordinates");
            }
            catch
            {
                Console.WriteLine("#Failed to compute the correct start and finish coordinates");
                gflag = false;
            }

            try
            {
                Console.WriteLine("#Passed the test for Insert the trip on file level");
            }
            catch
            {
                Console.WriteLine("#Failed the test for Insert the trip on file level");
                gflag = false;
            }


            return(gflag);
        }
Exemple #10
0
        public Boolean split_test(String name, int index)
        {
            //create a kml folder by tripname
            IKmlFolder temp = t_pool.getByName(name);

            // get the current placemark and the pre placemark at a given index
            IKmlPlacemark sst = (IKmlPlacemark)temp.getFeatures().getChildNodes().item(index - 1);
            IKmlPlacemark st  = (IKmlPlacemark)temp.getFeatures().getChildNodes().item(index);

            // get trip size, number of trips and number of columns(lat,long ,elapse time etc)
            int pt_size     = temp.getFeatures().getChildNodes().getLength();
            int init_size_t = t_pool.getSize();

            core.split(st);
            //get index + 1 of the current trip
            String _name = "Trip_" + (Module.getIndex(name) + 1);

            Boolean gflag = true;
            Boolean fflag = true;

            try
            {
                int final_size_t = t_pool.getSize();
                //compare the initial size of the t pool against the final t pool.
                Assert.AreEqual(init_size_t, final_size_t - 1);
                //compare  the split index with the size of the first half of the splitted trip
                Assert.AreEqual(index, t_pool.getByName(name).getFeatures().getChildNodes().getLength());
                // compare the split index with the size of the second half of the splitted trip
                Assert.AreEqual(pt_size - index, t_pool.getByName(_name).getFeatures().getChildNodes().getLength());
                Console.WriteLine("     >>>>>>>>>>>> Passed the test for split the trip on GUI level <<<<<<<<<<<<");
            }
            catch
            {
                Console.WriteLine("     -----------> Failed the test for split the trip on GUI level <-----------");
                gflag = false;
            }

            try
            {
                IKmlObjectList days       = ge.getFeatures().getChildNodes();
                IKmlDocument   day        = (IKmlDocument)days.item(0);
                String         r_start    = txtedit.getViewer().Rows[0]["Start"].ToString();
                String         r_finsih   = txtedit.getViewer().Rows[0]["Finish"].ToString();
                String         r_duration = txtedit.getViewer().Rows[0]["Time"].ToString();
                String         r_slon     = txtedit.getViewer().Rows[0]["sLongitude"].ToString();
                String         r_flon     = txtedit.getViewer().Rows[0]["fLongitude"].ToString();
                String         r_slat     = txtedit.getViewer().Rows[0]["sLatitude"].ToString();
                String         r_flat     = txtedit.getViewer().Rows[0]["fLatitude"].ToString();


                txtedit.splitTrip(day.getName(), Module.getIndex(name).ToString(), t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 1))), t_pool.getFinish(t_pool.getByName(name)), t_pool);
                try
                {
                    Assert.AreEqual(txtedit.getViewer().Rows[0]["Finish"].ToString(), t_pool.getFinish(t_pool.getByName(name)).getName().ToString());
                    Assert.AreEqual(txtedit.getViewer().Rows[1]["Start"].ToString(), t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 1))).getName().ToString());

                    Console.WriteLine("     >>>>>>>>>>>> Succeed to compute the correct start and finish time <<<<<<<<<<<<");
                }
                catch
                {
                    Console.WriteLine("     -----------> Failed to compute the correct start and finish time <-----------");
                    fflag = false;
                }

                try
                {
                    double tp1 = Module.durationConverter(txtedit.getViewer().Rows[0]["Time"].ToString());
                    double gap = ((Convert.ToDateTime(txtedit.getViewer().Rows[1]["Start"].ToString()) - Convert.ToDateTime(txtedit.getViewer().Rows[0]["Finish"].ToString()))).TotalSeconds;
                    double tp2 = Module.durationConverter(txtedit.getViewer().Rows[1]["Time"].ToString());

                    //       MessageBox.Show(Module.durationConverter(txtedit.getViewer().Rows[0]["Time"].ToString()) + "  " + t.ToString() + "    " + Module.durationConverter(txtedit.getViewer().Rows[1]["Time"].ToString()) + "  " + Module.durationConverter(r_duration));
                    Assert.AreEqual(Module.durationConverter(r_duration), tp1 + gap + tp2);
                    Console.WriteLine("     >>>>>>>>>>>> Succeed to compute the correct trip duration <<<<<<<<<<<<");
                }
                catch
                {
                    Console.WriteLine("     -----------> Failed to compute the correct the trip duration <-----------");
                    fflag = false;
                }

                try
                {
                    String n_slon = txtedit.getViewer().Rows[1]["sLongitude"].ToString();
                    String n_slat = txtedit.getViewer().Rows[1]["sLatitude"].ToString();
                    String n_flon = txtedit.getViewer().Rows[0]["sLongitude"].ToString();
                    String n_flat = txtedit.getViewer().Rows[0]["sLatitude"].ToString();

                    String a_slon = Module.getCoordinates(t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 1))))["lon"].ToString();
                    String a_slat = Module.getCoordinates(t_pool.getStart(t_pool.getByName("Trip_" + (Module.getIndex(name) + 1))))["lat"].ToString();

                    String a_flon = Module.getCoordinates(t_pool.getStart(t_pool.getByName(name)))["lon"].ToString();
                    String a_flat = Module.getCoordinates(t_pool.getStart(t_pool.getByName(name)))["lat"].ToString();


/*
 *                  MessageBox.Show(n_slon+"    "+a_slon);
 *                  MessageBox.Show(n_slat + "    " + a_slat);
 *
 *                  MessageBox.Show(n_flon + "    " + a_flon);
 *                  MessageBox.Show(n_flat + "    " + a_flat);
 *
 *                  Assert.AreEqual(n_slat.Trim(), a_slat.Trim());
 *                  Assert.AreEqual(n_slon.Trim(), a_slon.Trim());
 *
 *                  Assert.AreEqual(n_flat.Trim(), a_flat.Trim());
 *                  Assert.AreEqual(n_flon.Trim(), a_flon.Trim());
 */
                    Console.WriteLine("     >>>>>>>>>>>> Succeed to compute the correct start and finish coordinates <<<<<<<<<<<<<");
                }
                catch
                {
                    Console.WriteLine("     -----------> Failed to compute the correct start and finish coordinates <----------");
                    fflag = false;
                }
                Assert.AreEqual(true, fflag);
                Console.WriteLine("     >>>>>>>>>>>> Passed the test for split the trip on file level <<<<<<<<<<<<<");
            }
            catch
            {
                Console.WriteLine("     -----------> Failed the test for split the trip on file level <----------");
            }
            return(gflag && fflag);
        }
Exemple #11
0
 /*
  * get the trip info by its name
  */
 public String[] getAttByName(String name)
 {
     return((String[])_attr[Module.getIndex(name) - 1]);
 }
Exemple #12
0
 /*
  * get the trip object by its name
  */
 public IKmlFolder getByName(String name)
 {
     return((IKmlFolder)_core[Module.getIndex(name) - 1]);
 }
Exemple #13
0
        public Boolean split(IKmlPlacemark sp_point)
        {
            try
            {
                Hashtable cords = Module.getCoordinates(sp_point);

                IKmlFolder _trip = (IKmlFolder)sp_point.getParentNode();
                _trip.setVisibility(0);

                String    t_name = t_pool.getParent(sp_point.getName());
                String[]  t_att  = t_pool.getTripDetailsForTrip(Module.getIndex(t_name).ToString());
                ArrayList trip   = new ArrayList();
                trip.Add(t_name);
                trip.Add(_trip);
                trip.Add(t_att);
                record.spl_trip(trip);

                int          index = int.Parse((t_name.Split('_')[1]));
                IKmlFolder[] sub   = split(index, _trip, sp_point, null);

                IKmlPlacemark fn     = t_pool.getFinish(sub[0]);
                Hashtable     _cords = Module.getCoordinates(fn);

                String[] att_temp1 = (String[])t_att.Clone();
                String[] att_temp2 = (String[])t_att.Clone();

/*
 *              att_temp1[5] = fn.getName();
 *              att_temp2[4] = sp_point.getName();
 *
 *              att_temp1[6] = Module.duration(att_temp1[4], att_temp1[5]);
 *              att_temp2[6] = Module.duration(att_temp2[4], att_temp2[5]);
 *
 *              att_temp1[11] = _cords["lon"].ToString();
 *              att_temp1[12] = _cords["lat"].ToString();
 *
 *              att_temp2[9] = cords["lon"].ToString();
 *              att_temp2[10] = cords["lat"].ToString();
 */
                IKmlObjectList days = ge.getFeatures().getChildNodes();
                IKmlDocument   day  = (IKmlDocument)days.item(0);

                day.getFeatures().appendChild(sub[0]);
                day.getFeatures().appendChild(sub[1]);

/*
 *              if (sub[0].getFeatures().getChildNodes().getLength() <= sub[1].getFeatures().getChildNodes().getLength())
 *              {
 *                  double distance = Module.calDistance(sub[0]);
 *                  att_temp1[7] = distance.ToString();
 *                  att_temp2[7] = (double.Parse(t_att[7]) - distance).ToString();
 *              }
 *              else
 *              {
 *                  double distance = Module.calDistance(sub[1]);
 *                  att_temp2[7] = distance.ToString();
 *                  att_temp1[7] = (double.Parse(t_att[7]) - distance).ToString();
 *              }
 */
                /*
                 * The duration of a trip from might be less than 0 when the program interpreter inconsistent kml and txt file
                 *
                 * chen
                 */
                /*               try
                 *             {
                 *                 att_temp1[8] = Math.Round((double.Parse(att_temp1[7]) / Module.durationConverter(att_temp1[6])), 3).ToString();
                 *                 att_temp2[8] = Math.Round((double.Parse(att_temp2[7]) / Module.durationConverter(att_temp2[6])), 3).ToString();
                 *             }
                 *             catch
                 *             {
                 *                 MessageBox.Show("kml and txt file doesn't match");
                 *                 att_temp2[8] = "-0";
                 *                 att_temp1[8] = "-0";
                 *             }
                 */
                t_pool.insert(index, sub[0], att_temp1, sub[1], att_temp2);

                return(true);
            }
            catch
            {
                return(false);
            }
        }