Hi John,
I don’t have the link, so I post the code below (translated from C#).
I hope you can help !
Kind regards,
Guido van den Boom
Private Sub mapView_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles Me.Loaded
Me.ExtentOverlay = New MyExtentInteractiveOverlay(Me)
end sub
Class MyExtentInteractiveOverlay
Inherits ExtentInteractiveOverlay
Private mapView As MapView
Private trackStartScreenPoint As System.Windows.Point
Private trackEndScreenPoint As System.Windows.Point
Public Sub New(ByVal mapView As MapView)
Me.mapView = mapView
. Me.TrackZoomInKey = System.Windows.Input.Key.LeftCtrl
End Sub
Protected Overrides Function MouseDownCore(ByVal interactionArguments As InteractionArguments) As InteractiveResult
trackStartScreenPoint = New System.Windows.Point(interactionArguments.ScreenX, interactionArguments.ScreenY)
Return MyBase.MouseDownCore(interactionArguments)
End Function
Protected Overrides Function MouseMoveCore(ByVal interactionArguments As InteractionArguments) As InteractiveResult
Return MyBase.MouseMoveCore(interactionArguments)
End Function
Protected Overrides Function MouseUpCore(ByVal interactionArguments As InteractionArguments) As InteractiveResult
Dim result As InteractiveResult = MyBase.MouseUpCore(interactionArguments)
Dim bSelectionDirectionRight As Boolean = True
Dim SelectableShapes As InMemoryFeatureLayer = New InMemoryFeatureLayer()
trackEndScreenPoint = New System.Windows.Point(interactionArguments.ScreenX, interactionArguments.ScreenY)
If ExtentChangedType = ExtentChangedType.TrackZoomIn Then
Me.mapView.EditOverlay.EditShapesLayer.InternalFeatures.Clear()
If Math.Abs(trackStartScreenPoint.X - trackEndScreenPoint.X) > MinimumTrackZoomInExtentInPixels AndAlso Math.Abs(trackStartScreenPoint.Y - trackEndScreenPoint.Y) > MinimumTrackZoomInExtentInPixels Then
Dim rotatedTrackStartScreenPoint = MapUtil.GetRotatedScreenPoint(trackStartScreenPoint.X, trackStartScreenPoint.Y, MapArguments.RotationAngle, MapArguments.PivotScreenPoint)
Dim rotatedTrackEndScreenPoint = MapUtil.GetRotatedScreenPoint(trackEndScreenPoint.X, trackEndScreenPoint.Y, MapArguments.RotationAngle, MapArguments.PivotScreenPoint)
Dim startPointInDegree As PointShape = MapArguments.ToWorldCoordinate(rotatedTrackStartScreenPoint)
Dim endPointInDegree As PointShape = MapArguments.ToWorldCoordinate(rotatedTrackEndScreenPoint)
Dim minX As Double = If(startPointInDegree.X < endPointInDegree.X, startPointInDegree.X, endPointInDegree.X)
Dim maxX As Double = If(startPointInDegree.X < endPointInDegree.X, endPointInDegree.X, startPointInDegree.X)
Dim minY As Double = If(startPointInDegree.Y < endPointInDegree.Y, startPointInDegree.Y, endPointInDegree.Y)
Dim maxY As Double = If(startPointInDegree.Y < endPointInDegree.Y, endPointInDegree.Y, startPointInDegree.Y)
Dim newCurrentExtent As RectangleShape = New RectangleShape(minX, maxY, maxX, minY)
’ Rest of the code in this function