获取指定图层所有几何对象
static int allocate_memory(unsigned int nbytes, void **where)
{
int
resp;
*where = UF_allocate_memory(nbytes, &resp);
return resp;
}
static int make_an_array(uf_list_p_t *object_list, tag_t **objects)
{
int
ii,
n;
uf_list_p_t
temp;
UF_CALL(UF_MODL_ask_list_count(*object_list, &n));
UF_CALL(allocate_memory(n * sizeof(tag_t), (void **)objects));
for (ii = 0, temp = *object_list; ii < n; temp = temp->next, ii++)
(*objects)[ii] = temp->eid;
UF_CALL(UF_MODL_delete_list(object_list));
return n;
}
static int ask_all_objects_on_layer(int layer, tag_t **objects)
{
tag_t
object = NULL_TAG;
uf_list_p_t
list;
UF_CALL(UF_MODL_create_list(&list));
while (!UF_CALL(UF_LAYER_cycle_by_layer(layer, &object)) &&
(object != NULL_TAG)) UF_CALL(UF_MODL_put_list_item(list, object));
return make_an_array(&list, objects);
}
评论区