void bookmarks_write_center_to_file(struct bookmarks *this_, char *file) { dbg(0,"EEnter\n"); FILE *f; enum projection pro; struct coord *center; f = fopen(file, "w+"); if (f) { // save (pixel-on-screen width/2 height/2) screen center struct coord_geo g22; struct coord c22; struct point p; int width, height; transform_get_size(this_->trans, &width, &height); p.x=width/2; p.y=height/2; transform_reverse(this_->trans, &p, &c22); //dbg(0,"%f, %f\n",a, b); //dbg(0,"%d, %d\n",p.x, p.y); // * transform_to_geo(projection_mg, &c22, &g22); //dbg(0,"%d, %d, %f, %f\n",c22.x, c22.y, g22.lat, g22.lng); // * result=g_strdup_printf("%f:%f",g22.lat,g22.lng); // + center = transform_center(this_->trans); pro = transform_get_projection(this_->trans); // + coord_print(pro, center, f); coord_print(pro, &c22, f); fclose(f); dbg(0,"******** write center to file *********\n"); } else { perror(file); } dbg(0,"ready\n"); return; }
static void navit_set_center_cursor(struct navit *this_, struct coord *cursor, int dir, int xpercent, int ypercent) { struct coord *c=transform_center(this_->trans); int width, height; struct point p; struct coord cnew; transform_get_size(this_->trans, &width, &height); *c=*cursor; transform_set_angle(this_->trans, dir); p.x=(100-xpercent)*width/100; p.y=(100-ypercent)*height/100; transform_reverse(this_->trans, &p, &cnew); *c=cnew; if (this_->ready) navit_draw(this_); }
static void info_action(GtkWidget *w, struct navit *nav, void *dummy) { char buffer[512]; int mw,mh; struct coord lt, rb; struct point p; struct transformation *t; t=navit_get_trans(nav); transform_get_size(t, &mw, &mh); p.x=0; p.y=0; transform_reverse(t, &p, <); p.x=mw; p.y=mh; transform_reverse(t, &p, &rb); sprintf(buffer,"./info.sh %d,%d 0x%x,0x%x 0x%x,0x%x", mw, mh, lt.x, lt.y, rb.x, rb.y); system(buffer); }