Logo Search packages:      
Sourcecode: navit version File versions

static int map_selection_contains_point ( struct map_selection sel,
struct coord c 
) [inline, static]

Checks if a coordinate is within a map selection.

Checks if a coordinate is within a map selection. Note that since a selection of NULL means "select everything", with sel = NULL this will always return true. If there are more than one selection in a linked-list, it is sufficient if only one of the selections contains the coordinate.

sel The selection to check if the point is within
c Coordinate to check if it is within the selection
True if the coordinate is within one of the selections, False otherwise

Definition at line 93 of file map.h.

References map_selection::c_rect, map_selection::next, map_selection::u, coord::x, and coord::y.

      struct map_selection *curr=sel;
        while (curr) {
                struct coord_rect *r=&curr->u.c_rect;
                if (c->x >= r->lu.x && c->x <= r->rl.x &&
                    c->y <= r->lu.y && c->y >= r->rl.y)
                        return 1;
        return sel ? 0:1;

Generated by  Doxygen 1.6.0   Back to index