class Maptimize.Proxy.GoogleMap
Proxy class to handle Google Map API. As any map proxy for AddressChooser, it must implement public methods (some methods can be empty but has to be implemented) All public methods are described on this page.
Methods
Constructor
new Maptimize.Proxy.GoogleMap(element, callback, context)
-
-
element(Element) – element used to create GMap2 object. -
-
callback(Function) – callback called when map is ready. -
-
context(Object) – calling context.
Creates a new Maptimize.Proxy.GoogleMap object used by Maptimize.AddressChooser.Widget. Calls callback on context when map is initiliazed and ready to use. By default map displays the entire world but this can be changed when callback is called.
Google Map script must be included before this script.
Instance methods
addEventListener
Maptimize.Proxy.GoogleMap#addEventListener(source, event, object, method) ->GEventListener-
-
source(Object) – source object. -
-
event(String) – event name. -
-
object(Object) – object used for calling method. -
-
method(Function) – function called when event is fired.
Registers an invocation of the method on the given object as the event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler.
-
-
centerOnClientLocation
Maptimize.Proxy.GoogleMap#centerOnClientLocation([zoom]) ->undefined-
-
zoom(Integer) – map zoom, default 8
Center map on user location (based on its IP) if available
-
-
getAddress
Maptimize.Proxy.GoogleMap#getAddress(placemark) ->String-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns full address of a placemark.
-
-
getCity
Maptimize.Proxy.GoogleMap#getCity(placemark) ->String-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns city name of a placemark. Returns an empty string if not found.
-
-
getCountry
Maptimize.Proxy.GoogleMap#getCountry(placemark) ->String-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns country name of a placemark. Returns an empty string if not found.
-
-
getLat
Maptimize.Proxy.GoogleMap#getLat(placemark) ->Number-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns latitude of a placemark.
-
-
getLng
Maptimize.Proxy.GoogleMap#getLng(placemark) ->Number-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns longitude of a placemark.
-
-
getMap
Maptimize.Proxy.GoogleMap#getMap() ->GMap2Returns Google Map object
getPlacemarks
Maptimize.Proxy.GoogleMap#getPlacemarks(address, callback, context) ->null-
-
address(String) – address to search -
-
callback(Function) – callback called when search is done. Callback will receive a placemarks array as first argument -
-
context(Object) – calling context
Looks for placemarks for a specific address, results are retreived through a callback: function(placemarks) called after receiving Google Map response.
-
-
getStreet
Maptimize.Proxy.GoogleMap#getStreet(placemark) ->String-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns street (address without zip, city, country) of a placemark. Returns an empty string if not found.
-
-
getZIP
Maptimize.Proxy.GoogleMap#getZIP(placemark) ->String-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks)
Returns ZIP (postal code) name of a placemark. Returns an empty string if not found.
-
-
hidePlacemark
Maptimize.Proxy.GoogleMap#hidePlacemark() ->undefinedHides placemark from the map, close info window if needed
removeEventListener
Maptimize.Proxy.GoogleMap#removeEventListener(handle) ->undefined-
-
handle(Object) – handle get by addEventListener.
Removes a handler that was installed by addEventListener.
-
-
setIcon
Maptimize.Proxy.GoogleMap#setIcon(icon) ->undefined-
-
icon(GIcon) – marker icon
Sets icon for marker displayed on the map. Must be called before displaying any marker on the map.
-
-
showMarker
Maptimize.Proxy.GoogleMap#showMarker(lat, lng, zoom[, address = null, callback = null, context = null]) ->undefined-
-
lat(Float) – marker's latitude. -
-
lng(Float) – marker's longitude. -
-
zoom(Integer) – map zoom. -
-
address(String) – address to display inside info window. -
-
callback(Function) – callback called when marker has benn drgged. Callback will received lat and lng as arguments. -
-
context(Object) – calling context for callback.
Displays placemark on the map and centers map on marker location. If an address is specified, marker will show this address in an info window
-
-
showPlacemark
Maptimize.Proxy.GoogleMap#showPlacemark(tagName[, showAddress = null, callback = null, context = null ]) ->undefined-
-
placemark(Object) – object representing Google Map placemark (get by calling getPlacemarks). -
-
showAddress(Boolean) – if true, displays address on the map inside an info window. -
-
callback(Function) – callback called when marker has been dragged. Callback will received lat and lng as arguments. -
-
context(Object) – calling context for callback
Displays placemark on the map.
-
-
trigger
Maptimize.Proxy.GoogleMap#trigger(source, event [, args]) ->undefined-
-
source(Object) – source object -
-
event(String) – event name
Fires a custom event on the source object. All remaining optional arguments after event are passed in turn as arguments to the event handler functions.
-
-