Forum Home

Class AGSearch

This is a service class that gives you searched result by code. It maintains its own cache or user defined cache.

Constructor

Constructor Description
AGSearch(AGSearchCache cache?) Creates a AGSearch object with options specified in the AGSearchCache.

Methods

Method Return Value Description
search(string searchString, function callback,AGSearchOptions options?) None Searches result using searchString passes to the callback function.
getCache() AGSearchCache
setCache(AGSearchCache cache) None
reset() None

Class AGSearchCache

This class is used to cache searched result according to the code. You can give this class object in constructor of AGSearch class.

Constructor

Constructor Description
AGSearchCache() Creates a AGSearchCache

Methods

Method Return Value Description
get (string address) string Returns the result for the address keyword.
isCachable (string reply) boolean
put (string address, string reply) None Inserts result into the cache using address and reply.
reset () None Clears the cache.
toCanonical (string address) string Converts address string to a storable format.

Class AGDirections

This class is used to obtain driving directions results and display them on a map and/or a text panel and/or other information.

Constructor

Constructor Description
AGDirections(AGMap map?, Div panel?) Creates a AGDirections object in the AGMap using the instruction div panel.

Methods

Method Return Value Description
load (AGCoord origin, AGCoord destination, AGDirectionsOptions options?) None Loads the direction using origin and destination coord with options specified in AGDirectionOptions
loadFromWayPoints (AGCoord[ ] wayPoints, AGDirectionsOptions options?) None Loads the direction using the wayPoints.
setDirectionsPanelStyle (string url) None Sets css of the url of the direction panel
clear () None Clears  the directions.
getJSONDirections (AGCoord[ ] viaPoints, function callback) None Gets JSON direction using viaPoints and passed to the callback function.
getBoundingBox() AGBoundingBox Returns the boundingbox created by the coords
getDistance() float Returns the distance from origin to destination coord.
getVertices() AGCoord[] Returns the array of vertices.
getPolyline() AGPolyline Returns the polyline.

Events

Event Description
onload

Class AGDirectionsOptions

This class is used as a argument of AGDirectionsOptions

Constructor

Constructor Description
AGDirectionsOptions(AGTravelMethods travelMethod, AGUnits unit, AGRoutePreferences routePreference, boolean avoidHighways, boolean avoidToolRoads, boolean avoidGravelRoads) Creates a AGDirections object in the AGMap using the instruction div panel.

Properties

Property Name Type Description
travelMethod AGTravelMethods The method of travel, such as driving (default) or walking.
unit AGUnits
routePreference AGRoutePreference The preference of route, such as fastest(By default).