Add ability to create a new relation (fixes #1576)

This commit is contained in:
John Firebaugh
2013-07-22 15:13:21 -07:00
parent 11bbfebdc6
commit e8d924aab0
3 changed files with 25 additions and 5 deletions
+2
View File
@@ -25,6 +25,7 @@ en:
annotation:
point: Added a point.
vertex: Added a node to a way.
relation: Added a relation.
start:
annotation:
line: Started a line.
@@ -176,6 +177,7 @@ en:
all_tags: All tags
all_members: All members
all_relations: All relations
new_relation: New relation...
role: Role
choose: Select feature type
results: "{n} results for {search}"
+3 -1
View File
@@ -30,7 +30,8 @@
"add": {
"annotation": {
"point": "Added a point.",
"vertex": "Added a node to a way."
"vertex": "Added a node to a way.",
"relation": "Added a relation."
}
},
"start": {
@@ -219,6 +220,7 @@
"all_tags": "All tags",
"all_members": "All members",
"all_relations": "All relations",
"new_relation": "New relation...",
"role": "Role",
"choose": "Select feature type",
"results": "{n} results for {search}",
+20 -4
View File
@@ -14,9 +14,22 @@ iD.ui.RawMembershipEditor = function(context) {
function addMembership(d, role) {
showBlank = false;
context.perform(
iD.actions.AddMember(d.relation.id, {id: id, type: context.entity(id).type, role: role}),
t('operations.add_member.annotation'))
if (d.relation) {
context.perform(
iD.actions.AddMember(d.relation.id, {id: id, type: context.entity(id).type, role: role}),
t('operations.add_member.annotation'));
} else {
var relation = iD.Relation();
context.perform(
iD.actions.AddEntity(relation),
iD.actions.AddMember(relation.id, {id: id, type: context.entity(id).type, role: role}),
t('operations.add.annotation.relation'));
context.enter(iD.modes.Select(context, [relation.id]));
}
}
function deleteMembership(d) {
@@ -26,7 +39,10 @@ iD.ui.RawMembershipEditor = function(context) {
}
function relations(q) {
var result = [],
var result = [{
relation: null,
value: t('inspector.new_relation')
}],
graph = context.graph();
context.intersects(context.extent()).forEach(function(entity) {