File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
main/java/com/flowingcode/vaadin/addons/googlemaps
test/java/com/flowingcode/vaadin/addons/googlemaps Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,25 @@ public void disableScaleControl(boolean disable) {
300300 this .getElement ().setProperty ("disableScaleControl" , disable );
301301 }
302302
303+ /**
304+ * Sets the mapId. See
305+ * https://developers.google.com/maps/documentation/javascript/cloud-based-map-styling
306+ *
307+ * @param mapId If set, the custom style associated with that map id is applied.
308+ */
309+ public void setMapId (String mapId ) {
310+ this .getElement ().setProperty ("mapId" , mapId );
311+ }
312+
313+ /**
314+ * Returns the current map id.
315+ *
316+ * @return The current map id.
317+ */
318+ public String getMapId () {
319+ return this .getElement ().getProperty ("mapId" );
320+ }
321+
303322 public static class GoogleMapClickEvent extends ClickEvent <GoogleMap > {
304323 private final double lat ;
305324 private final double lon ;
@@ -426,4 +445,5 @@ public Registration addGeolocationErrorEventListener(
426445 ComponentEventListener <GeolocationErrorEvent > listener ) {
427446 return addListener (GeolocationErrorEvent .class , listener );
428447 }
448+
429449}
Original file line number Diff line number Diff line change 1+ package com .flowingcode .vaadin .addons .googlemaps ;
2+
3+ import com .flowingcode .vaadin .addons .demo .DemoSource ;
4+ import com .flowingcode .vaadin .addons .googlemaps .GoogleMap .MapType ;
5+ import com .vaadin .flow .router .PageTitle ;
6+
7+ @ PageTitle ("MapId Styling Demo" )
8+ @ DemoSource (
9+ "https://github.com/FlowingCode/GoogleMapsAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/googlemaps/CloudBasedMapStylingDemo.java" )
10+ @ SuppressWarnings ("serial" )
11+ public class CloudBasedMapStylingDemo extends AbstractGoogleMapsDemo {
12+
13+ @ Override
14+ protected void createGoogleMapsDemo (String apiKey ) {
15+ GoogleMap gmaps = new GoogleMap (apiKey , null , null );
16+ gmaps .setMapType (MapType .ROADMAP );
17+ gmaps .setSizeFull ();
18+ gmaps .setCenter (new LatLon (-31.636036 , -60.7055271 ));
19+ gmaps .setMapId ("8e0a97af9386fef" );
20+ add (gmaps );
21+ }
22+
23+ }
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ public GooglemapsDemoView() {
3636 addDemo (new GeolocationDemo ());
3737 addDemo (new DraggableMarkerDemo ());
3838 addDemo (new DisableUIControlsDemo ());
39+ addDemo (new CloudBasedMapStylingDemo ());
3940 setSizeFull ();
4041 }
4142}
You can’t perform that action at this time.
0 commit comments