Skip to content

Commit

Permalink
Added traffic layer to map viz.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Oct 10, 2015
1 parent a17bdfe commit e841c87
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/fabrik_element/googlemap/googlemap-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/fabrik_element/googlemap/googlemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var FbGoogleMap = new Class({
'reverse_geocode': false,
'use_radius': false,
'geocode_on_load': false,
'traffic': true,
'traffic': false,
'styles': []
},

Expand Down
10 changes: 10 additions & 0 deletions plugins/fabrik_visualization/googlemap/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,16 @@
description="PLG_VISUALIZATION_GOOGLEMAP_ZOOMLEVEL_DESC"
label="PLG_VISUALIZATION_GOOGLEMAP_ZOOMLEVEL_LABEL" />

<field name="fb_gm_trafficlayer"
type="radio"
default="0"
class="btn-group"
description="PLG_VISUALIZATION_GOOGLEMAP_TRAFFIC_LAYER_DESC"
label="PLG_VISUALIZATION_GOOGLEMAP_TRAFFIC_LAYER_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field
name="fb_gm_center"
type="radio"
Expand Down
2 changes: 1 addition & 1 deletion plugins/fabrik_visualization/googlemap/googlemap-min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions plugins/fabrik_visualization/googlemap/googlemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var FbGoogleMapViz = new Class({
'zoomStyle': 0,
'radius_fill_colors': [],
'streetView': false,
'traffic': false,
'styles': []
},

Expand Down Expand Up @@ -150,6 +151,11 @@ var FbGoogleMapViz = new Class({
};
this.map = new google.maps.Map(document.id(this.element_map), mapOpts);
this.map.setOptions({'styles': this.options.styles});

if (this.options.traffic) {
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(this.map);
}

this.infoWindow = new google.maps.InfoWindow({
content: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ PLG_VISUALIZATION_GOOGLEMAP_ZOOM_CONTROL_STYLE_DESC="Show a small or large zoom
PLG_VISUALIZATION_GOOGLEMAP_ZOOM_CONTROL_STYLE_LABEL="Zoom control style"
PLG_VISUALIZATION_GOOGLEMAP_ZOOMLEVEL_LABEL="Start zoom level"
PLG_VISUALIZATION_GOOGLEMAP_ZOOMLEVEL_DESC="Zoom levels between 0 (the lowest zoom level, in which the entire world can be seen on one map) to 21+ (down to individual buildings)."
PLG_VISUALIZATION_GOOGLEMAP_TRAFFIC_LAYER_DESC="Show traffic layer"
PLG_VISUALIZATION_GOOGLEMAP_TRAFFIC_LAYER_LABEL="Traffic Layer"

; Front end
PLG_VISUALIZATION_GOOGLEMAP_CLEAR="Clear"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function getJs()
$opts->scalecontrol = (bool) $params->get('fb_gm_scalecontrol');
$opts->scrollwheel = (bool) $params->get('fb_gm_scrollwheelcontrol');
$opts->maptypecontrol = (bool) $params->get('fb_gm_maptypecontrol');
$opts->traffic = (bool) $params->get('fb_gm_trafficlayer', '0');
$opts->overviewcontrol = (bool) $params->get('fb_gm_overviewcontrol');
$opts->streetView = (bool) $params->get('street_view');
$opts->center = $params->get('fb_gm_center');
Expand Down

0 comments on commit e841c87

Please sign in to comment.