public void MoveJoystick(Point point, Point prev) { var offset = point.Subtract(prev); //touchPos = touchPos.Add(offset); touchPos = point; var delta = touchPos.Subtract(Center); var newPos = touchPos; var angle = delta.ToAngle(); var joybtnDist = DistanceFromJoyPad(newPos); if (joybtnDist > Radius) { var direction = PointHelper.ForAngle(angle); newPos = Center.Add(direction.Multiply(Radius)); joybtnDist = Radius; } ThumbCenter = newPos; }
private void FindContrastBlocks() { // Setup some constants int stepSize = image.Width / 2 / 50; stepSize = stepSize < 1 ? 1 : stepSize; // Read some pixelData to find "dips" (possibly the contrastblocks) FindPossibleContrastLocations(new Point(0, -stepSize), Center.Add(new Point((int)(image.Width * 0.1f), 0))); //FindPossibleContrastLocations(new Point(0, -stepSize), // Center.Add(new Point((int)(image.Width * 0.1f), 0)), // Center.Add(new Point((int)(image.Width * -0.1f), 0)) // ); //ushort[] values; //values = GetDottedLine(Center.Add(new Point((int)(image.Width * 0.1f), 0)), new Point(0, -stepSize)); //values = GetDottedLine(Center.Add(new Point((int)(-image.Width * 0.1f), 0)), new Point(0, -stepSize)); }
/// <summary> /// get all Report in the system and divide them to four categories /// </summary> public async void getAllReports() { var allreport = await currentModel.allReports(); foreach (var r in allreport) { if (r.Latitude > 32.144343 && r.Latitude <= 33.333795 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { North.Add(r); } else if (r.Latitude > 31.571548 && r.Latitude <= 32.144343 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { Center.Add(r); } else if (r.Latitude > 29.497512 && r.Latitude <= 31.571548 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { South.Add(r); } else { Other.Add(r); } } }
private void OnWindowResize(Size screenSize) { Center = Center.Add(screenSize.Substract(ScreenSize).Divide(2).ToPoint()); ScreenSize = screenSize; }
internal PointF GetDirectionAsPointAbsolute(float scale) { return(Center.Add(GetDirectionAsPoint(scale))); }