def WUW_MouseMove(self, event): if self.__inBoxArea: self.pictureBoxDisplay_MouseMove(event) return if self.__isDown: self.__points.append(PointR(event.GetX(),event.GetY(),time.clock()*1000)) self.Refresh(True, wx.Rect(event.GetX()-2,event.GetY()-2,4,4))
def WUW_MouseDown(self, event): if self.__show_settings: point = event.GetPosition() rect = self.pictureBoxDisplay.GetRect() if point.x >= rect.x and point.x <= rect.x + rect.width and point.y >= rect.y and point.y <= rect.y + rect.height: self.__inBoxArea = True if self.__inBoxArea: self.pictureBoxDisplay_MouseDown(event) return self.__isDown = True self.__points = [] self.__points.append(PointR(event.GetX(), event.GetY(),time.clock()*1000)) self.Refresh()
def AnalyzeMarkers(self): if self.__touchlessMgr.MarkersCount < 2: return m = self.__touchlessMgr.Markers[0] n = self.__touchlessMgr.Markers[1] if not m.CurrData.Present and not n.CurrData.Present: self.tolerance += 1 elif not m.CurrData.Present: self.tolerance += 1 elif not n.CurrData.Present: self.tolerance += 1 if m.CurrData.Present and n.CurrData.Present: dist = ((m.CurrData.X - n.CurrData.X)**2 + (m.CurrData.Y - n.CurrData.Y)**2)**0.5 isTouching = dist < 60 if isTouching and not self.__drawingGesture: self.tolerance = 0 self.StartDrawing() elif not isTouching and self.__drawingGesture: self.tolerance = 0 self.EndDrawing() elif not m.CurrData.Present and not n.CurrData.Present and self.tolerance > self.toleranceMax: if self.__drawingGesture: self.tolerance = 0 self.EndDrawing() if self.__drawingGesture: if n.CurrData.Present and m.CurrData.Present: # On utilise la moyenne des deux points détectés point_x = (n.CurrData.X + m.CurrData.X) / 2 point_y = (n.CurrData.Y + m.CurrData.Y) / 2 else: # On utilise le seul point détecté point = n if n.CurrData.Present else m point_x = point.CurrData.X point_y = point.CurrData.Y self.__drawingPoints.append(PointR(point_x, point_y,time.clock()*1000))