Queries the API support service for items such as tile usage counts.
The following example shows how to add the support service to the map:
var osMap, screenOverlay, supportService;
function init()
{
osMap = new OpenSpace.Map('map');
// Add a screen Overlay
screenOverlay = new OpenSpace.Layer.ScreenOverlay("tilecount");
screenOverlay.setPosition(new OpenLayers.Pixel(10, 480));
osMap.addLayer(screenOverlay);
osMap.setCenter(new OpenSpace.MapPoint(438760,114760), 8);
// Create a new service
supportService = new OpenSpace.SupportService();
// Register to query service when map is moved
osMap.events.register("moveend", osMap, function(e) {
supportService.getTileCount(results);
});
}
function results(tilesUsed, maxTiles)
{
// Draw results on screen in overlay
screenOverlay.setHTML("<DIV style=\"width: 250px; height=75px; color: white; background-color: gray; font-size: 20px\">" +
"Tiles Used: " + tilesUsed + " of " + maxTiles + " </DIV>");
}| OpenSpace. | Queries the API support service for items such as tile usage counts. |
| Constructor | |
| OpenSpace. | Create a new OpenSpace.SupportService instance |
| Functions | |
| getTileCount | Sends a query to the support server to find out the current map tile usage and the maximum number of available tiles. |
| getGazetteerCount | Sends a query to the support server to find out the current gazetteer usage and the maximum number of available requests. |
| getPostcodeCount | Sends a query to the support server to find out the current postcode usage and the maximum number of available requests. |
| getBoundaryCount | Sends a query to the support server to find out the current boundary usage and the maximum number of available requests. |
| _doServiceQuery | Sets up and calls a JSON request to the support server. |
| _getTileCountCallback | Calls the given callback function with the results of the query. |
| _getGazetteerCountCallback | Calls the given callback function with the results of the query. |
| _getPostcodeCountCallback | Calls the given callback function with the results of the query. |
| _getBoundaryCountCallback | Calls the given callback function with the results of the query. |
getTileCount: function( callback )
Sends a query to the support server to find out the current map tile usage and the maximum number of available tiles.
| callback | {Function} A function to call with the result. |
{tilesUsed, maxTiles} Calls the callback function with the number of tiles used by this API key and the maximum number available.
getGazetteerCount: function( callback )
Sends a query to the support server to find out the current gazetteer usage and the maximum number of available requests.
| callback | {Function} A function to call with the result. |
{gazetteerCount, maxRequests} Calls the callback function with the number of gazetteer requests made by this API key and the maximum number of requests available.
getPostcodeCount: function( callback )
Sends a query to the support server to find out the current postcode usage and the maximum number of available requests.
| callback | {Function} A function to call with the result. |
{postcodeCount, maxRequests} Calls the callback function with the number of postcode requests made by this API key and the maximum number of requests available.
getBoundaryCount: function( callback )
Sends a query to the support server to find out the current boundary usage and the maximum number of available requests.
| callback | {Function} A function to call with the result. |
{boundaryCount, maxRequests} Calls the callback function with the number of boundary requests made by this API key and the maximum number of requests available.
_doServiceQuery: function( query, callback )
Sets up and calls a JSON request to the support server.
| query | {String} The specific query to ask to support service. |
| callback | {Function} A function to call with the results. |
{JSON} JSON data containing details of the results of this query.
Sends a query to the support server to find out the current map tile usage and the maximum number of available tiles.
getTileCount: function( callback )
Sends a query to the support server to find out the current gazetteer usage and the maximum number of available requests.
getGazetteerCount: function( callback )
Sends a query to the support server to find out the current postcode usage and the maximum number of available requests.
getPostcodeCount: function( callback )
Sends a query to the support server to find out the current boundary usage and the maximum number of available requests.
getBoundaryCount: function( callback )
Sets up and calls a JSON request to the support server.
_doServiceQuery: function( query, callback )
Calls the given callback function with the results of the query.
_getTileCountCallback: function( jsonData )
Calls the given callback function with the results of the query.
_getGazetteerCountCallback: function( jsonData )
Calls the given callback function with the results of the query.
_getPostcodeCountCallback: function( jsonData )
Calls the given callback function with the results of the query.
_getBoundaryCountCallback: function( jsonData )