1 from operationscore.Behavior import *
4 ret = []
5 for data in sensors:
6
7 if 'CenterLoc' in data:
8 xLoc = data['CenterLoc'][0]
9 yLoc = data['CenterLoc'][1]
10 else:
11 data['CenterLoc'] = tuple(data['Location'])
12 xLoc = data['Location'][0]
13 yLoc = data['Location'][1]
14 if not self['Id']+'Radius' in data:
15 data[self['Id']+'Radius'] = self['Radius']
16 rad = data[self['Id']+'Radius']
17 cond = '>=' if self['Outside'] else '<='
18 circleStr = 'math.sqrt(({x}-'+str(xLoc)+')**2+(({y}-'+str(yLoc)+')**2))'+cond+str(rad)
19 if self['Combine']:
20 data['Location'] += ',' + circleStr
21 else:
22 data['Location'] = circleStr
23 ret.append(data)
24 return (ret, [])
26 coutput = Behavior.deepCopyPacket(output)
27 for data in coutput:
28 data['Location'] = data['CenterLoc']
29 return coutput
30