Ticket #46: multipoint.diff

File multipoint.diff, 4.6 KB (added by tegzed, 9 years ago)

multi waypoint routing lead out to internal gui

  • route.h

     
    9696void route_set_destinations(struct route *this_, struct pcoord *dst, int count, int async);
    9797int route_get_destinations(struct route *this_, struct pcoord *pc, int count);
    9898void route_set_destination(struct route *this_, struct pcoord *dst, int async);
     99void route_add_destination(struct route *this, struct pcoord *dst, int async);
    99100void route_remove_waypoint(struct route *this_);
    100101struct coord route_get_coord_dist(struct route *this_, int dist);
    101102struct street_data *street_get_data(struct item *item);
  • route.c

     
    10591059        route_set_destinations(this, dst, dst?1:0, async);
    10601060}
    10611061
     1062 
    10621063void
     1064route_add_destination(struct route *this, struct pcoord *dst, int async)
     1065{
     1066        const int pcs_max_size = 100;
     1067        struct pcoord pcs[pcs_max_size];
     1068        int dstnum = 0;
     1069        dstnum = route_get_destinations(this, pcs, pcs_max_size);
     1070        pcs[dstnum].x=dst->x;
     1071        pcs[dstnum].y=dst->y;
     1072        pcs[dstnum].pro=projection_mg; /* FIXME */
     1073        route_set_destinations(this, pcs, dstnum + (dst?1:0), async);
     1074        //route_set_destinations(this, dst, dst?1:0, async);
     1075}
     1076
     1077void
    10631078route_remove_waypoint(struct route *this)
    10641079{
    10651080        struct route_path *path=this->path2;
  • navit.h

     
    7171struct vehicleprofile *navit_get_vehicleprofile(struct navit *this_);
    7272GList *navit_get_vehicleprofiles(struct navit *this_);
    7373void navit_set_destination(struct navit *this_, struct pcoord *c, const char *description, int async);
     74void navit_add_destination(struct navit *this_, struct pcoord *c, const char *description, int async);
    7475void navit_set_destinations(struct navit *this_, struct pcoord *c, int count, const char *description, int async);
    7576int navit_check_route(struct navit *this_);
    7677void navit_textfile_debug_log(struct navit *this_, const char *fmt, ...);
  • navit.c

     
    853853        callback_list_call_attr_0(this_->attr_cbl, attr_destination);
    854854        if (this_->route) {
    855855                route_set_destination(this_->route, c, async);
     856                if (this_->ready == 3)
     857                        navit_draw(this_);
     858        }
     859}
    856860
     861void
     862navit_add_destination(struct navit *this_, struct pcoord *c, const char *description, int async)
     863{
     864        if (c) {
     865                this_->destination=*c;
     866                this_->destination_valid=1;
     867        } else
     868                this_->destination_valid=0;
     869        char *destination_file = bookmarks_get_destination_file(TRUE);
     870        bookmarks_append_coord(this_->bookmarks, destination_file, c, 1, "former_destination", description, NULL, this_->recentdest_count);
     871        g_free(destination_file);
     872        callback_list_call_attr_0(this_->attr_cbl, attr_destination);
     873        if (this_->route) {
     874                route_add_destination(this_->route, c, async);
     875
    857876                if (this_->ready == 3)
    858877                        navit_draw(this_);
    859878        }
     
    20622081                navit_vehicle_draw(this_, nv, NULL);
    20632082                profile(0,"return 3\n");
    20642083                return;
    2065         }
     2084        }
    20662085        cursor_pc.x = nv->coord.x;
    20672086        cursor_pc.y = nv->coord.y;
    20682087        cursor_pc.pro = pro;
  • gui/internal/gui_internal.c

     
    19011901}
    19021902
    19031903static void
     1904gui_internal_cmd_add_destination(struct gui_priv *this, struct widget *wm, void *data)
     1905{
     1906        char *name=data;
     1907        dbg(0,"c=%d:0x%x,0x%x\n", wm->c.pro, wm->c.x, wm->c.y);
     1908        navit_add_destination(this->nav, &wm->c, name, 1);
     1909        if (this->flags & 512) {
     1910                struct attr follow;
     1911                follow.type=attr_follow;
     1912                follow.u.num=180;
     1913                navit_set_attr(this->nav, &this->osd_configuration);
     1914                navit_set_attr(this->nav, &follow);
     1915                navit_zoom_to_route(this->nav, 0);
     1916        }
     1917        gui_internal_prune_menu(this, NULL);
     1918}
     1919
     1920static void
    19041921gui_internal_cmd_set_position(struct gui_priv *this, struct widget *wm, void *data)
    19051922{
    19061923        navit_set_position(this->nav, &wm->c);
     
    26742691                                gui_internal_cmd_delete_bookmark, NULL));
    26752692                wbc->text=g_strdup(wm->text);
    26762693        }
     2694        if (flags & 1024) {
     2695                gui_internal_widget_append(w,
     2696                        wbc=gui_internal_button_new_with_callback(this, _("Add destination"),
     2697                                image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
     2698                                gui_internal_cmd_add_destination, g_strdup(name)));
     2699                wbc->data_free=g_free_func;
     2700                wbc->c=pc;
     2701        }
    26772702        gui_internal_menu_render(this);
    26782703}
    26792704