public function initTool():Void
Overrides PanTool definition.
Sets up event handlers.
startDragging
private function startDragging( event:Object ):Void
Overrides PanTool definition. Captures screen-coordinate information from user mouse drag.
drawSearchBounds
public function drawSearchBounds( centerPoint:mx.graphics.Point, radialPoint:mx.graphics.Point ):Void
Creates empty movieclip that serves as the container for the circle graphic
representing the search area.
- Parameters:
centerPoint | The center Point of the circle representing the search radius. |
radialPoint | A Point on the circumference of the circle representing the search radius. |
- Returns:
- None
drag
private function drag( event:Object ):Void
Overrides PanTool definition. Initiates drawing routine.
square
private function square( n:Number ):Number
Syntactic sugar function.
- Parameters:
- Returns:
- The square of the argument,
n
distanceFromLatLon
public function distanceFromLatLon( p1:Object, p2:Object):Number
Calculate distance (in miles) between two points specified by
latitude/longitude with Haversine formula. This code
is made available for use by:
Chris Veness © 2002-2006
- Parameters:
p1 | The initial Point. Note that although parameter type is Object ,
this method expects an Object of type com.yahoo.maps.LatLon . ( This should be made explicit in the future ). |
p2 | The terminal Point. |
- Returns:
- The distance in miles between the initial Point
p1
and the terminal Point p2
Deg2Rad
public function Deg2Rad( deg:Number )
Convert degrees to radians.
- Parameters:
deg | Angle measure in degrees. |
- Returns:
- Corresponing radian measure.
Rad2Deg
public function Rad2Deg( rad:Number )
Convert radians to degrees.
- Parameters:
rad | Angle measure in radians. |
- Returns:
- Corresponding degree measure.
removeCircle
public function removeCircle( ):Void
Clear the map of the search circle graphic and the mile text.
- Parameters:
- Returns:
- none
getSearchBounds
private function getSearchBounds( rad:Number, c_latlon:com.yahoo.maps.LatLon ) :com.yahoo.maps.LatLonRect
Utility function to calculate corresponding com.yahoo.maps.LatLonRect
Object from the
specified search radius.
- Parameters:
rad | Radius in miles |
c_latlon | Center of search radius circle as c_latlon:com.yahoo.maps.LatLon |
- Returns:
com.yahoo.maps.LatLon
Object representing the new map bounds. Ideally
the circle defined by the given center and radius should be completely
inscribed within the determined LatLonRect--need to check that this is
indeed the case.
destPointByLatLon
private function destPointByLatLon( distance:Number, bearing:Number, startPoint:Object ):com.yahoo.maps.LatLon
Calculate the Lat/Lon coordinates for a terminal Point given a distance, bearing, and an initial Point.
- Parameters:
distance | distance, in miles from intial Point |
bearing | bearing from initial Point, measured in degrees |
- Returns:
com.yahoo.maps.LatLon
Object representing the terminal Point
updateBounds
public function updateBounds( ):Void
Zooms map to bounds determined by most recently dragged
search radius.
- Parameters:
- Returns:
- None
checkZoomLevel
private function checkZoomLevel( ):Void
sets private member boolean atStreetLevel depending on the map's zoom level
1 corresponds to street level, 17 is the opposite extreme: the world view.
getSearchCircle
public function getSearchCircle( ):Object
Creates a custom Object containing the lat/lon and radius
of the most recent mouse drag representing the search radius.
- Parameters:
- Returns:
circle
Object encapsulating the circle's center: circle.center
as type
com.yahoo.maps.LatLon
, and the circle's radius, in miles: circle.radius
setSane
public function setSane( sane:Boolean )
Accessor method to set the private sane
state variable.
- Parameters:
sane | boolean indicating whether the map is in process of a zoom , pan , or other state change
that could possibly cause an incoherent result. |
- Returns:
- None
isSane
public function isSane():Boolean
Accessor method to query the private sane
state variable
- Parameters:
- Returns:
this
RadiusSearchTool's sane
state
redrawCircle
public function redrawCircle()
Utility method to request the circle graphic be updated.
decode
public function decode( u0:Number, v0:Number, u1:Number, v1:Number )
Debugging method. Converts parameters to Lat/Lon coordinates utilizing Yahoo's undocumented
methods: offsetPointToLatLon
and localPointToLatLon
.
Note: The coordinate system of the passed in arguments is user defined.
- Parameters:
u0 | first coordinate of first Point |
v0 | second coordinate of first Point |
u1 | first coordinate of second Point |
v1 | second coordinate of second Point |
- Returns:
- custom
pointWrapper
Object containing properties pointWrapper.p1
and
pointWrapper.p2
which represent the first and second arguments, respectively, under the tranformation
of the Yahoo undocumented methods ( as Lat/Lon Objects ). Subject to change without notice.
reCenter
public function reCenter()
Utility method to recenter the map based on the most recent search radius center.
- Parameters:
- Returns:
- None
public function resetTool():Void
Reinitializes tool to default state.
- Parameters:
- Returns:
- None
waitNotify
private function waitNotify():Void
Overlays "Please Wait" message on map during process of map zoom.
- Parameters:
- Returns:
- None
zoomStart
public function zoomStart( event:Object ):Void
Event handler for tool's associated map zoomStart
event.
Calls this object's waitNotify
method
zoomStop
public function zoomStop( event:Object ):Void
Event handler removes wait message on map zoomStop
event dispatch
panStart
public function panStart( event:Object ):Void
Event handler for this map's panStart
event.
Updates this tool's sane
property.
panStop
public function panStop( event:Object ):Void
Event handler for this map's panStop
event.
Updates this tool's sane
property.
zoom
public function zoom( event:Object ):Void
Event handler for this map's zoom
event.
Updates this tool's sane
property.
registerListeners
private function registerListeners():Void
Method called on this Ojbect's initTool
invocation.
Associates this Ojbects event handlers with the associated Yahoo map's events.
- Parameters:
- Returns:
- None
unregisterListeners
private function unregisterListeners():Void
Removes all currently registered Listeners associated with this Object.
- Parameters:
- Returns:
- None
enqueue
private function enqueue( event_id:String, handler:Object )
Method to manage/track event handler's registered with this Object
- Parameters:
- Returns:
- None