﻿/** 
* Class: VisKort.Services
*
* Utility class to handle interaction with server-side services
*/
VisKort.Utils.Services = OpenLayers.Class({

    /** 
    * Constructor: VisKort.Services
    */
    initialize: function() {
    },

    /** 
    * Method: reverseGeocodeLonlat
    * Method to call service to reverse geocode (find an address from a coordinat set)
    *
    * lonlat - <OpenLayers.LonLat>
    * callback - <Function> callback function (on success)
    */
    reverseGeocodeLonlat: function(lonlat, callback) {
        var geocodeServiceProxy = new Geocode();
        geocodeServiceProxy.set_defaultSucceededCallback(callback);
        geocodeServiceProxy.set_defaultFailedCallback(this.callbackFail);
        geocodeServiceProxy.ReverseGeocode(lonlat.lon, lonlat.lat);
    },

    /** 
    * Method: callbackFail
    * Local service callback method (on failure). Displays the error
    */
    callbackFail: function(args) {
        alert("En service returnede en fejl: " + args);
    },

    CLASS_NAME: "VisKort.Utils.Services"
});


