1294 |
|
|
1295 |
/* and mark it "deleted" in the database */ |
/* and mark it "deleted" in the database */ |
1296 |
osm_way_remove_from_relation(appdata->osm, way); |
osm_way_remove_from_relation(appdata->osm, way); |
1297 |
|
|
1298 |
|
puts("1"); |
1299 |
osm_way_delete(appdata->osm, &appdata->icon, way, FALSE); |
osm_way_delete(appdata->osm, &appdata->icon, way, FALSE); |
1300 |
|
puts("2"); |
1301 |
} |
} |
1302 |
|
|
1303 |
static void map_handle_click(appdata_t *appdata, map_t *map) { |
static void map_handle_click(appdata_t *appdata, map_t *map) { |
1976 |
/* deleting the selected item de-selects it ... */ |
/* deleting the selected item de-selects it ... */ |
1977 |
map_item_deselect(appdata); |
map_item_deselect(appdata); |
1978 |
|
|
1979 |
undo_remember_delete(appdata, &item.object); |
undo_open_new_state(appdata, UNDO_DELETE, &item.object); |
1980 |
|
|
1981 |
switch(item.object.type) { |
switch(item.object.type) { |
1982 |
case NODE: |
case NODE: |
1983 |
printf("request to delete node #" ITEM_ID_FORMAT "\n", |
printf("request to delete node #" ITEM_ID_FORMAT "\n", |
1984 |
item.object.node->id); |
item.object.node->id); |
1985 |
|
|
1986 |
|
undo_append_object(appdata, UNDO_DELETE, &item.object); |
1987 |
|
|
1988 |
/* check if this node is part of a way with two nodes only. */ |
/* check if this node is part of a way with two nodes only. */ |
1989 |
/* we cannot delete this as this would also delete the way */ |
/* we cannot delete this as this would also delete the way */ |
1990 |
way_chain_t *way_chain = osm_node_to_way(appdata->osm, item.object.node); |
way_chain_t *way_chain = osm_node_to_way(appdata->osm, item.object.node); |
2028 |
/* this way now only contains one node and thus isn't a valid */ |
/* this way now only contains one node and thus isn't a valid */ |
2029 |
/* way anymore. So it'll also get deleted (which in turn may */ |
/* way anymore. So it'll also get deleted (which in turn may */ |
2030 |
/* cause other nodes to be deleted as well) */ |
/* cause other nodes to be deleted as well) */ |
2031 |
|
undo_append_way(appdata, UNDO_DELETE, chain->way); |
2032 |
map_way_delete(appdata, chain->way); |
map_way_delete(appdata, chain->way); |
2033 |
} else { |
} else { |
2034 |
map_item_t item; |
map_item_t item; |
2035 |
item.object.type = WAY; |
item.object.type = WAY; |
2036 |
item.object.way = chain->way; |
item.object.way = chain->way; |
2037 |
|
undo_append_object(appdata, UNDO_MODIFY, &(item.object)); |
2038 |
map_item_redraw(appdata, &item); |
map_item_redraw(appdata, &item); |
2039 |
} |
} |
2040 |
|
|
2055 |
(item.object.type == WAY)); |
(item.object.type == WAY)); |
2056 |
break; |
break; |
2057 |
} |
} |
2058 |
|
undo_close_state(appdata); |
2059 |
} |
} |
2060 |
|
|
2061 |
/* ----------------------- track related stuff ----------------------- */ |
/* ----------------------- track related stuff ----------------------- */ |