From e246b06ffe892d45da842e08c75841d38919c889 Mon Sep 17 00:00:00 2001 From: martin-s Date: Fri, 26 Feb 2010 20:30:38 +0000 Subject: [PATCH] Fix:Core:Convert transformation while rendering git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2973 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/graphics.c | 4 ++++ navit/navit/transform.c | 14 ++++++++++++++ navit/navit/transform.h | 1 + 3 files changed, 19 insertions(+) diff --git a/navit/navit/graphics.c b/navit/navit/graphics.c index c102941..b279225 100644 --- a/navit/navit/graphics.c +++ b/navit/navit/graphics.c @@ -1808,8 +1808,10 @@ do_draw(struct displaylist *displaylist, int cancel, int flags) int count,max=displaylist->dc.maxlen,workload=0; struct coord ca[max]; struct attr attr,attr2; + enum projection pro; profile(0,NULL); + pro=transform_get_projection(displaylist->dc.trans); while (!cancel) { if (!displaylist->msh) displaylist->msh=mapset_open(displaylist->ms); @@ -1832,6 +1834,8 @@ do_draw(struct displaylist *displaylist, int cancel, int flags) count=item_coord_get_within_selection(item, ca, item->type < type_line ? 1: max, displaylist->sel); if (! count) continue; + if (displaylist->dc.pro != pro) + transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count); if (count == max) { dbg(0,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item)); displaylist->dc.maxlen=max*2; diff --git a/navit/navit/transform.c b/navit/navit/transform.c index 4708c02..86dae1c 100644 --- a/navit/navit/transform.c +++ b/navit/navit/transform.c @@ -300,6 +300,20 @@ transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c) } void +transform_from_to_count(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to, int count) +{ + struct coord_geo g; + int i; + + for (i = 0 ; i < count ; i++) { + transform_to_geo(from, cfrom, &g); + transform_from_geo(to, &g, cto); + cfrom++; + cto++; + } +} + +void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to) { struct coord_geo g; diff --git a/navit/navit/transform.h b/navit/navit/transform.h index 02a47e4..9d4f333 100644 --- a/navit/navit/transform.h +++ b/navit/navit/transform.h @@ -49,6 +49,7 @@ void transform_set_order_base(struct transformation *this_, int order_base); struct transformation *transform_dup(struct transformation *t); void transform_to_geo(enum projection pro, struct coord *c, struct coord_geo *g); void transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c); +void transform_from_to_count(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to, int count); void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to); void transform_geo_to_cart(struct coord_geo *geo, navit_float a, navit_float b, struct coord_geo_cart *cart); void transform_cart_to_geo(struct coord_geo_cart *cart, navit_float a, navit_float b, struct coord_geo *geo); -- 2.7.4