Example #1
0
        public Boolean undo(Hashtable mem)
        {
            try
            {
                if (mem["opt"] == "del")
                {
                    ArrayList rev = (ArrayList)mem["data"];

                    IKmlFolder _trip = (IKmlFolder)rev[1];
                    _trip.setVisibility(1);
                    t_pool.add((String)rev[0], _trip, (String[])rev[2]);
                }
                else if (mem["opt"] == "spl")
                {
                    ArrayList  rev  = (ArrayList)mem["data"];
                    IKmlFolder trip = (IKmlFolder)rev[1];

                    t_pool.insert((String)rev[0], trip, (String[])rev[2], ge.createStyle(""));
                    trip.setVisibility(1);
                    IKmlObjectList days = ge.getFeatures().getChildNodes();
                    IKmlDocument   day  = (IKmlDocument)days.item(0);
                    day.getFeatures().appendChild(trip);
                }
                else if (mem["opt"] == "joi")
                {
                    ArrayList  rev  = (ArrayList)mem["data"];
                    IKmlFolder temp = ge.createFolder("");

                    String       name = (String)rev[0];
                    IKmlFolder[] sub  = split(int.Parse((name.Split('_')[1])), t_pool.getByName(name), (IKmlPlacemark)rev[1], (String)rev[4]);

                    IKmlObjectList days = ge.getFeatures().getChildNodes();
                    IKmlDocument   day  = (IKmlDocument)days.item(0);

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

                    t_pool.insert(int.Parse((name.Split('_')[1])), sub[0], (String[])rev[2], sub[1], (String[])rev[3]);
                }
                else if (mem["opt"] == "ins")
                {
                    String     rev  = (String)mem["data"];
                    IKmlFolder trip = t_pool.getByName(rev);
                    trip.setVisibility(0);

                    t_pool.remove(rev);
                }
                else if (mem["opt"] == "crt")
                {
                    IKmlPlacemark pt = (IKmlPlacemark)mem["data"];
                    ge.getFeatures().removeChild(pt);
                }
                else if (mem["opt"] == "mk_start" || mem["opt"] == "mk_finish")
                {
                    ArrayList     rev  = (ArrayList)mem["data"];
                    IKmlPlacemark pt   = (IKmlPlacemark)rev[1];
                    IKmlFolder    trip = t_pool.getByName((String)rev[0]);
                    //trip.getFeatures().removeChild(pt);
                    //ge.getFeatures().appendChild(pt);
                }
                else if (mem["opt"] == "tm_start")
                {
                    ArrayList      rev    = (ArrayList)mem["data"];
                    IKmlFolder     trip   = t_pool.getByName((String)rev[0]);
                    IKmlObjectList points = trip.getFeatures().getChildNodes();
//                   MessageBox.Show(points.getLength().ToString()+" "+rev.Count.ToString());
                    for (int i = rev.Count - 1; i != 0; i--)
                    {
                        points = trip.getFeatures().getChildNodes();
                        trip.getFeatures().insertBefore(rev[i], points.item(0));
                    }
                }
                else if (mem["opt"] == "tm_finish")
                {
                    ArrayList      rev    = (ArrayList)mem["data"];
                    IKmlFolder     trip   = t_pool.getByName((String)rev[0]);
                    IKmlObjectList points = trip.getFeatures().getChildNodes();
                    //                   MessageBox.Show(points.getLength().ToString()+" "+rev.Count.ToString());
                    for (int i = rev.Count - 1; i != 0; i--)
                    {
                        points = trip.getFeatures().getChildNodes();
                        trip.getFeatures().insertBefore(rev[i], points.item(points.getLength() - 1));
                    }
                }
                else if (mem["opt"] == "ch_color")
                {
                    ArrayList rev = (ArrayList)mem["data"];
                    t_pool.ch_col((String)rev[0], (String)rev[1]);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }