public static Point DistanceVectorFrom(this SkeletonPoint point1, SkeletonPoint point2, double controlWidth, double controlHeight) { var screenPoint1 = point1.ToScreenPoint(controlWidth, controlHeight); var screenPoint2 = point2.ToScreenPoint(controlWidth, controlHeight); var deltaX = (screenPoint1.X - screenPoint2.X) / controlWidth; var deltaY = (screenPoint1.Y - screenPoint2.Y) / controlHeight; return new Point(deltaX, deltaY); }
protected override void RunPanning(SkeletonPoint handPoint) { var screenCoordinate = handPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); var location = Location.GetCoordinates(_map, screenCoordinate); DoPan(handPoint); if (KinectPanning != null) { KinectPanning(location.ToMapCoord()); } }
protected override void RunZooming(SkeletonPoint rightHandPoint, SkeletonPoint leftHandPoint) { var rightHandCoordinate = rightHandPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); var leftHandCoordinate = leftHandPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); DoZoomMap(rightHandCoordinate, leftHandCoordinate); if (KinectZooming != null) { KinectZooming(); } }
protected override void StartZoom(SkeletonPoint rightHandPoint, SkeletonPoint leftHandPoint) { IsZooming = true; _startRightHandScreenCoord = rightHandPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); _startLeftHandScreenCoord = leftHandPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); _startDistance = _startRightHandScreenCoord.DistanceFrom(_startLeftHandScreenCoord); _startZoomLevel = _map.ZoomLevel; if (KinectZoomStarted != null) { KinectZoomStarted(); } }
protected override void StartPan(SkeletonPoint handPoint) { IsPanning = true; _startHandPoint = handPoint; var screenCoordinate = handPoint.ToScreenPoint(_map.ActualWidth, _map.ActualHeight); _startHandCoordinate = Location.GetCoordinates(_map, screenCoordinate); var rect = _map.GeographicalBounds; _startExtent = new Rect(rect.TopLeft, rect.BottomRight); var currCenter = _map.Center; _startMapCenter = new Location(currCenter.Latitude, currCenter.Longitude); if (KinectPanStart != null) { KinectPanStart(_startHandCoordinate.ToMapCoord()); } }