Class GMap

    • Constructor Detail

      • GMap

        public GMap​(String id,
                    String apiKey)
        Constructor. Default the header contributor of the component will added and the gmap will be initiated directly on rendering of the map.
        Parameters:
        id - wicket id
        apiKey - your Google API key
      • GMap

        public GMap​(String id,
                    String apiKey,
                    String scheme)
        Constructor. Default the header contributor of the component will added and the gmap will be initiated directly on rendering of the map.
        Parameters:
        id - wicket id
        scheme - the scheme ("http" or "https") which should be used
        apiKey - your Google API key
    • Method Detail

      • getMapId

        public String getMapId()
        Returns:
        the markup-id of the container
      • getTriggerEventScript

        public CharSequence getTriggerEventScript​(String event)
        Returns the script for triggering an event on map.
        Parameters:
        event -
        Returns:
      • getTriggerResizeScript

        public CharSequence getTriggerResizeScript()
        Returns:
        returns the script to make map re-paint after resize.
      • setDraggingEnabled

        public void setDraggingEnabled​(boolean enabled)
        Sets if dragging should be allowed or not.
        Parameters:
        enabled - true if dragging should be allowed, false otherwise
      • isDraggingEnabled

        public boolean isDraggingEnabled()
        Is dragging allowed? Enabled by default.
        Returns:
        true if it's allowed, false if not
      • setDoubleClickZoomEnabled

        public void setDoubleClickZoomEnabled​(boolean enabled)
        Sets if zooming-by-doubleclicking should be allowed or not.
        Parameters:
        enabled - true if zooming-by-doubleclicking should be allowed, false otherwise
      • isDoubleClickZoomEnabled

        public boolean isDoubleClickZoomEnabled()
        Is the function zooming-by-doubleclick enabled? Disabled by default.
        Returns:
        true if enabled, false if disabled
      • setScrollWheelZoomEnabled

        public void setScrollWheelZoomEnabled​(boolean enabled)
        Sets if zooming-by-mousewheel should be allowed or not.
        Parameters:
        enabled - true if zooming-by-mousewheel should be allowed, false otherwise
      • isScrollWheelZoomEnabled

        public boolean isScrollWheelZoomEnabled()
        Is the function zooming-by-mousewheel enabled? Disabled by default.
        Returns:
        true if enabled, false if disabled
      • isStreetViewControlEnabled

        public boolean isStreetViewControlEnabled()
        Is the StreetView control enabled? Disabled by default.
        Returns:
        true if enabled, false if disabled
      • setStreetViewControlEnabled

        public void setStreetViewControlEnabled​(boolean enabled)
        Sets if the StreetView control should be visible or not.
        Parameters:
        enabled - true if StreetView should be allowed, false otherwise
      • isZoomControlEnabled

        public boolean isZoomControlEnabled()
        Is the zoom control enabled? Enabled by default.
        Returns:
        true if enabled, false if disabled
      • setZoomControlEnabled

        public void setZoomControlEnabled​(boolean enabled)
        Sets if the zoom control should be visible or not.
        Parameters:
        enabled - true if the zoom-control should be enabled, false otherwise
      • isMapTypeControlEnabled

        public boolean isMapTypeControlEnabled()
        Is the map type control enabled? Enabled by default.
        Returns:
        true if enabled, false if disabled
      • setMapTypeControlEnabled

        public void setMapTypeControlEnabled​(boolean enabled)
        Sets if the map type control should be visible or not.
        Parameters:
        enabled - true if you want the user to have the possibility to change the map type, false otherwise
      • isScaleControlEnabled

        public boolean isScaleControlEnabled()
        Is the scale control enabled? Disabled by default.
        Returns:
        true if enabled, false if disabled
      • setScaleControlEnabled

        public void setScaleControlEnabled​(boolean enabled)
        Sets if the scale control should be visible or not.
        Parameters:
        enabled - true if the scale-control should be enabled, false otherwise
      • isPanControlEnabled

        public boolean isPanControlEnabled()
        Is the pan control enabled? Enabled by default.
        Returns:
        true if enabled, false if disabled
      • setPanControlEnabled

        public void setPanControlEnabled​(boolean enabled)
        Sets if the pan control should be visible or not.
        Parameters:
        enabled - true if the pan-control should be enabled, false otherwise
      • getMapType

        public GMapType getMapType()
        Returns:
        the current map type.
        See Also:
        GMapType
      • setMapType

        public void setMapType​(GMapType mapType)
        Sets the map type which should be used.
        Parameters:
        mapType - the map type
        See Also:
        GMapType
      • getZoom

        public int getZoom()
        Returns:
        the current zoom level
      • getMinZoom

        public int getMinZoom()
        Returns:
        the minZoom level
      • getMaxZoom

        public int getMaxZoom()
        Returns:
        the maxZoom level
      • setZoom

        public void setZoom​(int level)
        Sets a new zoom level.
        Parameters:
        level - the new zoom level
      • setMinZoom

        public void setMinZoom​(int level)
        Sets a new minZoom limit.
        Parameters:
        level - the new minZoom level
      • setMaxZoom

        public void setMaxZoom​(int level)
        Sets a new maxZoom limit.
        Parameters:
        level - the new maxZoom level
      • getCenter

        public GLatLng getCenter()
        Returns:
        the current center point
      • setCenter

        public void setCenter​(GLatLng center)
        Set the center.
        Parameters:
        center - center to set
      • panTo

        public void panTo​(GLatLng center)
        Changes the center point of the map to the given point. If the point is already visible in the current map view, change the center in a smooth animation.
        Parameters:
        center - the new center of the map
      • setMarkerCluster

        public void setMarkerCluster​(GMarkerCluster markerCluster)
      • isMarkerClusterEnabled

        public boolean isMarkerClusterEnabled()
      • getJSinit

        public String getJSinit()
        Generates the JavaScript used to instantiate this GMap3 as an JavaScript class on the client side.
        Returns:
        The generated JavaScript
      • getJSinvoke

        public String getJSinvoke​(String invocation)
        Convenience method for generating a JavaScript call on this GMap with the given invocation.
        Parameters:
        invocation - The JavaScript call to invoke on this GMap.
        Returns:
        The generated JavaScript.
      • getJsReference

        public String getJsReference()
        Build a reference in JS-Scope.
      • fitMarkers

        public void fitMarkers​(List<GLatLng> markersToShow,
                               boolean showMarkersForPoints,
                               double zoomAdjustment)

        Makes the map zoom out and centre around all the GLatLng points in markersToShow.

        Big ups to Doug Leeper for the code.

        Parameters:
        markersToShow - the points to centre around.
        showMarkersForPoints - if true, will also add basic markers to the map for each point focused on. Just a simple convenience method - you will probably want to turn this off so that you can show more information with each marker when clicked etc.
        See Also:
        Doug's Nabble post
      • update

        public void update()
        Update state from a request to an AJAX target. You need to call this method explictly if you want to have up-to-date values.
      • setOverlays

        public void setOverlays​(List<GOverlay> overlays)
      • isFailSilently

        public boolean isFailSilently()
      • setFailSilently

        public void setFailSilently​(boolean failSilently)