slash and burn trace statements, and fix areas on vector background layers
authorRichard Fairhurst <richard@systemed.net>
Fri, 9 Jul 2010 19:35:02 +0000 (19:35 +0000)
committerRichard Fairhurst <richard@systemed.net>
Fri, 9 Jul 2010 19:35:02 +0000 (19:35 +0000)
13 files changed:
TODO.txt
net/systemeD/halcyon/VectorLayer.as
net/systemeD/halcyon/connection/CompositeUndoableAction.as
net/systemeD/halcyon/connection/Connection.as
net/systemeD/halcyon/connection/MainUndoStack.as
net/systemeD/halcyon/connection/XMLConnection.as
net/systemeD/halcyon/connection/actions/RemoveNodeFromWayAction.as
net/systemeD/halcyon/styleparser/StyleList.as
net/systemeD/potlatch2/RelationSelectPanel.mxml
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/controller/ControllerState.as
net/systemeD/potlatch2/controller/DragBackground.as
net/systemeD/potlatch2/save/OAuthPanel.mxml

index 184f341..0320f60 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -3,8 +3,6 @@ Potlatch 2: main outstanding issues
 ** = required before P2 goes live
 
 
-** Slash and burn trace statements
-
 == Core geometry ==
 
 * P1-style J (join) / shift-J (unjoin)
@@ -32,7 +30,6 @@ Potlatch 2: main outstanding issues
 
 == UI ==
 
-** Clicking the menu on the SuperTabNavigator appears to boggle it completely
 * Escape should rewind the entity to how it was before the current ControllerState. (Record a position in the undo stack when exiting a ControllerState, and escape would rewind to that)
 * Potlatch 1-style "floaty warnings"
 * Custom imagery dialog fixes
index 9ef040e..d919e98 100644 (file)
@@ -70,14 +70,18 @@ package net.systemeD.halcyon {
                        if (entity is Way) {
                                // copy way through to main layer
                                // ** shouldn't do this if the nodes are already in the main layer
+                               //    (or maybe we should just match on lat/long to avoid ways in background having nodes in foreground)
                                var oldWay:Way=Way(entity);
                                var newWay:Way=connection.createWay(oldWay.getTagsCopy(), [], MainUndoStack.getGlobalStack().addAction);
+                               var nodemap:Object={};
+                               var oldNode:Node, newNode:Node;
                                for (i=0; i<oldWay.length; i++) {
-                                       var oldNode:Node = oldWay.getNode(i);
-                                       var newNode:Node = connection.createNode(
+                                       oldNode = oldWay.getNode(i);
+                                       newNode = nodemap[oldNode.id] ? nodemap[oldNode.id] : connection.createNode(
                                                oldNode.getTagsCopy(), oldNode.lat, oldNode.lon, 
                                                MainUndoStack.getGlobalStack().addAction);
                                        newWay.appendNode(newNode, MainUndoStack.getGlobalStack().addAction);
+                                       nodemap[oldNode.id]=newNode;
                                }
                                // delete this way
                                while (oldWay.length) { 
index 3cd4e11..b5394ab 100644 (file)
@@ -53,7 +53,6 @@ package net.systemeD.halcyon.connection {
         public function undoFrom(index:int):void {
             for ( var i:int = index - 1; i >= 0; i-- ) {
                 var action:UndoableAction = actions[i];
-                trace("going to do "+action);
                 
                 action.undoAction();
             }
index f8e2371..13ee98f 100755 (executable)
@@ -34,7 +34,6 @@ package net.systemeD.halcyon.connection {
         }
 
         public static function getParam(name:String, defaultValue:String):String {
-            trace("Returning param "+name+" as "+(params[name] == null ? defaultValue : params[name]));
             return params[name] == null ? defaultValue : params[name];
         }
 
index b302b21..e85c4ec 100644 (file)
@@ -19,7 +19,6 @@ package net.systemeD.halcyon.connection {
          * stack -- find another one.
          */
         public function addAction(action:UndoableAction):void {
-            trace("doing "+action);
             var result:uint = action.doAction();
             
             switch ( result ) {
@@ -73,7 +72,6 @@ package net.systemeD.halcyon.connection {
         public function undo():void {
                        if (!undoActions.length) { return; }
             var action:UndoableAction = undoActions.pop();
-            trace("undoing "+action);
             action.undoAction();
             redoActions.push(action);
             dispatchEvent(new Event("new_undo_item"));
@@ -83,7 +81,6 @@ package net.systemeD.halcyon.connection {
         public function redo():void {
                        if (!redoActions.length) { return; }
             var action:UndoableAction = redoActions.pop();
-            trace("redoing "+action);
             action.doAction();
             undoActions.push(action);
             dispatchEvent(new Event("new_undo_item"));
index a22bd4e..79ac705 100644 (file)
@@ -5,6 +5,7 @@ package net.systemeD.halcyon.connection {
        import flash.system.Security;
        import flash.net.*;
     import org.iotashan.oauth.*;
+       import mx.controls.Alert;
 
        import net.systemeD.halcyon.Globals;
 
@@ -18,7 +19,6 @@ package net.systemeD.halcyon.connection {
                 Security.loadPolicyFile(Connection.policyURL);
             var oauthPolicy:String = Connection.getParam("oauth_policy", "");
             if ( oauthPolicy != "" ) {
-                trace(oauthPolicy);
                 Security.loadPolicyFile(oauthPolicy);
             }
                }
@@ -40,7 +40,7 @@ package net.systemeD.halcyon.connection {
                }
 
         private function errorOnMapLoad(event:Event):void {
-            trace("error loading map");
+                       Alert.show("Couldn't load the map", 'Error', mx.controls.Alert.OK);
         }
         private function mapLoadStatus(event:HTTPStatusEvent):void {
             trace("loading map status = "+event.status);
@@ -180,8 +180,7 @@ package net.systemeD.halcyon.connection {
         }
 
         private function diffUploadError(event:IOErrorEvent):void {
-            trace("error "+URLLoader(event.target).data + " "+httpStatus+ " " + event.text);
-
+                       Alert.show("Couldn't upload data: "+httpStatus+" "+event.text, 'Error', mx.controls.Alert.OK);
                dispatchEvent(new SaveCompleteEvent(SAVE_COMPLETED, false));
         }
 
index 2e29db0..239d8d6 100644 (file)
@@ -36,7 +36,6 @@ package net.systemeD.halcyon.connection.actions {
             
             for (var i:int = nodeRemovedFrom.length - 1; i >= 0; i--) {
                 var index:int = nodeRemovedFrom[i];
-                trace("node being added "+index+" "+i+" "+node);
                 nodeList.splice(index, 0, node);
                entity.dispatchEvent(new WayNodeEvent(Connection.WAY_NODE_ADDED, node, Way(entity), index));
             }
index 0f8c4c5..7822444 100755 (executable)
@@ -26,6 +26,16 @@ package net.systemeD.halcyon.styleparser {
                        if (sublayers.indexOf(s)==-1) { sublayers.push(s); }
                }
 
+               public function toString():String {
+                       var str:String='';
+                       var k:String;
+                       for (k in shapeStyles) { str+="- SS "+k+"="+shapeStyles[k]+"\n"; }
+                       for (k in textStyles) { str+="- TS "+k+"="+textStyles[k]+"\n"; }
+                       for (k in pointStyles) { str+="- PS "+k+"="+pointStyles[k]+"\n"; }
+                       for (k in shieldStyles) { str+="- sS "+k+"="+shieldStyles[k]+"\n"; }
+                       return str;
+               }
+
                private function hasShapeStyles():Boolean  { for (var a:String in shapeStyles ) { return true; }; return false; }
                private function hasTextStyles():Boolean   { for (var a:String in textStyles  ) { return true; }; return false; }
                private function hasPointStyles():Boolean  { for (var a:String in pointStyles ) { return true; }; return false; }
index 0f7301f..9319376 100644 (file)
@@ -49,7 +49,6 @@
           var relation:Relation = conn.createRelation(tags, [new RelationMember(entity, '')],
               MainUndoStack.getGlobalStack().addAction)
           PopUpManager.removePopUp(this);
-          trace("edit relation "+id);
           var panel:RelationEditorPanel = RelationEditorPanel(
               PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
           panel.setRelation(relation);
index 65695a4..086a0a3 100644 (file)
           var rel:Relation = selectedEntity as Relation
           
           // drop members
-          trace("Dropping "+rel.length+" members");
           for (var i:int=rel.length-1 ; i>=0; i--) {
             rel.removeMemberByIndex(i);
           }
               e = conn.getRelation(id);
             }
             rel.appendMember(new RelationMember(e, memberObject.role));
-            trace("added member "+memberObject.type+" "+id+" in role "+memberObject.role);
           }
-          trace("complete: relation "+rel.id+" now has "+rel.length+" members");
       }
       
       private function editRelation(id:Number):void {
       }
 
       public function openDescription():void {
-          trace("open description here");
           if ( feature != null && feature.hasHelpURL() )
               navigateToURL(new URLRequest(feature.helpURL), "potlatch_help");
       }
index b7f0b59..42e1286 100644 (file)
@@ -62,11 +62,16 @@ package net.systemeD.potlatch2.controller {
                        var paint:MapPaint = getMapPaint(DisplayObject(event.target));
             var focus:Entity = getTopLevelFocusEntity(entity);
 
+                       if ( paint && paint.isBackground ) {
+                               if ( event.type == MouseEvent.MOUSE_DOWN && ((event.shiftKey && event.ctrlKey) || event.altKey) ) {
+                                       // pull data out of vector background layer
+                                       if (entity is Way) { return new SelectedWay(paint.findSource().pullThrough(entity,controller.connection)); }
+                               }
+                               return (this is NoSelection) ? this : new NoSelection();
+                       }
+
                        if ( event.type == MouseEvent.MOUSE_DOWN ) {
-                               if ( entity is Way && event.altKey && paint.isBackground ) {
-                                       // pull way out of vector background layer
-                                       return new SelectedWay(paint.findSource().pullThrough(entity,controller.connection));
-                               } else if ( entity is Way ) {
+                               if ( entity is Way ) {
                                        // click way
                                        return new DragWay(focus as Way, event);
                                } else if ( focus is Node ) {
index 307695d..af966b7 100644 (file)
@@ -11,7 +11,6 @@ package net.systemeD.potlatch2.controller {
         private var downY:Number;
         
         public function DragBackground(event:MouseEvent) {
-                       trace ("starting DragBackground");
             downX = event.localX;
             downY = event.localY;
         }
index 5f89211..5f56f4a 100644 (file)
@@ -21,7 +21,7 @@
                label="http://oauth.dev.openstreetmap.org/oauth/authorize?somekey"
                click="openURL(authoriseURL); tryAccessButton.enabled=true;"/>
            <mx:Text width="100%">
-             <mx:text>Once you've authorised the access click the 'Try Access' button below</mx:text>
+             <mx:text>Once you've authorised the access click the 'Try Access' button below</mx:text> <!-- ' -->
            </mx:Text>
            <mx:Text styleName="failText" visible="false" id="deniedLabel">
              <mx:text><![CDATA[<b>Access was denied, please check, and try again</b>]]></mx:text>