if (! sel)
return 1;
while (sel) {
- if (coord_rect_overlap(r, &sel->rect))
+ if (coord_rect_overlap(r, &sel->u.c_rect))
return 1;
sel=sel->next;
}
flags = GO_GET_SORTED;
if (sel) {
- r.lulat = sel->rect.lu.y;
- r.lulong = sel->rect.lu.x;
- r.rllat = sel->rect.rl.y;
- r.rllong = sel->rect.rl.x;
+ r.lulat = sel->u.c_rect.lu.y;
+ r.lulong = sel->u.c_rect.lu.x;
+ r.rllat = sel->u.c_rect.rl.y;
+ r.rllong = sel->u.c_rect.rl.x;
level = get_level(sel);
// level = nl2gl[level].g;
dlog(2, "Looking level=%d for %f %f %f %f\n",
mr->b.bt.p=NULL;
mr->b.bt.block_count=0;
}
- if (mr->cur_sel && !coord_rect_overlap(&mr->cur_sel->rect, &mr->b.b_rect))
+ if (mr->cur_sel && !coord_rect_overlap(&mr->cur_sel->u.c_rect, &mr->b.b_rect))
return 0;
return block_next(mr);
}
dbg(1,"empty blocks\n");
return 0;
}
- if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->rect, &mr->b.b->r)) {
+ if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->u.c_rect, &mr->b.b->r)) {
block_active_count++;
block_active_mem+=mr->b.b->blocks*512-sizeof(struct block *);
dbg(1,"block ok\n");
mr->b.b=NULL;
if (blk_num != -1) {
block_mem+=8;
- if (coord_rect_overlap(&mr->cur_sel->rect, &bt->r_curr)) {
+ if (coord_rect_overlap(&mr->cur_sel->u.c_rect, &bt->r_curr)) {
mr->b.b=block_get_byid(mr->file, blk_num, &mr->b.p);
mr->b.block_num=blk_num;
g_assert(mr->b.b != NULL);
poly->poly_num++;
r.lu=poly->c[0];
r.rl=poly->c[1];
- if (mr->cur_sel && (poly->order > mr->cur_sel->order[layer_poly]*3 || !coord_rect_overlap(&mr->cur_sel->rect, &r))) {
+ if (mr->cur_sel && (poly->order > mr->cur_sel->order[layer_poly]*3 || !coord_rect_overlap(&mr->cur_sel->u.c_rect, &r))) {
poly->subpoly_num_all+=poly->polys;
mr->b.p=poly->poly_next;
continue;
twn->cidx=0;
twn->aidx=0;
twn->attr_next=attr_label;
- if (! mr->cur_sel || (twn->order <= limit[mr->cur_sel->order[layer_town]] && coord_rect_contains(&mr->cur_sel->rect,&twn->c))) {
+ if (! mr->cur_sel || (twn->order <= limit[mr->cur_sel->order[layer_town]] && coord_rect_contains(&mr->cur_sel->u.c_rect,&twn->c))) {
switch(twn->type) {
case 1:
size=twn->size;
#include "maptype.h"
#include "item.h"
#include "attr.h"
-#include "coord.h"
#include "transform.h"
#include "file.h"
pro=map_projection(m);
conv=map_requires_conversion(m);
- transform_rect(t, pro, &sel->rect);
+ transform_rect(t, pro, &sel->u.c_rect);
if (route_selection)
mr=map_rect_new(m, route_selection);
else
struct map_priv;
struct attr;
#include "coord.h"
+#include "point.h"
#include "layer.h"
struct map_selection {
struct map_selection *next;
- struct coord_rect rect;
+ union {
+ struct coord_rect c_rect;
+ struct point_rect p_rect;
+ } u;
int order[layer_end];
};
sel.order[layer_poly]=0;
#endif
center=transform_center(this_->trans);
- sel.rect.lu.x=center->x-dist;
- sel.rect.lu.y=center->y+dist;
- sel.rect.rl.x=center->x+dist;
- sel.rect.rl.y=center->y-dist;
- dbg(2,"0x%x,0x%x - 0x%x,0x%x\n", sel.rect.lu.x, sel.rect.lu.y, sel.rect.rl.x, sel.rect.rl.y);
+ sel.u.c_rect.lu.x=center->x-dist;
+ sel.u.c_rect.lu.y=center->y+dist;
+ sel.u.c_rect.rl.x=center->x+dist;
+ sel.u.c_rect.rl.y=center->y-dist;
+ dbg(2,"0x%x,0x%x - 0x%x,0x%x\n", sel.u.c_rect.lu.x, sel.u.c_rect.lu.y, sel.u.c_rect.rl.x, sel.u.c_rect.rl.y);
nwi->click=callback_new_2(callback_cast(navit_window_items_click), this_, nwi);
nwi->win=gui_datawindow_new(this_->gui, nwi->name, nwi->click, NULL);
h=mapset_open(navit_get_mapset(this_));
dbg(2,"mr=%p\n", mr);
while ((item=map_rect_get_item(mr))) {
if (item_coord_get(item, &c, 1)) {
- if (coord_rect_contains(&sel.rect, &c) && g_hash_table_lookup(nwi->hash, &item->type)) {
+ if (coord_rect_contains(&sel.u.c_rect, &c) && g_hash_table_lookup(nwi->hash, &item->type)) {
if (! item_attr_get(item, attr_label, &attr))
attr.u.str="";
idist=transform_distance(map_projection(item->map), center, &c);
navit_draw(nav);
}
-/** @} */
\ No newline at end of file
+/** @} */
int y;
};
+struct point_rect {
+ struct point lu;
+ struct point rl;
+};
#endif
dy=c1->y-c2->y;
if (dx < 0) {
sx=-1;
- sel->rect.lu.x=c1->x;
- sel->rect.rl.x=c2->x;
+ sel->u.c_rect.lu.x=c1->x;
+ sel->u.c_rect.rl.x=c2->x;
} else {
- sel->rect.lu.x=c2->x;
- sel->rect.rl.x=c1->x;
+ sel->u.c_rect.lu.x=c2->x;
+ sel->u.c_rect.rl.x=c1->x;
}
if (dy < 0) {
sy=-1;
- sel->rect.lu.y=c2->y;
- sel->rect.rl.y=c1->y;
+ sel->u.c_rect.lu.y=c2->y;
+ sel->u.c_rect.rl.y=c1->y;
} else {
- sel->rect.lu.y=c1->y;
- sel->rect.rl.y=c2->y;
+ sel->u.c_rect.lu.y=c1->y;
+ sel->u.c_rect.rl.y=c2->y;
}
if (dx*sx > dy*sy)
d=dx*sx;
else
d=dy*sy;
m=d*rel/100+abs;
- sel->rect.lu.x-=m;
- sel->rect.rl.x+=m;
- sel->rect.lu.y+=m;
- sel->rect.rl.y-=m;
+ sel->u.c_rect.lu.x-=m;
+ sel->u.c_rect.rl.x+=m;
+ sel->u.c_rect.lu.y+=m;
+ sel->u.c_rect.rl.y-=m;
sel->next=NULL;
return sel;
}