Work in progress
[potlatch2.git] / net / systemeD / potlatch2 / controller / SelectedParallelWay.as
index 1c4cc565b21b934952f84cd19246bdb1a29d85f7..1324af138aab194b0ab88d34c04aee86dc712c2c 100644 (file)
@@ -4,19 +4,20 @@ package net.systemeD.potlatch2.controller {
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.Map;
        import net.systemeD.potlatch2.tools.Parallelise;
-       import net.systemeD.halcyon.Globals;
 
+    /** The state midway during the use of the "parallelise tool", where a parallel way has been created but is stuck to the 
+    * mouse cursor, allowing the user to choose how far from the original way it should go. This transforms it in the process. */
     public class SelectedParallelWay extends SelectedWay {
                private var startlon:Number;
                private var startlatp:Number;
                private var parallelise:Parallelise;
                private var originalWay:Way;
 
+        /** Initialises by parallelising the originalWay. */
         public function SelectedParallelWay(originalWay:Way) {
                        this.originalWay = originalWay;
                        parallelise = new Parallelise(originalWay);
-                       selection=[parallelise.parallelWay];
-                       super (firstSelected as Way);
+                       super (parallelise.parallelWay);
         }
 
         override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
@@ -30,6 +31,7 @@ package net.systemeD.potlatch2.controller {
                        return this;
         }
 
+               /** Cancel parallel way creation if ESC pressed. */
                override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
                        if (event.keyCode==27) {                        // Escape
                                Way(firstSelected).remove(MainUndoStack.getGlobalStack().addAction);
@@ -71,15 +73,16 @@ package net.systemeD.potlatch2.controller {
                        return furthdist*furthsgn;
                }
 
+               /** Creates the WayUI for the parallel way. */
                override public function enterState():void {
-                       controller.map.paint.createWayUI(firstSelected as Way);
+                       selection=[parallelise.parallelWay];
+                       editableLayer.createWayUI(firstSelected as Way);
                        startlon =controller.map.coord2lon(controller.map.mouseX);
                        startlatp=controller.map.coord2latp(controller.map.mouseY);
-                       Globals.vars.root.addDebug("**** -> "+this);
         }
+               /** Unselects. */
                override public function exitState(newState:ControllerState):void {
             clearSelection(newState);
-                       Globals.vars.root.addDebug("**** <- "+this);
         }
 
         override public function toString():String {