Module: Google4R::Maps

Defined in:
lib/google4r/maps.rb

Overview

On Javascript Generation

We have decided not to create variables for the created GIcons and GMarkers. Instead, the generated Javascript are anonymous functions which return the objects.

For example, if you create a marker then the following JS code could be created:

function() {
  var marker = new GMarker(new GLatLng(42, 42));
  marker.clickable = false;
}

This function is then used to add markers to the map in the following way:

var map = new GMap(/* ... */)
// ...
map.addMarker(function(){
  var marker = new GMarker(new GLatLng(42, 42));
  marker.clickable = false;
}());

The reasoning behind is that the only thing you want to touch in the generated JS is the GMap2 instance. If you want to remove any markers then you better create them directly in your Javascript. – TODO: All those line collecting and then joining could prove slow. TODO: Allow Rails-ish :foo => ‘bar’ options for all attributes to constructors. ++

Defined Under Namespace

Classes: ConnectionException, GIcon, GMap2, GMarker, Geocoder, KeyException