… | |
… | |
271 | { |
271 | { |
272 | struct layer *l; |
272 | struct layer *l; |
273 | |
273 | |
274 | l = g_new0(struct layer, 1); |
274 | l = g_new0(struct layer, 1); |
275 | l->active = 1; |
275 | l->active = 1; |
|
|
276 | |
276 | for (; *attrs; attrs++) |
277 | for (; *attrs; attrs++) |
277 | { |
278 | { |
278 | layer_set_attr_do(l, *attrs, 1); |
279 | layer_set_attr_do(l, *attrs, 1); |
279 | } |
280 | } |
|
|
281 | |
280 | return l; |
282 | return l; |
281 | } |
283 | } |
282 | |
284 | |
283 | int layer_get_attr(struct layer *layer, enum attr_type type, struct attr *attr, struct attr_iter *iter) |
285 | int layer_get_attr(struct layer *layer, enum attr_type type, struct attr *attr, struct attr_iter *iter) |
284 | { |
286 | { |
… | |
… | |
337 | speed_range = attr_search(attrs, NULL, attr_speed_range); |
339 | speed_range = attr_search(attrs, NULL, attr_speed_range); |
338 | angle_range = attr_search(attrs, NULL, attr_angle_range); |
340 | angle_range = attr_search(attrs, NULL, attr_angle_range); |
339 | sequence_range = attr_search(attrs, NULL, attr_sequence_range); |
341 | sequence_range = attr_search(attrs, NULL, attr_sequence_range); |
340 | defrange.min = 0; |
342 | defrange.min = 0; |
341 | defrange.max = 32767; |
343 | defrange.max = 32767; |
|
|
344 | |
342 | if (order) |
345 | if (order) |
343 | itm->order = order->u.range; |
346 | itm->order = order->u.range; |
344 | else |
347 | else |
345 | itm->order = defrange; |
348 | itm->order = defrange; |
346 | if (speed_range) |
349 | if (speed_range) |
… | |
… | |
353 | itm->angle_range = defrange; |
356 | itm->angle_range = defrange; |
354 | if (sequence_range) |
357 | if (sequence_range) |
355 | itm->sequence_range = sequence_range->u.range; |
358 | itm->sequence_range = sequence_range->u.range; |
356 | else |
359 | else |
357 | itm->sequence_range = defrange; |
360 | itm->sequence_range = defrange; |
|
|
361 | |
358 | if (item_types) |
362 | if (item_types) |
359 | { |
363 | { |
360 | type = item_types->u.item_types; |
364 | type = item_types->u.item_types; |
|
|
365 | |
361 | while (type && *type != type_none) |
366 | while (type && *type != type_none) |
362 | { |
367 | { |
363 | itm->type = g_list_append(itm->type, GINT_TO_POINTER(*type)); |
368 | itm->type = g_list_append(itm->type, GINT_TO_POINTER(*type)); |
364 | type++; |
369 | type++; |
365 | } |
370 | } |
… | |
… | |
367 | |
372 | |
368 | //dbg(0,"return\n"); |
373 | //dbg(0,"return\n"); |
369 | |
374 | |
370 | return itm; |
375 | return itm; |
371 | } |
376 | } |
|
|
377 | |
372 | int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) |
378 | int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) |
373 | { |
379 | { |
374 | switch (attr->type) |
380 | switch (attr->type) |
375 | { |
381 | { |
376 | case attr_polygon: |
382 | case attr_polygon: |
… | |
… | |
381 | case attr_image: |
387 | case attr_image: |
382 | case attr_maptile: |
388 | case attr_maptile: |
383 | case attr_arrows: |
389 | case attr_arrows: |
384 | itemgra->elements = g_list_append(itemgra->elements, attr->u.element); |
390 | itemgra->elements = g_list_append(itemgra->elements, attr->u.element); |
385 | return 1; |
391 | return 1; |
|
|
392 | |
386 | default: |
393 | default: |
387 | dbg(0, "unknown: %s\n", attr_to_name(attr->type)); |
394 | dbg(0, "unknown: %s\n", attr_to_name(attr->type)); |
388 | return 0; |
395 | return 0; |
389 | } |
396 | } |
390 | } |
397 | } |