def EventRemoveCursor(self,Cursor): self.cancel_expire() self.unregister_event(Cursor.updateCursor) self.unregister_event(Cursor.removeCursor) self.complete() def execute(self): self.agent.pos = self.origin self.agent.newTap.call(self.agent) self.finish() @staticmethod def dist(a,b): dx,dy = (a[0]-b[0],a[1]-b[1]) return math.sqrt(dx**2 + dy**2) def duplicate(self): d = self.get_copy() d.finger = self.finger d.origin = self.origin d.shadow = shadowCursorOffPad(d) return d def make_TapAgent(self): a = Agent(("newTap",),self) return a import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerTap)
return d def execute(self): self.agent.pos1 = self.positions[0] self.agent.pos2 = self.positions[-1] self.agent.positions = self.positions self.agent.onPad = self.onPad i = 1 miny = self.positions[0][1] maxy = self.max - miny minx = self.positions[0][0] maxx = self.positions[-1][0]-minx while i < (len(self.positions)-1): self.finalPositions.append(((self.positions[i][0]-minx)/maxx,(self.positions[i][1]-miny)/maxy)) i += 1 self.agent.finalPositions = self.finalPositions self.agent.newEnvelope.call(self.agent) self.finish() #está mandando todo el array, si es mucho para mandar por ahí puedo resumir #no queda 0,0 exactamente, habría q redondear da tipo 0.0002 def make_EnvelopeAgent(self): a = Agent(("newEnvelope",),self) return a import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerEnvelope)
#print self.agent.newDoubleTap.registered self.agent.newDoubleTap(self.agent) self.finish() def duplicate(self): d = self.get_copy() d.firstap = self.firstap d.secondtap = self.secondtap return d #def fail(self, cause="Unknown"): # print "RecognizerDoubleTap(",self,") fail, cause="+cause # #raise Exception("RecognizerDoubleTap fail") # Recognizer.fail(self) @staticmethod def dist(a,b): dx,dy = (a[0]-b[0],a[1]-b[1]) return math.sqrt(dx**2 + dy**2) def make_DoubleTapAgent(self): a = Agent(("newDoubleTap",),self) return a def __repr__(self): return self.name import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerDoubleTap)
"mot_accel":"", } for m1,m2 in correspondances.iteritems(): if m2: setattr(t2cur,m2,getattr(tcur,m1,0)) @staticmethod def copy_tfig2t2fig(tfig,t2fig): correspondances = { "sessionid":"sid", "xpos":"x", "ypos":"y", "xmot":"", "ymot":"", "mot_accel":"", "id":"fid", "mot_speed":"", "rot_speed":"", "rot_accel":"", "z":"z", "yaw":"yaw", "pitch":"pitch", "angle":"roll", } for m1,m2 in correspondances.iteritems(): if m2: setattr(t2fig,m2,getattr(tfig,m1,0)) import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerTuio_Tuio2)
d.secondtap = self.secondtap d.thirdtap = self.thirdtap d.fourthtap = self.fourthtap d.tapTime = list(self.tapTime) d.tempo = self.tempo d.interval = self.interval return d def fail(self, cause="Unknown"): print "RecognizerTapTempo(", self, ") fail, cause=" + cause # raise Exception("RecognizerDoubleTap fail") Recognizer.fail(self, cause) @staticmethod def dist(a, b): dx, dy = (a[0] - b[0], a[1] - b[1]) return math.sqrt(dx ** 2 + dy ** 2) def make_TapTempoAgent(self): a = Agent(("newTapTempo",), self) return a def __repr__(self): return self.name import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerTapTempo)
self.sendPos() self.agent.fid = self.fid self.agent.newTurner.call(self.agent) def sendPos(self): self.agent.roll = self.angle self.agent.px = self.px self.agent.py = self.py self.agent.pz = self.pz def duplicate(self): d = self.get_copy() d.origin = self.origin d.fid = self.fid d.figure = self.figure d.angle = self.angle return d def make_TurnerAgent(self): a = Agent(("newTurner","updateTurner","removeTurner",),self) return a import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerTurner)
if self.dist(self.origin, Cursor.pos)< self.mind: self.fail("didnt move") self.unregister_event(Cursor.updateCursor) self.unregister_event(Cursor.removeCursor) self.agent.dragDrop.call(self.agent) self.finish() def dist(self,a,b): dx,dy = (a[0]-b[0],a[1]-b[1]) return math.sqrt(dx**2 + dy**2) def MakeDragAgent(self): evts = ["newDrag","dragMove","dragDrop"] a = Agent(evts, self) return a def execute(self): self.fail_all_others() self.agent.newDrag.call(self.agent) def duplicate(self): d = self.get_copy() return d import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerDrag)
v += 1 if not done: if curves >= lines: self.agent.newSineWave.call(self.agent) elif lines > curves: # up1 = self.positions[0][0] # pos = self.vertex[1] # up2 = self.positions[pos][0] if (self.saw2-self.saw1)*2 < self.saw1 - self.saw0: self.agent.newSawWave.call(self.agent) else: self.agent.newTriangleWave.call(self.agent) self.finish() def make_WaveAgent(self): a = Agent(("newSineWave","newTriangleWave","newSquareWave","newSawWave",),self) return a def fail(self, cause="Unknown"): print "RecognizerWave(",self,") fail, cause="+cause self.unregister_all() Recognizer.fail(self,cause) import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerWave)
def fail(self, cause="Unknown"): try: self.unregister_all() except: None Recognizer.fail(self,cause) def execute(self): self.agent.pos = self.positions[0] self.agent.newSwipe.call(self.agent) self.send_pos() def duplicate(self): d = self.get_copy() d.pos = self.pos d.cursors = self.cursors #d.good_cursors = self.good_cursors #d.ammount_cursors = self.ammount_cursors return d import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerSwipe)
#d.has_cur = self.has_cur d.pxcm= self.pxcm d.pycm = self.pycm # d.pzcm = self.pzcm # d.yaw = self.yaw # d.pitch = self.pitch d.roll = self.roll d.shadow = shadowCursorOnPad(d) return d import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerCursorOnPad)
def fail(self, cause="Unknown"): try: self.unregister_all() except: None Recognizer.fail(self,cause) def execute(self): self.agent.crPos1 = self.cur1.crPos1 self.agent.crPos2 = self.cur2.crPos self.avPos = self.averagePos() self.agent.crPos = self.avPos self.agent.onPad = self.onPad self.agent.newCursor.call(self.agent) def duplicate(self): d = self.get_copy() d.onPad = self.onPad d.cur1 = self.cur1 d.crPos1 = self.crPos1 d.avPos = self.avPos d.cPos1 = self.cPos1 return d import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerTwoFingers)
self.finish() def execute(self): self.angle = self.figure.figure.roll self.sendPos() #self.agent.fid = self.fid self.agent.newInstrument.call(self.agent) def sendPos(self): self.agent.roll = self.angle self.agent.px = self.px self.agent.py = self.py self.agent.pz = self.pz def duplicate(self): d = self.get_copy() d.origin = self.origin d.fid = self.fid d.figure = self.figure d.angle = self.angle return d def make_InstrumentAgent(self): a = Agent(("newInstrument","updateInstrument","removeInsrument",),self) return a import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerInstrument)
self.py = Pad.pos[1] self.roll = Pad.figure.roll ## corner1cm = tablePos(self.c1[0], self.c1[1], self.pxcm, self.pycm, self.pzcm, self.yaw, self.pitch, self.roll) ## corner2cm = tablePos(self.c2[0], self.c2[1], self.pxcm, self.pycm, self.pzcm, self.yaw, self.pitch, self.roll) ## corner3cm = tablePos(self.c3[0], self.c3[1], self.pxcm, self.pycm, self.pzcm, self.yaw, self.pitch, self.roll) ## corner4cm = tablePos(self.c4[0], self.c4[1], self.pxcm, self.pycm, self.pzcm, self.yaw, self.pitch, self.roll) ## self.corner1 = (round((corner1cm[0]*(self.mesa_camZ*self.ratioX/self.pz)),2)), (round((corner1cm[1]*(self.mesa_camZ*self.ratioY/self.pz)),2)) ## self.corner2 = (round((corner2cm[0]*(self.mesa_camZ*self.ratioX/self.pz)),2)), (round((corner2cm[1]*(self.mesa_camZ*self.ratioY/self.pz)),2)) ## self.corner3 = (round((corner3cm[0]*(self.mesa_camZ*self.ratioX/self.pz)),2)), (round((corner3cm[1]*(self.mesa_camZ*self.ratioY/self.pz)),2)) ## self.corner4 = (round((corner4cm[0]*(self.mesa_camZ*self.ratioX/self.pz)),2)), (round((corner4cm[1]*(self.mesa_camZ*self.ratioY/self.pz)),2)) def sendPos(self, Pad): self.agent.px = Pad.pos[0] self.agent.py = Pad.pos[1] self.agent.roll = self.roll def duplicate(self): d = self.get_copy() d.shadow = shadowPad(d) return d def make_PadAgent(self): a = Agent(("newPad","updatePad","removePad",),self) return a import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerPad)
## a +=1 ## #si falla encontrar la coordenada x promedio tira el index promedio en positions ## b = self.positions.index(start)+self.positions.index(end)/2 ## return self.positions[b] def execute(self): self.agent.onPad = self.onPad self.agent.pos1 = self.positions[0] self.agent.pos2 = self.positions[-1] self.agent.positions = self.positions[:] self.agent.real_positions = self.real_positions[:] #self.agent.finalPositions = self.finalPositions self.agent.newGEQ.call(self.agent) self.finish() def make_GEQAgent(self): a = Agent(("newGEQ",),self) return a def fail(self,cause): self.unregister_all() print "GEQ fails: %s" % (cause,) Recognizer.fail(self, cause) import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerGEQ)
self.agent.endMSelect.call(self.agent) self.finish() def dist(self,a,b): dx,dy = (a[0]-b[0],a[1]-b[1]) return math.sqrt(dx**2 + dy**2) def MakeMultiSelectAgent(self): evts = ["newMSelect","moveMSelect","endMSelect"] a = Agent(evts, self) return a def execute(self): self.agent.newMSelect.call(self.agent) def duplicate(self): d = self.get_copy() d.origin = self.origin d.pos = self.pos return d import GestureAgents.Gestures as Gestures Gestures.load_recognizer(RecognizerMultiSelect)