1
我有一個Vaadin應用程序,我想集成Google熱圖。我正在使用com.vaadin.tapio.googlemaps依賴項來顯示地圖,它工作正常。但是,我不確定如何在Google地圖頂部添加熱圖層,並且找不到任何相關資源。我的審判代碼Vaadin如何添加Google熱圖
有關部分看起來是這樣的:
VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
// Google Map
GoogleMap googleMap = new GoogleMap("api_key", null, null);
googleMap.setZoom(10);
googleMap.setSizeFull();
googleMap.setMinZoom(4);
googleMap.setMaxZoom(16);
Panel mapsPanel = new Panel();
mapsPanel.setSizeFull();
mapsPanel.setContent(googleMap);
rootLayout.addComponent(mapsPanel);
double centerLon = 8.5417;
double centerLat = 47.3769;
googleMap.setCenter(new LatLon(centerLat, centerLon));
GoogleMapMarker centerMarker = new GoogleMapMarker("Zurich", new LatLon(centerLat, centerLon),true, null);
googleMap.addMarker(centerMarker);
HeatMapLayer heatMapLayer = HeatMapLayer.newInstance(HeatMapLayerOptions.newInstance());
// Add data to heatmap
...
// How can I add this HeatMapLayer to the existing map?
// Or do I need a different approach?
UI.getCurrent().setContent(rootLayout);
我嘗試了叉;然而,他們的熱圖對我沒有任何幫助。我嘗試了他們的演示,並將'GoogleMapHeatMapLayer'集成到了我的應用中,但都沒有成功。儘管如此,謝謝你的信息。 – Egemen