From: Andy Allan Date: Sat, 9 Jan 2010 19:23:20 +0000 (+0000) Subject: Show+remove (but not add) entity at specific relation indexes X-Git-Tag: 0.5~550 X-Git-Url: https://git.openstreetmap.org/potlatch2.git/commitdiff_plain/9012126477dfae5d86950a98d633996512271f98 Show+remove (but not add) entity at specific relation indexes --- diff --git a/net/systemeD/halcyon/connection/Relation.as b/net/systemeD/halcyon/connection/Relation.as index f1838ce8..7d804d63 100644 --- a/net/systemeD/halcyon/connection/Relation.as +++ b/net/systemeD/halcyon/connection/Relation.as @@ -29,6 +29,16 @@ package net.systemeD.halcyon.connection { } return -1; } + + public function findEntityMemberIndexes(entity:Entity):Array { + var indexes:Array = []; + for (var index:uint = 0; index < members.length; index++) { + var member:RelationMember = members[index]; + if ( member.entity == entity ) + indexes.push(index); + } + return indexes; + } public function getMember(index:uint):RelationMember { return members[index]; diff --git a/net/systemeD/potlatch2/TagViewer.mxml b/net/systemeD/potlatch2/TagViewer.mxml index 449c05f2..e6053fd3 100644 --- a/net/systemeD/potlatch2/TagViewer.mxml +++ b/net/systemeD/potlatch2/TagViewer.mxml @@ -33,7 +33,7 @@ - + @@ -48,7 +48,8 @@ - + @@ -209,14 +210,16 @@ } else { var relations:Array = []; for each( var rel:Relation in entity.parentRelations ) { - var props:Object = {}; - props["relation"] = rel; - props["id"] = rel.id; - var memberIndex:uint = rel.findEntityMemberIndex(entity); - props["role"] = rel.getMember(memberIndex).role; - props["description"] = rel.getDescription(); - - relations.push(props); + for each( var memberIndex:int in rel.findEntityMemberIndexes(entity)) { + var props:Object = {}; + props["relation"] = rel; + props["id"] = rel.id; + props["index"] = memberIndex; + props["role"] = rel.getMember(memberIndex).role; + props["description"] = rel.getDescription(); + + relations.push(props); + } } relationsGrid.dataProvider = relations; } @@ -283,7 +286,8 @@ new RelationSelectPanel().init(selectedEntity); } - public function removeFromRelation():void { + public function removeFromRelation(id:Number, index:int):void { + Connection.getConnectionInstance().getRelation(id).removeMemberByIndex(index); } public function initFeatureBox():void {