55 |
|
|
56 |
gboolean collision = FALSE; |
gboolean collision = FALSE; |
57 |
tag_t *tags = tag; |
tag_t *tags = tag; |
58 |
|
while(tag) { |
59 |
if(id == ID_ILLEGAL) |
if(!collision && info_tag_key_collision(tags, tag)) |
60 |
str = g_strdup_printf(_("Unknown item")); |
collision = TRUE; |
61 |
else { |
tag = tag->next; |
|
str = g_strdup_printf("%s #" ITEM_ID_FORMAT, item_str, id); |
|
|
|
|
|
/* add some tags ... */ |
|
|
/* |
|
|
* XXX Should we just try to present only the name or the ref (or the |
|
|
* alt_name, old_name, whatever) here? Hurling a load of tags in the |
|
|
* user's face in some unpredictable, uninformative order isn't very |
|
|
* friendly. |
|
|
* |
|
|
* Actually, a tag_short_desc() function would be useful in dialogs |
|
|
* nd user messages too. |
|
|
*/ |
|
|
while(tag) { |
|
|
if(!collision && info_tag_key_collision(tags, tag)) |
|
|
collision = TRUE; |
|
|
|
|
|
/* we don't have much space, so ignore created_by tag */ |
|
|
if(!osm_is_creator_tag(tag)) { |
|
|
char *old = str; |
|
|
str = g_strdup_printf("%s, %s=%s", old, tag->key, tag->value); |
|
|
g_free(old); |
|
|
} |
|
|
tag = tag->next; |
|
|
} |
|
62 |
} |
} |
63 |
|
|
64 |
|
str = osm_object_get_speaking_name(&map_item->object); |
65 |
statusbar_set(map->appdata, str, collision); |
statusbar_set(map->appdata, str, collision); |
66 |
g_free(str); |
g_free(str); |
67 |
} |
} |
379 |
osm_tags_free(appdata->map->last_node_tags); |
osm_tags_free(appdata->map->last_node_tags); |
380 |
|
|
381 |
appdata->map->last_node_tags = |
appdata->map->last_node_tags = |
382 |
osm_tags_copy(appdata->map->selected.object.node->tag, FALSE); |
osm_tags_copy(appdata->map->selected.object.node->tag); |
383 |
} else if(appdata->map->selected.object.type == WAY) { |
} else if(appdata->map->selected.object.type == WAY) { |
384 |
if(appdata->map->last_way_tags) |
if(appdata->map->last_way_tags) |
385 |
osm_tags_free(appdata->map->last_way_tags); |
osm_tags_free(appdata->map->last_way_tags); |
386 |
|
|
387 |
appdata->map->last_way_tags = |
appdata->map->last_way_tags = |
388 |
osm_tags_copy(appdata->map->selected.object.way->tag, FALSE); |
osm_tags_copy(appdata->map->selected.object.way->tag); |
389 |
} |
} |
390 |
|
|
391 |
/* remove statusbar message */ |
/* remove statusbar message */ |
662 |
void map_item_redraw(appdata_t *appdata, map_item_t *map_item) { |
void map_item_redraw(appdata_t *appdata, map_item_t *map_item) { |
663 |
map_item_t item = *map_item; |
map_item_t item = *map_item; |
664 |
|
|
665 |
|
/* a relation cannot be redraws as it doesn't have a visual */ |
666 |
|
/* representation */ |
667 |
|
if(map_item->object.type == RELATION) |
668 |
|
return; |
669 |
|
|
670 |
/* check if the item to be redrawn is the selected one */ |
/* check if the item to be redrawn is the selected one */ |
671 |
gboolean is_selected = FALSE; |
gboolean is_selected = FALSE; |
672 |
if(map_item->object.ptr == appdata->map->selected.object.ptr) { |
if(map_item->object.ptr == appdata->map->selected.object.ptr) { |
997 |
} |
} |
998 |
} |
} |
999 |
if (*zoom != oldzoom) { |
if (*zoom != oldzoom) { |
1000 |
printf("Can't zoom further out\n"); |
printf("Can't zoom further out (%f)\n", *zoom); |
1001 |
return 1; |
return 1; |
1002 |
} |
} |
1003 |
return 0; |
return 0; |
1356 |
/* don't highlight the dragged node itself and don't highlight */ |
/* don't highlight the dragged node itself and don't highlight */ |
1357 |
/* deleted ones */ |
/* deleted ones */ |
1358 |
if((node != cur_node) && (!(node->flags & OSM_FLAG_DELETED))) { |
if((node != cur_node) && (!(node->flags & OSM_FLAG_DELETED))) { |
1359 |
gint nx = x - node->lpos.x; |
gint nx = abs(x - node->lpos.x); |
1360 |
gint ny = y - node->lpos.y; |
gint ny = abs(y - node->lpos.y); |
1361 |
|
|
1362 |
if((nx < map->style->node.radius) && (ny < map->style->node.radius) && |
if((nx < map->style->node.radius) && (ny < map->style->node.radius) && |
1363 |
(nx*nx + ny*ny < map->style->node.radius * map->style->node.radius)) |
(nx*nx + ny*ny < map->style->node.radius * map->style->node.radius)) |
1371 |
if(!map->touchnode && map->action.way) { |
if(!map->touchnode && map->action.way) { |
1372 |
node_chain_t *chain = map->action.way->node_chain; |
node_chain_t *chain = map->action.way->node_chain; |
1373 |
while(!map->touchnode && chain && chain->next) { |
while(!map->touchnode && chain && chain->next) { |
1374 |
gint nx = x - chain->node->lpos.x; |
gint nx = abs(x - chain->node->lpos.x); |
1375 |
gint ny = y - chain->node->lpos.y; |
gint ny = abs(y - chain->node->lpos.y); |
1376 |
|
|
1377 |
if((nx < map->style->node.radius) && (ny < map->style->node.radius) && |
if((nx < map->style->node.radius) && (ny < map->style->node.radius) && |
1378 |
(nx*nx + ny*ny < map->style->node.radius * map->style->node.radius)) |
(nx*nx + ny*ny < map->style->node.radius * map->style->node.radius)) |
1772 |
map->appdata = appdata; |
map->appdata = appdata; |
1773 |
map->action.type = MAP_ACTION_IDLE; |
map->action.type = MAP_ACTION_IDLE; |
1774 |
|
|
1775 |
map->canvas = canvas_new(map->style->background.color); |
map->canvas = canvas_new(); |
|
canvas_set_antialias(map->canvas, !appdata->settings->no_antialias); |
|
1776 |
|
|
1777 |
GtkWidget *canvas_widget = canvas_get_widget(map->canvas); |
GtkWidget *canvas_widget = canvas_get_widget(map->canvas); |
1778 |
|
|
1801 |
void map_init(appdata_t *appdata) { |
void map_init(appdata_t *appdata) { |
1802 |
map_t *map = appdata->map; |
map_t *map = appdata->map; |
1803 |
|
|
1804 |
|
/* update canvas background color */ |
1805 |
|
canvas_set_background(map->canvas, map->style->background.color); |
1806 |
|
|
1807 |
/* set initial zoom */ |
/* set initial zoom */ |
1808 |
map_set_zoom(map, map->state->zoom, FALSE); |
map_set_zoom(map, map->state->zoom, FALSE); |
1809 |
josm_elemstyles_colorize_world(map->style, appdata->osm); |
josm_elemstyles_colorize_world(map->style, appdata->osm); |
1843 |
void map_paint(appdata_t *appdata) { |
void map_paint(appdata_t *appdata) { |
1844 |
map_t *map = appdata->map; |
map_t *map = appdata->map; |
1845 |
|
|
|
/* user may have changed antialias settings */ |
|
|
canvas_set_antialias(map->canvas, !appdata->settings->no_antialias); |
|
|
|
|
1846 |
josm_elemstyles_colorize_world(map->style, appdata->osm); |
josm_elemstyles_colorize_world(map->style, appdata->osm); |
1847 |
map_draw(map, appdata->osm); |
map_draw(map, appdata->osm); |
1848 |
} |
} |
1950 |
/* save changes to bg_offset in project */ |
/* save changes to bg_offset in project */ |
1951 |
appdata->project->wms_offset.x = map->bg.offset.x; |
appdata->project->wms_offset.x = map->bg.offset.x; |
1952 |
appdata->project->wms_offset.y = map->bg.offset.y; |
appdata->project->wms_offset.y = map->bg.offset.y; |
|
appdata->project->dirty = TRUE; |
|
1953 |
break; |
break; |
1954 |
|
|
1955 |
default: |
default: |
2386 |
map->state->detail = detail; |
map->state->detail = detail; |
2387 |
printf("changing detail factor to %f\n", map->state->detail); |
printf("changing detail factor to %f\n", map->state->detail); |
2388 |
|
|
2389 |
banner_busy_start(appdata, 1, "Redrawing..."); |
banner_busy_start(appdata, 1, _("Redrawing")); |
2390 |
map_clear(appdata, MAP_LAYER_OBJECTS_ONLY); |
map_clear(appdata, MAP_LAYER_OBJECTS_ONLY); |
2391 |
map_paint(appdata); |
map_paint(appdata); |
2392 |
banner_busy_stop(appdata); |
banner_busy_stop(appdata); |