Pepperwhite TechNote
Determining the width of a rubber band rectangle dragged on the map
Description
pepperwhite street normally zooms into the rectangular area defined by a rubberband rectangle dragged on the map by your user.
This default behaviour establishes a new ScaleFactor for the map. In many applications, it is useful to have this information before the map is redrawn. The technique for approximating the value which will become the map's new ScaleFactor can be computed as demonstrated in the sample code below.
Sample Code
Sub Map1_DelineationConcluded (TopLat As Long, LeftLng As Long, BottomLat As Long, RightLng As Long, Zoom As Long) Dim L1 As Long ' Determine mean Latitude inside the rectangle L1 = (TopLat + BottomLat) / 2 ' Measure the distance from the left edge of ' the rectangle... Map1.Latitude = L1 Map1.Longitude = LeftLng Map1.Action = pwSetFromPoint ' ...to the right edge of the rectangle. Map1.Latitude = L1 Map1.Longitude = RightLng Map1.Action = pwGetDistance ' Report width of the box in feet. Debug.Print Map1.Value End Sub