Class: ProMap

ProMap

WPGMZA.ProMap

new ProMap(element [, options])

Base class for maps. Please do not call this constructor directly. Always use createInstance rather than instantiating this class directly. Using createInstance allows this class to be externally extensible.
Parameters:
Name Type Argument Description
element HTMLElement to contain map
options object <optional>
Options to apply to this map

Extends

Members


directionsEnabled :Boolean

Whether directions are enabled or not
Type:
  • Boolean

lat :Number

The maps current latitude
Type:
  • Number
Properties:
Name Type Description
lat
Inherited From:

lng :Number

The maps current longitude
Type:
  • Number
Properties:
Name Type Description
lng
Inherited From:

<readonly> markersPlaced :Boolean

Whether or not the markers have been placed yet
Type:
  • Boolean

mashupIDs :Array

The mashup map ID's, or an empty array if there are none selected
Type:
  • Array

zoom :Number

The maps current zoom level
Type:
  • Number
Properties:
Name Type Description
zoom
Inherited From:

Methods


_triggerListeners()

Handles the logic of triggering listeners
Inherited From:

addCircle(circle)

Adds the specified circle to this map
Parameters:
Name Type Description
circle WPGMZA.Circle The circle to add
Inherited From:
Fires:
  • event:polygonadded
Throws:
Argument must be an instance of WPGMZA.Circle

addEventListener(type, callback [, thisObject] [, useCapture])

Adds an event listener on this object
Parameters:
Name Type Argument Description
type string The event type, or multiple types separated by spaces
callback function The callback to call when the event fires
thisObject object <optional>
The object to use as "this" when firing the callback
useCapture bool <optional>
If true, fires the callback on the capture phase, as opposed to bubble phase
Inherited From:

addHeatmap()

Adds the specified heatmap to the map
Returns:
void

addMarker(marker)

Adds the specified marker to this map
Parameters:
Name Type Description
marker WPGMZA.Marker The marker to add
Inherited From:
Fires:
  • event:markeradded
  • WPGMZA.Marker#event:added
Throws:
Argument must be an instance of WPGMZA.Marker

addPolygon(polygon)

Adds the specified polygon to this map
Parameters:
Name Type Description
polygon WPGMZA.Polygon The polygon to add
Inherited From:
Fires:
  • event:polygonadded
Throws:
Argument must be an instance of WPGMZA.Polygon

addPolyline(polyline)

Adds the specified polyline to this map
Parameters:
Name Type Description
polyline WPGMZA.Polyline The polyline to add
Inherited From:
Fires:
  • event:polylineadded
Throws:
Argument must be an instance of WPGMZA.Polyline

dispatchEvent(event)

Fires an event on this object
Parameters:
Name Type Description
event string | WPGMZA.Event Either the event type as a string, or an instance of WPGMZA.Event
Inherited From:

<protected> fetchMarkers()

Fetches the markers, either by REST API or XML file depending on the selected setting.

fitBoundsToMarkers( [markers])

Fits the map boundaries to any unfiltered (visible) markers in the specified array, or all markers on the map if no markers are specified.
Parameters:
Name Type Argument Description
markers Array.<WPGMZA.Marker> <optional>
Markers to fit the map boundaries to. If no markers are specified, all markers are used.

getCircleByID(id)

Gets a circle by ID
Parameters:
Name Type Description
id int The ID of the circle to get
Inherited From:
Returns:
The circle, or null if no circle with the specified ID is found
Type
WPGMZA.Circle | null

getHeatmapByID()

Gets a heatmap by ID
Returns:
void

getInfoWindowStyle()

Get's the selected infowindow style for this map, or the global style if "inherit" is selected.
Returns:
The InfoWindow style, see WPGMZA.ProInfoWindow for possible values
Type
mixed

<protected> getMapObjectArrays()

Get's arrays of all features for each of the feature types on the map
Deprecated:
  • Will be removed in Pro 8.1.0

getMarkerByID(id)

Gets a marker by ID
Parameters:
Name Type Description
id int The ID of the marker to get
Inherited From:
Returns:
The marker, or null if no marker with the specified ID is found
Type
WPGMZA.Marker | null

getPolygonByID(id)

Gets a polygon by ID
Parameters:
Name Type Description
id int The ID of the polygon to get
Inherited From:
Returns:
The polygon, or null if no polygon with the specified ID is found
Type
WPGMZA.Polygon | null

getPolylineByID(id)

Gets a polyline by ID
Parameters:
Name Type Description
id int The ID of the polyline to get
Inherited From:
Returns:
The polyline, or null if no polyline with the specified ID is found
Type
WPGMZA.Polyline | null

hasEventListener(type)

Test for listeners of type on this object
Parameters:
Name Type Description
type string The event type to test for
Inherited From:
Returns:
True if this object has listeners bound for the specified type
Type
bool

hasVisibleMarkers()

Find out if the map has visible markers. Only counts filterable markers (not the user location marker, store locator center point marker, etc.)
Returns:
True if at least one marker is visible
Type
Boolean

<protected> initCustomFieldFilterController()

Initialises the custom field filter controller

<protected> initDirectionsBox()

Initialises the directions box on the front end, if the setting is enabled

<protected> initMarkerListing()

Initialises the marker listing

<protected> initPreloader()

Initialises the preloader

<protected> initUserLocationMarker()

Initialises the user location marker, if the setting is enabled

loadSettings()

Loads the maps settings and sets some defaults
Inherited From:

nudge(x, y)

Nudges the map viewport by the given pixel coordinates
Parameters:
Name Type Description
x number Number of pixels to nudge along the x axis
y number Number of pixels to nudge along the y axis
Inherited From:
Throws:
Invalid coordinates supplied

off()

Alias for removeEventListener
Inherited From:
See:

on()

Alias for addEventListener
Inherited From:
See:

onBoundsChanged()

Called when the map viewport bounds change. Fires the legacy bounds_changed event.
Inherited From:
Fires:
  • event:boundschanged
  • event:bounds_changed

onElementResized()

Called when the engine map div is resized
Inherited From:

onFilteringComplete()

Callback for when the marker filter has completed
Listens to Events:
  • module:WPGMZA.Map~event:onFilteringComplete

onIdle()

Called when the map viewport becomes idle (eg movement done, tiles loaded)
Inherited From:
Fires:
  • event:idle

onInit(The)

Called by the engine specific map classes when the map has fully initialised
Parameters:
Name Type Description
The WPGMZA.Event event
Listens to Events:
  • module:WPGMZA.Map~event:init

<protected> onMarkersFetched()

Called once fetchMarkers has finished fetching all the markers. This function will populate the map with the fetched data, then fire events.
Fires:
  • module:WPGMZA.ProMap~event:markersplaced
  • module:WPGMZA.ProMap~event:filteringcomplete

onMarkersPlaced(The)

Called when all the markers have been loaded and placed
Parameters:
Name Type Description
The WPGMZA.Event event
Listens to Events:
  • module:WPGMZA.ProMap~event:markersplaced

onWindowResize()

Called when the window resizes
Inherited From:

panToNearestMarker( [latlng])

Pans to the nearest marker to the specified latlng, or the center of the map if no latlng is specified
Parameters:
Name Type Argument Description
latlng WPGMZA.LatLng <optional>
Pan to the nearest marker to this latlng, optional. The center is used if no value is specified.

removeCircle(circle)

Removes the specified circle from this map
Parameters:
Name Type Description
circle WPGMZA.Circle The circle to remove
Inherited From:
Fires:
  • event:circleremoved
Throws:
  • Argument must be an instance of WPGMZA.Circle
  • Wrong map error

removeCircleByID(id)

Removes a circle by ID
Parameters:
Name Type Description
id int The ID of the circle to remove
Inherited From:

removeEventListener(type [, listener] [, thisObject] [, useCapture])

Removes event listeners from this object
Parameters:
Name Type Argument Description
type string The event type to remove listeners from
listener function <optional>
The function to remove. If omitted, all listeners will be removed
thisObject object <optional>
Use the parameter to remove listeners bound with the same thisObject
useCapture bool <optional>
Remove the capture phase event listener. Otherwise, the bubble phase event listener will be removed.
Inherited From:

removeHeatmap()

Removes the specified heatmap and fires an event
Returns:
void

removeHeatmapByID()

Removes the specified heatmap and fires an event
Returns:
void

removeMarker(marker)

Removes the specified marker from this map
Parameters:
Name Type Description
marker WPGMZA.Marker The marker to remove
Inherited From:
Fires:
  • event:markerremoved
  • WPGMZA.Marker#event:removed
Throws:
  • Argument must be an instance of WPGMZA.Marker
  • Wrong map error

removeMarkerByID(id)

Removes a marker by ID
Parameters:
Name Type Description
id int The ID of the marker to remove
Inherited From:
Fires:
  • event:markerremoved
  • WPGMZA.Marker#event:removed

removePolygon(polygon)

Removes the specified polygon from this map
Parameters:
Name Type Description
polygon WPGMZA.Polygon The polygon to remove
Inherited From:
Fires:
  • event:polygonremoved
Throws:
  • Argument must be an instance of WPGMZA.Polygon
  • Wrong map error

removePolygonByID(id)

Removes a polygon by ID
Parameters:
Name Type Description
id int The ID of the polygon to remove
Inherited From:

removePolyline(polyline)

Removes the specified polyline from this map
Parameters:
Name Type Description
polyline WPGMZA.Polyline The polyline to remove
Inherited From:
Fires:
  • event:polylineremoved
Throws:
  • Argument must be an instance of WPGMZA.Polyline
  • Wrong map error

removePolylineByID(id)

Removes a polyline by ID
Parameters:
Name Type Description
id int The ID of the polyline to remove
Inherited From:

resetBounds()

Resets the map latitude, longitude and zoom to their starting values in the map settings.

setCenter(latLng)

Centers the map on the supplied latitude and longitude
Parameters:
Name Type Description
latLng object | WPGMZA.LatLng A LatLng literal or an instance of WPGMZA.LatLng
Inherited From:

setDimensions(width, height)

Sets the dimensions of the map engine element
Parameters:
Name Type Description
width number Width as a CSS string
height number Height as a CSS string
Inherited From:

setOptions()

Sets options in bulk on map
Inherited From:

showPreloader()

Shows or hides the maps preloader

trigger()

Alias for removeEventListener
Inherited From:
See:

<protected> updateInfoWindowDistances()

Called internally to update the infowindow distances, for example, when the users location has changed or a new search has been performed