Merge branch 'master' into history
authorAndy Allan <andy@gravitystorm.co.uk>
Sat, 24 Mar 2012 11:42:44 +0000 (11:42 +0000)
committerAndy Allan <andy@gravitystorm.co.uk>
Sat, 24 Mar 2012 11:42:44 +0000 (11:42 +0000)
Conflicts:
net/systemeD/halcyon/connection/Entity.as
net/systemeD/halcyon/connection/XMLBaseConnection.as
net/systemeD/halcyon/connection/XMLConnection.as
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/controller/ControllerState.as

1  2 
net/systemeD/halcyon/connection/Connection.as
net/systemeD/halcyon/connection/Entity.as
net/systemeD/halcyon/connection/EntityCollection.as
net/systemeD/halcyon/connection/Node.as
net/systemeD/halcyon/connection/Relation.as
net/systemeD/halcyon/connection/Way.as
net/systemeD/halcyon/connection/XMLBaseConnection.as
net/systemeD/halcyon/connection/XMLConnection.as
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/controller/ControllerState.as

@@@ -32,7 -31,7 +32,8 @@@ package net.systemeD.halcyon.connectio
              this._version = version;
              this._uid = uid;
              this._timestamp = timestamp;
 +            this._user = user
+             if (connection.cssTransform) tags=connection.cssTransform.run(this,tags);
              this.tags = tags;
                        this._loaded = loaded;
              modified = id < 0;
@@@ -109,9 -109,9 +111,11 @@@ package net.systemeD.halcyon.connectio
                                                                           Number(nodeData.@lat),
                                                                           Number(nodeData.@lon),
                                                                           Number(nodeData.@uid),
 -                                                                         nodeData.@timestamp);
 -                if ( inlineStatus ) { newNode.status = nodeData.@status; }
 -                              
 +                                                                         nodeData.@timestamp,
 +                                                                         nodeData.@user);
-                               
++
++                    if ( inlineStatus ) { newNode.status = nodeData.@status; }
++
                                        if ( singleEntityRequest ) {
                                                // it's a revert request, so create/update the node
                                                setOrUpdateNode(newNode, true);
                                                }
                                                tags = parseTags(data.tag);
                                                if ( way == null ) {
 -                                                      way=new Way(this, id, version, tags, true, nodelist, uid, timestamp)
 +                                                      way=new Way(this, id, version, tags, true, nodelist, uid, timestamp, user)
+                                                       if ( inlineStatus ) { way.status = data.@status; }
                                                        setWay(way,false);
                                                        createdEntities.push(way);
                                                } else {
+                                                       if (!way.loaded) createdEntities.push(way);
                                                        waycount++;
 -                                                      way.update(version, tags, true, true, nodelist, uid, timestamp);
 +                                                      way.update(version, tags, true, true, nodelist, uid, timestamp, user);
+                                                       if ( inlineStatus ) { way.status = data.@status; }
                                                        sendEvent(new EntityEvent(NEW_WAY, way), false);
                                                }
                                        }
@@@ -9,7 -9,7 +9,8 @@@ package net.systemeD.halcyon.connectio
  
        import net.systemeD.halcyon.AttentionEvent;
        import net.systemeD.halcyon.MapEvent;
 +      import net.systemeD.halcyon.ExtendedURLLoader;
+     import net.systemeD.halcyon.connection.bboxes.*;
  
      /**
      * XMLConnection provides all the methods required to connect to a live
    <fx:Script><![CDATA[
        import net.systemeD.halcyon.connection.*;
        import net.systemeD.halcyon.MapPaint;
+       import net.systemeD.potlatch2.EditController;
        import net.systemeD.potlatch2.mapfeatures.*;
 +      import net.systemeD.potlatch2.history.HistoryDialog;
+       import net.systemeD.potlatch2.mapfeatures.editors.*;
        import net.systemeD.potlatch2.utils.*;
        import net.systemeD.controls.CollapsiblePanel;
  
@@@ -79,7 -79,7 +81,8 @@@ package net.systemeD.potlatch2.controll
                                case 66:        setSourceTag(); break;                                                                                                  // B - set source tag for current object
                                case 67:        editableLayer.connection.closeChangeset(); break;                                               // C - close changeset
                                case 68:        editableLayer.alpha=1.3-editableLayer.alpha; return null;                               // D - dim
+                               case 71:        FlexGlobals.topLevelApplication.trackLoader.load(); break;                              // G - GPS tracks **FIXME: move from Application to Map
 +                case 72:    showHistory(); break;                                                   // H - History
                                case 83:        SaveManager.saveChanges(editableLayer.connection); break;                               // S - save
                                case 84:        controller.tagViewer.togglePanel(); return null;                                                // T - toggle tags panel
                                case 90:        if (!event.shiftKey) { MainUndoStack.getGlobalStack().undo(); return null;}// Z - undo
                        MainUndoStack.getGlobalStack().addAction(undo);
                          controller.updateSelectionUI();
                        object.resume();
 -
 -
                }
+               
+               /** Remove all tags from current selection. */
+               protected function removeTags():void {
+                       if (selectCount==0) return;
+                       var undo:CompositeUndoableAction = new CompositeUndoableAction("Remove tags");
+                       for each (var item:Entity in _selection) {
+                               item.suspend();
+                               var tags:Array=item.getTagArray();
+                               for each (var tag:Tag in tags) item.setTag(tag.key,null,undo.push);
+                       }
+                       MainUndoStack.getGlobalStack().addAction(undo);
+                       controller.updateSelectionUI();
+                       for each (item in _selection) item.resume();
+               }
  
 +        /** Show the history dialog, if only one object is selected. */
 +        protected function showHistory():void {
 +            if (selectCount == 1) {
 +                new HistoryDialog().init(firstSelected);
 +            } else if (selectCount == 0) {
 +                controller.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, "Can't show history, nothing selected"));
 +            } else {
 +                controller.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, "Can't show history, multiple objects selected"));
 +            }
 +        }
 +
                /** Create an action to add "source=*" tag to current entity based on background imagery. This is a convenient shorthand for users. */
                protected function setSourceTag():void {
                        if (selectCount!=1) { return; }