Class: GMaps

GMaps

GMaps


new GMaps(options)

Creates a new GMaps instance, including a Google Maps map.

Parameters:
Name Type Description
options object

options accepts all the MapOptions and events listed in the Google Maps API. Also accepts:

  • lat (number): Latitude of the map's center
  • lng (number): Longitude of the map's center
  • el (string or HTMLElement): container where the map will be rendered
  • markerClusterer (function): A function to create a marker cluster. You can use MarkerClusterer or MarkerClustererPlus.

Members


controls :array

Collection of custom controls in the map UI

Type:
  • array

el :HTMLElement

Container element

Type:
  • HTMLElement

layers :array

Collection of KML/GeoRSS and FusionTable layers

Type:
  • array

map :google.maps.Map

Google Maps map instance

Type:
  • google.maps.Map

markerClusterer :object

Marker Clusterer instance

Type:
  • object

markers :array

Collection of map's markers

Type:
  • array

overlays :array

Collection of map's overlays

Type:
  • array

polygons :array

Collection of map's polygons

Type:
  • array

polylines :array

Collection of map's lines

Type:
  • array

routes :array

Collection of map's routes requested by GMaps#getRoutes, GMaps#renderRoute, GMaps#drawRoute, GMaps#travelRoute or GMaps#drawSteppedRoute

Type:
  • array

singleLayers :object

Collection of data layers (See GMaps#addLayer)

Type:
  • object

zoom :number

Current map's zoom

Type:
  • number

Methods


addControl(options)

Add a custom control to the map UI.

Parameters:
Name Type Description
options object

The options object should contain:

  • style (object): The keys and values of this object should be valid CSS properties and values.
  • id (string): The HTML id for the custom control.
  • classes (string): A string containing all the HTML classes for the custom control.
  • content (string or HTML element): The content of the custom control.
  • position (string): Any valid google.maps.ControlPosition value, in lower or upper case.
  • events (object): The keys of this object should be valid DOM events. The values should be functions.
  • disableDefaultStyles (boolean): If false, removes the default styles for the controls like font (family and size), and box shadow.
Returns:
Type
HTMLElement

fitLatLngBounds(latLngs)

Adjust the map zoom to include all the coordinates in the latLngs array.

Parameters:
Name Type Description
latLngs array

Collection of google.maps.LatLng objects.


fitZoom()

Adjust the map zoom to include all the markers added in the map.


getElement()

Return the HTML element container of the map.

Returns:

the element container.

Type
HTMLElement

hideContextMenu()

Hide the current context menu


refresh()

Trigger a resize event, useful if you need to repaint the current map (for changes in the viewport or display / hide actions).


removeControl(control)

Remove a control from the map. control should be a control returned by addControl().

Parameters:
Name Type Description
control HTMLElement

One of the controls returned by addControl().

Returns:

the removed control.

Type
HTMLElement

setCenter(lat, lng [, callback])

Center the map using the lat and lng coordinates.

Parameters:
Name Type Argument Description
lat number

Latitude of the coordinate.

lng number

Longitude of the coordinate.

callback function <optional>

Callback that will be executed after the map is centered.


setContextMenu(options)

Add a context menu for a map or a marker.

Parameters:
Name Type Description
options object

The options object should contain:

  • control (string): Kind of control the context menu will be attached. Can be "map" or "marker".
  • options (array): A collection of context menu items:
    • title (string): Item's title shown in the context menu.
    • name (string): Item's identifier.
    • action (function): Function triggered after selecting the context menu item.

zoomIn( [magnitude])

Increase the map's zoom.

Parameters:
Name Type Argument Description
magnitude number <optional>

The number of times the map will be zoomed in.


zoomOut( [magnitude])

Decrease the map's zoom.

Parameters:
Name Type Argument Description
magnitude number <optional>

The number of times the map will be zoomed out.

Documentation generated by JSDoc 3.4.3 on 19.06.2017 using the DocStrap template.