public override void Draw(DrawingContext drawingContext, MapArea viewarea, double zoomRate) { PointInt p1 = BingMapTileSystem.LatLngToPixelXY(pos1, viewarea.Level); PointInt p2 = BingMapTileSystem.LatLngToPixelXY(pos2, viewarea.Level); RectInt rect = RectInt.FromLTRB(p1.X, p1.Y, p2.X, p2.Y); drawingContext.DrawRectangle(Brushes.Blue, new Pen(), new System.Windows.Rect((rect.X - viewarea.Area.X) * zoomRate, (rect.Y - viewarea.Area.Y) * zoomRate, rect.Width * zoomRate, rect.Height * zoomRate)); base.Draw(drawingContext, viewarea, zoomRate); }
public override bool HitTest(MapLocation pos, InputEventType inputtype) { PointInt p1 = BingMapTileSystem.LatLngToPixelXY(pos1, pos.Level); PointInt p2 = BingMapTileSystem.LatLngToPixelXY(pos2, pos.Level); switch (inputtype) { case InputEventType.MouseMove: RectInt rect = RectInt.FromLTRB(p1.X, p1.Y, p2.X, p2.Y); if (rect.Contains(pos.Position)) { OnMouseMoveOn(); return(true); } OnMouseMoveNotOn(); return(false); } return(false); }