List of usage examples for com.google.gwt.maps.client.visualizationlib HeatMapLayerOptions setMap
public final void setMap(MapWidget mapWidget)
From source file:com.google.gwt.maps.testing.client.maps.HeatMapLayerWidget.java
License:Apache License
private void drawMap() { // zoom out for the clouds LatLng center = LatLng.newInstance(40.74, -73.94); MapOptions opts = MapOptions.newInstance(); opts.setZoom(11);/* w w w .j a va 2s. co m*/ opts.setCenter(center); opts.setMapTypeId(MapTypeId.TERRAIN); mapWidget = new MapWidget(opts); pWidget.add(mapWidget); mapWidget.setSize("750px", "500px"); // show transit layer TransitLayer transitLayer = TransitLayer.newInstance(); transitLayer.setMap(mapWidget); // create layer HeatMapLayerOptions options = HeatMapLayerOptions.newInstance(); options.setOpacity(0.9); options.setRadius(5); options.setGradient(getSampleGradient()); options.setMaxIntensity(3); options.setMap(mapWidget); HeatMapLayer heatMapLayer = HeatMapLayer.newInstance(options); // set data JsArray<LatLng> dataPoints = getSampleData(); heatMapLayer.setData(dataPoints); // the other way to set data // note JS array can be set from this method, but only MVCArray from the // options setData() method // MVCArray<WeightedLocation> weightedDataPoints = // MVCArray.newInstance(getSampleWeightedData()); // heatMapLayer.setDataWeighted(weightedDataPoints); GWT.log("Plotting " + dataPoints.length() + " points on HeatMap"); }