350 |
|
|
351 |
/* use implicit selection if not explicitely given */ |
/* use implicit selection if not explicitely given */ |
352 |
if(!object) { |
if(!object) { |
353 |
g_assert(appdata->map->selected.type != MAP_TYPE_ILLEGAL); |
g_assert((appdata->map->selected.object.type == NODE) || |
354 |
switch(appdata->map->selected.type) { |
(appdata->map->selected.object.type == WAY) || |
355 |
case MAP_TYPE_NODE: |
(appdata->map->selected.object.type == RELATION)); |
356 |
context->object.type = NODE; |
|
357 |
context->object.node = appdata->map->selected.node; |
context->object = appdata->map->selected.object; |
|
break; |
|
|
case MAP_TYPE_WAY: |
|
|
context->object.type = WAY; |
|
|
context->object.way = appdata->map->selected.way; |
|
|
break; |
|
|
case MAP_TYPE_RELATION: |
|
|
context->object.type = RELATION; |
|
|
context->object.relation = appdata->map->selected.relation; |
|
|
break; |
|
|
default: |
|
|
printf("ERROR: info_dialog not on NODE, WAY or RELATION\n"); |
|
|
g_assert(0); |
|
|
break; |
|
|
} |
|
358 |
} else |
} else |
359 |
context->object = *object; |
context->object = *object; |
360 |
|
|
380 |
|
|
381 |
break; |
break; |
382 |
|
|
383 |
case MAP_TYPE_RELATION: |
case RELATION: |
384 |
str = g_strdup_printf(_("Relation #%ld"), context->object.relation->id); |
str = g_strdup_printf(_("Relation #%ld"), context->object.relation->id); |
385 |
user = context->object.relation->user; |
user = context->object.relation->user; |
386 |
work_copy = osm_tags_copy(context->object.relation->tag, FALSE); |
work_copy = osm_tags_copy(context->object.relation->tag, FALSE); |
389 |
break; |
break; |
390 |
|
|
391 |
default: |
default: |
392 |
g_assert((context->object.type == MAP_TYPE_NODE) || |
g_assert((context->object.type == NODE) || |
393 |
(context->object.type == MAP_TYPE_WAY) || |
(context->object.type == WAY) || |
394 |
(context->object.type == MAP_TYPE_RELATION)); |
(context->object.type == RELATION)); |
395 |
break; |
break; |
396 |
} |
} |
397 |
|
|
438 |
switch(context->object.type) { |
switch(context->object.type) { |
439 |
case NODE: { |
case NODE: { |
440 |
char pos_str[32]; |
char pos_str[32]; |
441 |
pos_lat_str(pos_str, sizeof(pos_str),appdata->map->selected.node->pos.lat); |
pos_lat_str(pos_str, sizeof(pos_str), context->object.node->pos.lat); |
442 |
label = gtk_label_new(pos_str); |
label = gtk_label_new(pos_str); |
443 |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
444 |
pos_lat_str(pos_str, sizeof(pos_str),appdata->map->selected.node->pos.lon); |
pos_lat_str(pos_str, sizeof(pos_str), context->object.node->pos.lon); |
445 |
label = gtk_label_new(pos_str); |
label = gtk_label_new(pos_str); |
446 |
gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2); |
gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2); |
447 |
} break; |
} break; |
448 |
|
|
449 |
case WAY: { |
case WAY: { |
450 |
char *nodes_str = g_strdup_printf(_("Length: %u nodes"), |
char *nodes_str = g_strdup_printf(_("Length: %u nodes"), |
451 |
osm_way_number_of_nodes(appdata->map->selected.way)); |
osm_way_number_of_nodes(context->object.way)); |
452 |
label = gtk_label_new(nodes_str); |
label = gtk_label_new(nodes_str); |
453 |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); |
454 |
g_free(nodes_str); |
g_free(nodes_str); |
455 |
|
|
456 |
char *type_str = g_strdup_printf("%s (%s)", |
char *type_str = g_strdup_printf("%s (%s)", |
457 |
(osm_way_get_last_node(appdata->map->selected.way) == |
(osm_way_get_last_node(context->object.way) == |
458 |
osm_way_get_first_node(appdata->map->selected.way))? |
osm_way_get_first_node(context->object.way))? |
459 |
"closed way":"open way", |
"closed way":"open way", |
460 |
(appdata->map->selected.way->draw.flags & OSM_DRAW_FLAG_AREA)? |
(context->object.way->draw.flags & OSM_DRAW_FLAG_AREA)? |
461 |
"area":"line"); |
"area":"line"); |
462 |
|
|
463 |
label = gtk_label_new(type_str); |
label = gtk_label_new(type_str); |