EditController can now throw AttentionEvents too, so they don't all have to go throug...
authorRichard Fairhurst <richard@systemeD.net>
Thu, 9 Jun 2011 15:15:44 +0000 (16:15 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Thu, 9 Jun 2011 15:15:44 +0000 (16:15 +0100)
REFACTOR.txt
TODO.txt
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/controller/SelectedMultiple.as
net/systemeD/potlatch2/controller/SelectedWayNode.as
net/systemeD/potlatch2/tools/Quadrilateralise.as
potlatch2.mxml

index 53eea81e7add9859ad1b2c27762eb135019c0e9a..391dbacf4f9afbd1fe9ef2990ecda0be88fd174e 100644 (file)
@@ -4,9 +4,6 @@ Aims:
 - to enable multiple Maps to be shown on-screen (e.g. for junction editor)
 - to bring Connection and VectorLayer code together
 
-Current known problems:
-- AttentionEvents don't work
-
 To check:
 - MapDust
 - VectorLayers from GPX
index 9d2ed0534813b7d49805daa7f6d8af3effcc2584..79f1076d7b1e52d21c91606003a9478e7df71eef 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,5 +1,4 @@
-Potlatch 2: main outstanding issues
------------------------------------
+= Potlatch 2: main outstanding issues =
 
 == Core geometry ==
 
@@ -34,6 +33,7 @@ Potlatch 2: main outstanding issues
 
 ** Keypress detection is very erratic, depending on focus - need to work out where events are going (Application.application?) and sense them there
 * Failing to parse map_features should be an error state
+* Quadrilateralise should throw an AttentionEvent if it's too sharp to straighten
 * 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)
 * Custom imagery dialog fixes
 * Ctrl-clicking two areas (one inside the other) should create a multipolygon
index 21b84b3be1dff56488f55015bf516281a876cbea..c1ac2fc82b72b415eea9a810661a4f57509dd86f 100644 (file)
@@ -17,7 +17,7 @@ package net.systemeD.potlatch2 {
 
     /** Controller for the main map editing window itself. The logic that responds to mouse and keyboard events is all 
     * buried in various ControllerState classes. */
-    public class EditController implements MapController {
+    public class EditController extends EventDispatcher implements MapController {
 
         private var _map:Map;
         public var tagViewer:TagViewer;
index 3feb114beca8ca46843758e9f446bc245ddcb0bc..aa89551581b8c867e512ed2db4eb59c14b3fe809 100644 (file)
@@ -64,7 +64,7 @@ package net.systemeD.potlatch2.controller {
                 for each (var conflict:String in conflictTags) conflictTags2.push(conflict);
                 if (conflictTags2.length>0)
                     msg += " *Warning* The following tags conflicted and need attention: " + conflictTags2;
-                // >>>> somethingorother.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, msg));
+                controller.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, msg));
             }
 
                        return controller.findStateForSelection(waylist);
index def771b7b0a71e0d4b329091ef2a71f6a0af2881..fbe7cea415b0152e92512059bf778fab91f30b41 100644 (file)
@@ -220,7 +220,7 @@ package net.systemeD.potlatch2.controller {
                                // FIXME: ugh, just ugh.
                 msg += " *Warning* The following tags conflicted and need attention: " + MergeNodesAction.lastProblemTags;
             }
-            // somethingorother.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, msg));
+            controller.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, msg));
             return new SelectedWayNode(n.parentWays[0], Way(n.parentWays[0]).indexOfNode(n));
         }
         
index 9f11e07f3e109bf1a17bcf9224cf0c4925d9741b..c8f2f236f35a6fbcff8739929b7fa9460889a185 100644 (file)
@@ -29,7 +29,6 @@ package net.systemeD.potlatch2.tools {
         functor.step();
         var newScore:Number = functor.goodness;
         if (newScore > score) {
-          // somethingorother.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, "Corners too sharp to straighten"));
           return false;
            }
         score = newScore;
index d439af399ffd75aa5912a90164d4bc52fd6116ce..9ad70000da43b539ab1a35d2e781f5001ddf31a7 100644 (file)
 
             theController = new EditController(theMap, tagViewer, toolbox);
             theController.setActive();
+                       theController.addEventListener(AttentionEvent.ATTENTION, onAttention);
+                       theController.addEventListener(AttentionEvent.ALERT, onAlert);
             
             // set the access token from saved cookie
             var tokenObject:SharedObject = SharedObject.getLocal("access_token");