change relation.appendMember to use the undo system, and update various places as...
[potlatch2.git] / net / systemeD / halcyon / connection / actions / CreatePOIAction.as
1 package net.systemeD.halcyon.connection.actions {
2
3     import net.systemeD.halcyon.connection.*;
4     import net.systemeD.halcyon.Map;
5     import flash.events.*;
6     
7     public class CreatePOIAction extends CompositeUndoableAction {
8     
9         private var newNode:Node;
10                 private var tags:Object;
11                 private var lat:Number;
12                 private var lon:Number;
13         
14         public function CreatePOIAction(tags:Object, lat:Number, lon:Number) {
15           super("Create POI");
16           this.tags = tags;
17           this.lat = lat;
18           this.lon = lon;
19         }
20         
21         public override function doAction():uint {
22           if (newNode == null) {
23             newNode = Connection.getConnection().createNode(tags,lat,lon,push);
24           }
25           super.doAction();
26           Connection.getConnection().registerPOI(newNode);
27           
28           return SUCCESS;
29         }
30         
31         public override function undoAction():uint {
32           super.undoAction();
33           Connection.getConnection().unregisterPOI(newNode);
34           
35           return SUCCESS;
36         }
37         
38         public function getNode():Node {
39           return newNode;
40         }
41     }
42 }