Exemplo n.º 1
0
static int
poly_coord_get(void *priv_data, struct coord *c, int count)
{
    struct gobject *g = priv_data;
    struct map_rect_priv *mr = g->priv_data;
    int ndeltas = 0, total = 0;
    struct gcoord dc;

    if (!count)
        return 0;

    if (g != mr->last_itterated) {
        mr->last_itterated = g;
        mr->last_coord = 0;
    }
    ndeltas = gar_get_object_deltas(g);
    if (mr->last_coord > ndeltas + 1)
        return 0;
    while (count --) {
        if (mr->last_coord == 0) {
            gar_get_object_coord(mr->gmap, g, &dc);
            mr->last_c.x = dc.x;
            mr->last_c.y = dc.y;
        } else {
            if (!gar_get_object_dcoord(mr->gmap, g, mr->last_coord - 1, &dc)) {
                mr->last_coord = ndeltas + 2;
                return total;
            }
            mr->last_c.x += dc.x;
            mr->last_c.y += dc.y;
        }
        c->x = mr->last_c.x;
        c->y = mr->last_c.y;
        ddlog(1, "poly: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
//		dlog(1,"poly: x=%d y=%d\n", c->x, c->y);
        c++;
        total++;
        total++;
        mr->last_coord ++;
    }
    return total;
}
Exemplo n.º 2
0
static int 
search_coord_get(void *priv_data, struct coord *c, int count)
{
	struct gobject *g = priv_data;
	struct map_rect_priv *mr = g->priv_data;
	struct gcoord gc;
	if (!count)
		return 0;
	if (g != mr->last_itterated) {
		mr->last_itterated = g;
		mr->last_coord = 0;
	}

	if (mr->last_coord > 0)
		return 0;

	if (gar_get_object_coord(mr->gmap, g, &gc)) {
		c->x = gc.x;
		c->y = gc.y;
		mr->last_coord++;
		return 1;
	}
	return 0;
}
Exemplo n.º 3
0
static int 
point_coord_get(void *priv_data, struct coord *c, int count)
{
	struct gobject *g = priv_data;
	struct map_rect_priv *mr = g->priv_data;
	struct gcoord gc;
	if (!count)
		return 0;
	if (g != mr->last_itterated) {
		mr->last_itterated = g;
		mr->last_coord = 0;
	}

	if (mr->last_coord > 0)
		return 0;

	gar_get_object_coord(mr->gmap, g, &gc);
	c->x = gc.x;
	c->y = gc.y;
	mr->last_coord++;
//	dlog(1,"point: x=%d y=%d\n", c->x, c->y);
	// dlog(1, "point: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
	return 1;
}