aboutsummaryrefslogtreecommitdiff
path: root/behaviors/XYMove.py
diff options
context:
space:
mode:
Diffstat (limited to 'behaviors/XYMove.py')
-rw-r--r--behaviors/XYMove.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py
new file mode 100644
index 0000000..8acbba8
--- /dev/null
+++ b/behaviors/XYMove.py
@@ -0,0 +1,17 @@
+from operationscore.Behavior import *
+import util.Geo as Geo
+class XYMove(Behavior):
+ def processResponse(self, sensor, recurs):
+ ret = []
+ for loc in sensor:
+ oploc = dict(loc)
+ self.insertStepIfMissing(oploc)
+ oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location'])
+ ret.append(oploc)
+ return (ret, [])
+ def insertStepIfMissing(self, data):
+ if not 'XStep' in data:
+ data['XStep'] = self['XStep']
+ if not 'YStep' in data:
+ data['YStep'] = self['YStep']
+