public TrackingMove StartTracking(MoveableBodyPart bodyPart) { Action<Func<Point, Point>> onMove = (c) => new Point(0, 0); var onMoveSetter = new TrackingMove((o) => onMove = o); this.BodyPart = bodyPart; this.SetupBodyPartMove(() => onMove); return onMoveSetter; }
public void StartTracking(MoveableBodyPart bodyPart) { this._bodyPart = bodyPart; this._bodyPart.Push += Push; this._bodyPart.Pull += Pull; this._bodyPart.MoveLeft += MoveLeft; this._bodyPart.MoveRight += MoveRight; this._bodyPart.NoSignificantMovement += NoMove; }
private void SetupMoveEvents(MoveableBodyPart bodyPart) { _canvas.WhenMoved(bodyPart, (x, y, m) => { foreach (var element in _elements) { DecideWhetherSelection(element, Hits(_canvas, element, x, y)); } }); }
internal HighlightCanvasItemContextHandlers(MoveableBodyPart bodyPart, HighlightCanvas canvas, IEnumerable<UIElement> elements) { _bodyPart = bodyPart; _canvas = canvas; _elements = elements; _selectionStates = _elements.ToDictionary((e) => e, (e) => false); Selected += (e, m) => { }; Unselected += (e, m) => { }; SetupMoveEvents(bodyPart); }
public static new TrackingUIViewport WithRadiusBetween(MoveableBodyPart center, MoveableBodyPart circumferencePoint) { return new TrackingUIViewport(center, circumferencePoint); }
public void Initialize(MoveableBodyPart leftHand, MoveableBodyPart rightHand, HighlightCanvas canvas) { LeftColorBox = new HighlightCanvasItemContext(canvas); RightColorBox = new HighlightCanvasItemContext(canvas); SpecifyActions(leftHand, rightHand); }
internal RelativeMove(MoveableBodyPart moveable) { this._moveable = moveable; this._centerPosition = null; }
public Point GetPositionOf(MoveableBodyPart bodyPart) { var projPos = bodyPart.CurrentProjectedPosition; return new Point(projPos.X, projPos.Y); }
private void SpecifyActions(MoveableBodyPart leftHand, MoveableBodyPart rightHand) { When.The(leftHand).Enters(LeftColorBox).Do(() => RectColor1 = new SolidColorBrush(Colors.Red)); When.The(leftHand).Leaves(LeftColorBox).Do(() => RectColor1 = new SolidColorBrush(Colors.Gray)); When.The(rightHand).Enters(LeftColorBox).Do(() => RectColor1 = new SolidColorBrush(Colors.Green)); When.The(rightHand).Leaves(LeftColorBox).Do(() => RectColor1 = new SolidColorBrush(Colors.Gray)); When.The(rightHand).Enters(RightColorBox).Do(() => RectColor2 = new SolidColorBrush(Colors.Blue)); When.The(rightHand).Leaves(RightColorBox).Do(() => RectColor2 = new SolidColorBrush(Colors.Gray)); }
private void SetupContextEvents(MoveableBodyPart lHand, MoveableBodyPart rHand) { When.The(lHand).Enters(LeftKinectBox).Do(() => this.Brush1 = Brushes.Red); When.The(lHand).Enters(RightKinectBox).Do(() => this.Brush2 = Brushes.Red); When.The(rHand).Enters(LeftKinectBox).Do(() => this.Brush1 = Brushes.Blue); When.The(rHand).Enters(RightKinectBox).Do(() => this.Brush2 = Brushes.Blue); When.The(lHand).Leaves(LeftKinectBox).Do(() => this.Brush1 = Brushes.Gray); When.The(lHand).Leaves(RightKinectBox).Do(() => this.Brush2 = Brushes.Gray); When.The(rHand).Leaves(LeftKinectBox).Do(() => this.Brush1 = Brushes.Gray); When.The(rHand).Leaves(RightKinectBox).Do(() => this.Brush2 = Brushes.Gray); }
public HighlightCanvasItemContextHandlers When(MoveableBodyPart bodyPart) { return new HighlightCanvasItemContextHandlers(bodyPart, _canvas, _elements); }
public void WhenMoved(MoveableBodyPart bodyPart, Action<double, double, MoveableBodyPart> handler) { RegisterMovingHandler(bodyPart, handler); }
private void RegisterMovingHandler(MoveableBodyPart bodyPart, Action<double, double, MoveableBodyPart> handler) { _highlights[bodyPart].OnMove += (x, y) => handler(x, y, bodyPart); }
protected TrackingUIViewport(MoveableBodyPart center, MoveableBodyPart circumferencePoint) : base(center, circumferencePoint) { }
private void SetupSelectionContext(TrackingEllipseCanvas canvas, MoveableBodyPart lHand, MoveableBodyPart rHand) { LeftKinectBox = new HighlightCanvasItemContext(canvas); RightKinectBox = new HighlightCanvasItemContext(canvas); }
internal WhenCondition(MoveableBodyPart bodyPart) { _bodyPart = bodyPart; }
public double Distance2DTo(MoveableBodyPart otherBodyPart) { return MVector3D.Distance2D(this.CurrentPosition, otherBodyPart.CurrentPosition); }
public void ForceActivision(MoveableBodyPart bodyPart) { base.ForceActivision(base.GetHighlightOf(bodyPart)); }
public void ChangeColor(MoveableBodyPart bodyPart, Brush color) { var highlight = base.GetHighlightOf(bodyPart) as TrackingEllipse; highlight.ChangeColor(color); }
public static WhenCondition The(MoveableBodyPart bodyPart) { return new WhenCondition(bodyPart); }
private HighlightCanvasHighlight StartTrackingForHighlight(HighlightCanvasHighlight hl, MoveableBodyPart bodyPart) { hl.StartTracking(bodyPart).WhenMoved((center) => this.MoveHighlightToPoint(hl, center(this.CurrentCenter))); hl.WhenActivated(this.ActivateHightlight).RelativeTo(this.GetPrimaryHighlight); hl.WhenDeactivated(this.DeactivateHightlight); return hl; }
private void SetPointInformation(MoveableBodyPart center, MoveableBodyPart circumferencePoint) { this._pointConverter = null; this._center = center; this._circumferencePoint = circumferencePoint; }
protected HighlightCanvasHighlight GetHighlightOf(MoveableBodyPart bodyPart) { return this._highlights[bodyPart]; }
protected TrackingWindow(MoveableBodyPart center, MoveableBodyPart circumferencePoint) { this.SetPointInformation(center, circumferencePoint); this.ResizeFactor = 1; this.SetupMoveEvent(); }
public static TrackingWindow WithRadiusBetween(MoveableBodyPart center, MoveableBodyPart circumferencePoint) { return new TrackingWindow(center, circumferencePoint); }
private void SetupCanvas(TrackingEllipseCanvas canvas, MoveableBodyPart head, MoveableBodyPart lHand, MoveableBodyPart rHand, MoveableBodyPart lShoulder, MoveableBodyPart rShoulder) { canvas.StartTracking(lHand, rHand, head, lShoulder, rShoulder); canvas.ChangeColor(lHand, Brushes.Blue); canvas.ChangeColor(rHand, Brushes.Blue); canvas.ChangeColor(head, Brushes.LightGray); canvas.ChangeColor(lShoulder, Brushes.LightGray); canvas.ChangeColor(rShoulder, Brushes.LightGray); canvas.ForceActivision(head); canvas.ForceActivision(lShoulder); canvas.ForceActivision(rShoulder); canvas.Viewport = TrackingWindow.WithRadiusBetween(lShoulder, head).ResizedBy(2).Within(canvas); }