struct layout *layout_current;
struct graphics *gra;
struct action *action;
- struct transformation *trans;
+ struct transformation *trans, *trans_cursor;
struct compass *compass;
struct route *route;
struct navigation *navigation;
int drag_bitmap;
int use_mousewheel;
struct messagelist *messages;
- struct callback *resize_callback,*button_callback,*motion_callback;
+ struct callback *resize_callback,*button_callback,*motion_callback,*postdraw_callback;
struct vehicleprofile *vehicleprofile;
GList *vehicleprofiles;
int pitch;
}
static void
+navit_postdraw(struct navit *this)
+{
+ transform_copy(this->trans, this->trans_cursor);
+}
+
+static void
navit_scale(struct navit *this_, long scale, struct point *p, int draw)
{
struct coord c1, c2, *center;
this_->border = 16;
this_->trans = transform_new();
+ this_->trans_cursor = transform_new();
transform_from_geo(pro, &g, &co);
center.x=co.x;
center.y=co.y;
graphics_add_callback(gra, this_->button_callback);
this_->motion_callback=callback_new_attr_1(callback_cast(navit_motion), attr_motion, this_);
graphics_add_callback(gra, this_->motion_callback);
+ this_->postdraw_callback=callback_new_attr_1(callback_cast(navit_postdraw), attr_postdraw, this_);
+ graphics_add_callback(gra, this_->postdraw_callback);
return 1;
}
if (pnt)
cursor_pnt=*pnt;
else {
- pro=transform_get_projection(this_->trans);
- transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
+ pro=transform_get_projection(this_->trans_cursor);
+ if (!pro)
+ return;
+ transform(this_->trans_cursor, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
}
- vehicle_draw(nv->vehicle, this_->gra, &cursor_pnt, pnt ? 0:1, nv->dir-transform_get_yaw(this_->trans), nv->speed);
+ vehicle_draw(nv->vehicle, this_->gra, &cursor_pnt, pnt ? 0:1, nv->dir-transform_get_yaw(this_->trans_cursor), nv->speed);
#if 0
if (pnt)
pnt2=*pnt;
struct point cursor_pnt, *pnt=&cursor_pnt;
struct tracking *tracking=NULL;
struct pcoord pc[16];
- enum projection pro=transform_get_projection(this_->trans);
+ enum projection pro=transform_get_projection(this_->trans_cursor);
int count;
int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *);
void *attr_object;
if (this_->gui && nv->speed > 2)
navit_disable_suspend();
- transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
+ transform(this_->trans_cursor, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
if (this_->button_pressed != 1 && this_->follow_cursor && nv->follow_curr <= nv->follow &&
- (nv->follow_curr == 1 || !transform_within_border(this_->trans, &cursor_pnt, this_->border)))
+ (nv->follow_curr == 1 || !transform_within_border(this_->trans_cursor, &cursor_pnt, this_->border)))
navit_set_center_cursor_draw(this_);
else
navit_vehicle_draw(this_, nv, pnt);
if(this_->gra)
graphics_remove_callback(this_->gra, this_->motion_callback);
callback_destroy(this_->motion_callback);
+ if(this_->gra)
+ graphics_remove_callback(this_->gra, this_->postdraw_callback);
+ callback_destroy(this_->postdraw_callback);
route_destroy(this_->route);
g_free(this_);
}
void transform_project(enum projection pro, struct coord *c, int distance, int angle, struct coord *res);
double transform_polyline_length(enum projection pro, struct coord *c, int count);
int transform_distance_sq(struct coord *c1, struct coord *c2);
+navit_float transform_distance_sq_float(struct coord *c1, struct coord *c2);
int transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2);
int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
+navit_float transform_distance_line_sq_float(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos);
int transform_douglas_peucker(struct coord *in, int count, int dist_sq, struct coord *out);
int transform_douglas_peucker_float(struct coord *in, int count, navit_float dist_sq, struct coord *out);
int transform_within_dist_polyline(struct coord *ref, struct coord *c, int count, int close, int dist);
int transform_within_dist_polygon(struct coord *ref, struct coord *c, int count, int dist);
int transform_within_dist_item(struct coord *ref, enum item_type type, struct coord *c, int count, int dist);
+void transform_copy(struct transformation *src, struct transformation *dst);
void transform_destroy(struct transformation *t);
/* end of prototypes */
#ifdef __cplusplus