No Selection]]>
"+feature.@name+"
" + txt;
}
private function blankFeatureIcon(entity:Entity):void {
iconImage.source = null;
iconText.htmlText = entity == null ?
"Nothing selected" :
"Not recognised
Try looking at the tags under the advanced properties";
}
private function checkAdvanced():void {
if ( selectedEntity != null )
setupAdvanced(selectedEntity);
}
private function setupAdvanced(entity:Entity):void {
var entityText:String = "xx";
if ( entity is Node ) entityText = "Node";
else if ( entity is Way ) entityText = "Way";
else if ( entity is Relation ) entityText = "Relation";
advancedID.htmlText = entityText+": "+entity.id+"";
if ( collection == null ) {
collection = new ArrayCollection();
//var sort:Sort = new Sort();
//sort.fields = [new SortField("key", true)];
//collection.sort = sort;
//collection.refresh();
advancedTagGrid.dataProvider = collection;
}
collection.removeAll();
var tags:Array = entity.getTagArray();
tags.sortOn("key");
for each(var tag:Tag in tags)
collection.addItem(tag);
}
private function tagChanged(event:TagEvent):void {
refreshFeatureIcon();
if ( collection != null ) {
// check to see if the key is already in our list
var exists:Boolean = false;
var tag:Tag = null;
var i:uint;
for ( i = 0; i < collection.length && !exists; i++ ) {
tag = Tag(collection.getItemAt(i));
exists = tag.key == event.key;
}
if ( !exists ) {
tag = new Tag(selectedEntity, event.key, event.newValue);
collection.addItem(tag);
collection.refresh();
} else {
if ( event.newValue == null ) {
collection.removeItemAt(i-1);
collection.refresh();
}
}
}
}
public function loadFeatures():void {
mapFeatures = MapFeatures.getInstance();
}
public function openDescription():void {
trace("open description here");
}
public function addNewTag():void {
var newKey:String = "(new tag)";
var newTag:Tag = new Tag(selectedEntity, newKey, "(new value)");
collection.addItem(newTag);
advancedTagGrid.editedItemPosition = {rowIndex: collection.getItemIndex(newTag), columnIndex: 0};
}
public function removeTag():void {
var k:String = advancedTagGrid.selectedItem.key;
selectedEntity.setTag(k, null);
}
]]>