From 42fbab353612abe7e24272b7a7658e5d8ff840a2 Mon Sep 17 00:00:00 2001 From: Eric Durante Date: Fri, 7 Mar 2014 12:38:23 -0500 Subject: [PATCH 1/4] Add bicycling layer as option --- src/maplace.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/maplace.js b/src/maplace.js index a83d14c..93654ac 100644 --- a/src/maplace.js +++ b/src/maplace.js @@ -177,6 +177,7 @@ start: 0, locations: [], commons: {}, + bicycling_layer: false, map_options: { mapTypeId: google.maps.MapTypeId.ROADMAP, zoom: 1 @@ -264,6 +265,11 @@ }).appendTo(this.map_div); this.oMap = new google.maps.Map(this.canvas_map.get(0), this.o.map_options); + + if (this.o.bicycling_layer) { + var l = new google.maps.BicyclingLayer(); + l.setMap(this.oMap); + } } catch (err) { this.errors.push(err.toString()); } From 41a1e49c5ed12289190c388cea5438f56c9612c8 Mon Sep 17 00:00:00 2001 From: Eric Durante Date: Fri, 7 Mar 2014 14:52:37 -0500 Subject: [PATCH 2/4] Hide/show bicycling layer --- src/maplace.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/maplace.js b/src/maplace.js index 93654ac..fd8c254 100644 --- a/src/maplace.js +++ b/src/maplace.js @@ -145,6 +145,8 @@ this.oMap = false; this.view_all_key = 'all'; + this.bicycling_layer = new google.maps.BicyclingLayer(); + this.bicycling_layer_shown = false; this.infowindow = null; this.ln = 0; this.oMap = false; @@ -267,8 +269,7 @@ this.oMap = new google.maps.Map(this.canvas_map.get(0), this.o.map_options); if (this.o.bicycling_layer) { - var l = new google.maps.BicyclingLayer(); - l.setMap(this.oMap); + this.ShowBicyclingLayer(); } } catch (err) { this.errors.push(err.toString()); @@ -723,6 +724,16 @@ this.debug('03'); }; + Maplace.prototype.ShowBicyclingLayer = function () { + this.bicycling_layer.setMap(this.oMap); + this.bicycling_layer_shown = true; + }; + + Maplace.prototype.HideBicyclingLayer = function () { + this.bicycling_layer.setMap(null) + this.bicycling_layer_shown = false; + }; + //replace current locations Maplace.prototype.SetLocations = function (locs, reload) { this.o.locations = locs; From b2bf7b9658ba54578cd6f0e83742734744e8b523 Mon Sep 17 00:00:00 2001 From: Eric Durante Date: Thu, 13 Mar 2014 20:03:40 -0400 Subject: [PATCH 3/4] Expose method to check bicycling layer state --- src/maplace.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/maplace.js b/src/maplace.js index fd8c254..3ac8cf9 100644 --- a/src/maplace.js +++ b/src/maplace.js @@ -793,6 +793,11 @@ return this.loaded; }; + //check if bicycling layer has been overlayed on map + Maplace.prototype.BicyclingLayerShown = function () { + return this.bicycling_layer_shown; + }; + //loads the options Maplace.prototype._init = function () { //store the locations length From edb8b80badcc101a1befea11e9496d06564aafcb Mon Sep 17 00:00:00 2001 From: Eric Durante Date: Thu, 13 Mar 2014 20:04:11 -0400 Subject: [PATCH 4/4] Describe methods with comments --- src/maplace.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/maplace.js b/src/maplace.js index 3ac8cf9..c6786d6 100644 --- a/src/maplace.js +++ b/src/maplace.js @@ -724,11 +724,13 @@ this.debug('03'); }; + //overlay the bicycling layer on the map Maplace.prototype.ShowBicyclingLayer = function () { this.bicycling_layer.setMap(this.oMap); this.bicycling_layer_shown = true; }; + //remove the bicycling layer from the map Maplace.prototype.HideBicyclingLayer = function () { this.bicycling_layer.setMap(null) this.bicycling_layer_shown = false;