Class: ModernStoreLocatorCircle

ModernStoreLocatorCircle

WPGMZA.ModernStoreLocatorCircle

new ModernStoreLocatorCircle(map_id [, settings])

This is the base class the modern store locator circle. 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
map_id int The ID of the map this circle belongs to
settings object <optional>
Settings to pass into this circle, such as strokeColor

Methods


<static> createInstance()

Returns the contructor to be used by createInstance, depending on the selected maps engine.
Returns:
The appropriate contructor
Type
function

draw()

Draws the circle to the canvas

getCanvasDimensions()

Abstract function to get the canvas dimensions
Throws:
Abstract function called

getCenter()

Returns the center of the circle
Returns:
A latLng literal
Type
object

getContext(type)

Abstract function to set the canvas context
Parameters:
Name Type Description
type string The context type
Throws:
Abstract function called

getPosition()

Gets the center of the circle
Returns:
The center as a LatLng literal
Type
object

getRadius()

Gets the circle radius, in kilometers
Returns:
The circles radius, in kilometers
Type
number

getResolutionScale()

Gets the resolution scale for drawing on the circles canvas.
Returns:
The device pixel ratio, or 1 where that is not present.
Type
number

getTransformedRadius(km)

Abstract function to get the transformed circle radius (see subclasses)
Parameters:
Name Type Description
km number The input radius, in kilometers
Throws:
Abstract function called

getVisible()

Gets the visibility of the circle
Returns:
Whether or not the circle is visible
Type
bool

initCanvasLayer()

Abstract function to initialize the canvas layer

onResize()

Handles the map viewport being resized

onUpdate()

Updates and redraws the circle

setCenter(A)

Sets the center of the circle
Parameters:
Name Type Description
A WPGMZA.LatLng | object LatLng literal or instance of WPGMZA.LatLng

setOptions(options)

Sets options on the circle (for example, strokeColor)
Parameters:
Name Type Description
options object An object of options to iterate over and set on this circle.

setPosition()

Alias for setCenter

setRadius(radius)

Sets the circles radius, in kilometers
Parameters:
Name Type Description
radius number The radius, in kilometers
Throws:
Invalid radius

setVisible(visible)

Sets the visibility of the circle
Parameters:
Name Type Description
visible bool Whether the circle should be visible

validateSettings()

Validates the circle settings and corrects them where they are invalid