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
- Inherited From:
Properties:
Name Type Description lat -
lng :Number
-
The maps current longitude
Type:
- Number
- Inherited From:
Properties:
Name Type Description lng -
<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
- Inherited From:
Properties:
Name Type Description zoom
Methods
-
_triggerListeners()
-
Handles the logic of triggering listeners
- Inherited From:
-
addCircle(circle)
-
Adds the specified circle to this map
Parameters:
Name Type Description circleWPGMZA.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 typestring The event type, or multiple types separated by spaces callbackfunction The callback to call when the event fires thisObjectobject <optional>
The object to use as "this" when firing the callback useCapturebool <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 markerWPGMZA.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 polygonWPGMZA.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 polylineWPGMZA.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 eventstring | 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 markersArray.<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 idint 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 idint 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 idint 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 idint 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 typestring 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 xnumber Number of pixels to nudge along the x axis ynumber 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 TheWPGMZA.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 TheWPGMZA.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 latlngWPGMZA.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 circleWPGMZA.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 idint 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 typestring The event type to remove listeners from listenerfunction <optional>
The function to remove. If omitted, all listeners will be removed thisObjectobject <optional>
Use the parameter to remove listeners bound with the same thisObject useCapturebool <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 markerWPGMZA.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 idint 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 polygonWPGMZA.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 idint The ID of the polygon to remove - Inherited From:
-
removePolyline(polyline)
-
Removes the specified polyline from this map
Parameters:
Name Type Description polylineWPGMZA.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 idint 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 latLngobject | 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 widthnumber Width as a CSS string heightnumber 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