Javascript API

1.2

Javascript reference

Experimental

BaseView class


Abstract woosmap.BaseView

Constructor
BaseView()

Constructs a new BaseView


Methods
fitBounds(bounds:google.maps.LatLngBounds, padding?:BoundsPadding)

Sets the viewport to contain the given bounds. Takes in account the padding values to displace the viewport.

enableZoom(activate:Boolean)

Enable or Disable zoom when select a store

enablePan(activate:Boolean)

Enable or Disable pan when select a store

stores_changed()

This is the function called when the stores property has changed.

selectedStore_changed()

This function is called when selectedStore property is changed

getDataBounds()

Return Value: google.maps.LatLngBounds|Null

Process each feature in the dataLayer to compute the bounds of the displayed data.

getMap()

Return Value: google.maps.Map

Returns the google maps used by the BaseView.

removeAllStores()

Removes all the stores from the map.

displayStore(store:Store)

Adds a single store to the map, zoom + pan on it

location_changed()

This function is called when location property is changed


Properties
stores Type: Array.<Store>

List of stores displayed. This property is bindable.

selectedStore Type: Store

The currently selected store. This property is bindable.

location Type: Location

The user defined location. This property is bindable.

padding Type: BoundsPadding

Controls the viewport padding used by fitBounds.

marker Type: google.maps.Marker

This marker is positioned on the map when location property changes. If this marker is set draggable (marker.setDraggable(true)) the location property will be changed when dropping the marker (ie. when the marker fires the dragend event).


DataCollector class


woosmap.DataCollector

Constructor
DataCollector()

Constructs a new DataCollector


Methods
collect(params:Object)

Save data into the WGS’s DataStore BDD.

sendDirectionsMail(receiver_mail:String, store:Object, params:Object, success_callback:Function, error_callback:Function)

Sends a request to the datastore to send a mail with directions link to the mail provided


DataLayer class


woosmap.layers.DataLayer
This class extends woosmap.layers.BaseLayer.

Constructor
DataLayer(options?:DataLayerOptions)

DataLayer


Methods
displayStores(stores:Array.<Store>)

Displays on the map the stores passed as parameter.

displayNumberedStores(stores:Array.<Store>)

Displays the stores with numbered icons.


DataSearchSource class


woosmap.DataSearchSource

Constructor
DataSearchSource(dataSource:woosmap.DataSource, searchTextOptions:woosmap.TextSearchQuery, nearbyOptions:Object, polylineFilter?:PolylineFilter)

Constructs a new DataSearchSource


Methods
autocomplete_query_changed()

Listens the changes of query.

location_changed()

Listens the changes of location.

updateSearchQuery(key:String, value:woosmap.search.SearchQuery)

Updated the searchQuery value.

updateSearchQueryAndSearch(key:String, value:woosmap.search.SearchQuery)

Updated the searchQuery value and launch a search with the new value.

addFieldToSearchTextOptions(fieldName:String, operator:String)

Add a new field to searchTextOptions or update an existing field (new field will be used for store filtering).

removeFieldFromSearchTextOptions(fieldName:String)

Remove a field from searchTextOptions (so field will not be use anymore for filtering).

Update stores list after removal.

updateTextSearchQuery()

Deprecated

Get the value of ‘autocomplete_query’ and searchTextOptions and update the SearchQuery with them. Then request new store list.

updateTextSearchQueryAndSearch()

Get the value of ‘autocomplete_query’ and searchTextOptions and update the SearchQuery with them. Then request new store list.

search(querySearchParameters?:woosmap.search.SearchQuery)

Use the woosmap API to search into store’s data with nearbyOptions, polylineFilter, searchQuery and location as parameters.

setPolylineFilter(polylineFilter:PolylineFilter)

Add or update the polylineFilter for the searchSource.

To remove the filter set is value to null.

setMaxStores(maxStores:Integer)

Update the maxStores value.

To remove the search option set is value to null.

setMaxDistanceFromUser(maxDistanceFromUser:Integer)

Update the maxDistanceFromUser value.

To remove the search option set is value to null.


Properties
searchParameters Type: woosmap.search.SearchParameters

Contains options to searchStores

autocomplete_query Type: String

Observes his query to launch the search into store’s data.

location Type: Location

Observes his location to narrow the search around a location. Needs to be completed with a maxStore and a maxDistanceFromUser in constructors option nearbyOptions


DataSource class


woosmap.DataSource

Constructor
DataSource(api_url?:String, api_key?:String)

The DataSource object is the bridge to the server API.


Methods
getFromApi(url,:String, callback,:Function)

Make an ajax call with the url and call the callback if success

getAllStores(callback:Function)

Return Value: $.Deferred

Returns all the stores.

getNearbyStores(lat:Number, lng:Number, callback:Function, maxStores:Number, maxDistanceFromUser:Number)

Return Value: $.Deferred

Fetches stores that are near the (lng, lat) position and pass it to the callback. if lat and lng are not defined, we use the IP geolocation to pinpoint the user.

getStoresBySearchQuery(query:String, callback:Function)

Return Value: $.Deferred

Deprecated

Fetches stores that name matches the search query and pass it to the callback.

searchStores(searchQuery:woosmap.search.SearchQuery, callback:Function)

Return Value: $.Deferred

Deprecated

Fetches stores that matches the search query and pass it to the callback.

searchNearbyStores(searchQuery:woosmap.search.SearchQuery, lat:Number, lng:Number, callback:Function, maxStores:Number, maxDistanceFromUser:Number)

Return Value: $.Deferred

Deprecated

Fetches nearby stores that matches the search query and pass it to the callback.

searchStoresByParameters(searchParameters:woosmap.search.SearchParameters, callback:Function)

Return Value: $.Deferred

Search on store given a list of information

getProjectConfig(callback:Function)

Return Value: $.Deferred

Get the config object for the Project.


DataStyler class


woosmap.style.DataStyler

Constructor
DataStyler(styler:Styler)

Applies style to google.maps.Data.


Methods
style(data:google.maps.Data)

Styles the data layer using Styles rules given at construction.

styleNumbered(data:google.maps.Data, stores)

Override the style to use numbered icons for the stores array parameter.

selectStore(data:google.maps.Data, selectedStore)

Overrides the current style with selectedStyle for the selectedStore

clear(data:google.maps.Data)

Clear the style of the data layer.


DefaultRenderer class


woosmap.layers.renderers.DefaultRenderer

Constructor
DefaultRenderer()

Default renderer.


Methods
setClick(clickCb:Function)

Build the click listener with the callback argument

getMap()

Return Value: google.maps.Map

Getter to access to the map instance

setMap(map:google.maps.Map)

Set the map instance

displayStores(stores:GeoJSON)

Call to display the stores with the basic style

displayNumberedStores(stores:GeoJSON)

Call to display the stores with the numbered style

tileDidLoad(data:GeoJSON)

Call on each tiles request.

tilesDidLoad()

Called once all tiles request are finished.

selectStore(selectedStore:Store)

Use the selected style for the selectedStore

clear()

Removes all the data and style from the layer.


DelegateProtocol class


Abstract woosmap.utils.DelegateProtocol
This class extends woosmap.utils.MVCObject.

Constructor
DelegateProtocol()

Constructs a new DelegateProtocol


Methods
callDelegateMethod(methodName:String)

Return Value: woosmap.utils.DelegateReturn

Calls the method methodName on the delegate.


Properties
delegate Type: Object

The delegate object.


DelegateReturn class


woosmap.utils.DelegateReturn
This class extends woosmap.utils.MVCObject.

Constructor
DelegateReturn()

Builds a delegate return value.


Methods
or(defaultValue)

Return Value: *

Returns defaultValue when the delegate was not called. Else return the delegate return value.


DeviceDetector class


woosmap.DeviceDetector

Constructor
DeviceDetector()

Constructs a new DeviceDetector (base on mobile-detect library)


Methods
getDeviceType()

Return Value: String

Return type of the user device


DirectionsProvider class


woosmap.location.DirectionsProvider

Constructor
DirectionsProvider(directionRendererOptions?:Directionsrendereroptions, googleDirectionsRequestOptions?:Directionsrequests, directionsRequestErrorCallback?:Function)

Constructs a new DirectionsProvider


Methods
getDirectionsFromOrToStore()

Get directions from, or to, store with google directions services and set results in directionsRenderers

setDirectionsObjectsWithResponse()

Set directionsRenderers and directionsSummary objects

getDirectionsLink()

Get the direct link to google directions from the user’s input

getRouteEncodedPolyline(rendererIndex)

Return Value: String

Return an encodedPolyline of a simplify version of a route


Properties
directionsSummaries Type: Array.<RouteInformation>

This property is observable An array containing information about each route

directionsRenderers Type: Array.<google.maps.DirectionsRenderers>

This property is observable An array containing renderer about each route

directionsLink Type: String

This property is observable A link to open google map with the current itinerary

selectedTravelMode Type: String

This property is observable

originDestination Type: Location

This property is observable


DirectionsResultsDisplayer class


woosmap.ui.DirectionsResultsDisplayer
This class extends woosmap.utils.MVCObject.

Constructor
DirectionsResultsDisplayer(map:google.maps.Map, summaryTemplate:String, displayNewRenderersCallback:Function, selectedAndUnselectedRendererOptions:SelectedAndUnselectedRendererOptions)

You must bind directionsLink property to directionsProvider


Methods
displayRouteSteps(rendererIndex:Int)

Display route’s steps on panel

cleanRoutes()

Clean all routes on panel

cleanRouteSteps()

Clean all route’s step on panel

cleanMapFromRoutes()

Hide all route’s Polyline on map

displayAllRoutes()

Display all the route on the map

displayRouteOnMap(rendererIndex:Int)

Display a selected route polyline on map

setSelectedRenderer(rendererIndex:Integer)

Set renderer options to selectedRendererOptions and set others renderers options to unselectedRenderersOptions


DistanceProvider class


woosmap.location.DistanceProvider

Constructor
DistanceProvider(options?:Object)

Constructs a new DistanceProvider. It should be bound to a location property or it needs to be set manually.


Methods
updateStoresDistanceWithGoogle(stores:Array.<Store>, user_callback:Function, orderby:String)

This method updates or adds the following properties of each stores in the array :

  • duration: the duration in seconds.
  • distance: the distance in meters.
  • duration_text: a String representation of the duration.
  • distance_text: A string representation of the distance value, using the unitSystem specified in the constructor options.

Properties
location Type: Location

The location to compute a distance from. This property is bindable.


GeocoderOptions class


woosmap.location.GeocoderOptions

Properties
maxResultsReturn? Type: Integer

Maximum number of geocoding results return by the geocoder. If google find more result then only the N first results will be returned.

bounds?

The bounding box of the viewport GeocodingRequest parameters.

key?

Your application’s API key GeocodingRequest parameters.

language?

The language in which to return results GeocodingRequest parameters.

region?

The region code, specified as a ccTLD (“top-level domain”) two-character value GeocodingRequest parameters.


GeocoderSearchSource class


woosmap.location.GeocoderSearchSource

Constructor
GeocoderSearchSource(geocoderOptions?:Geocoderoptions)

Constructs a new GecoderSearchSource


Methods
query_changed()

Listens the changes of query.

search(query)

Use the google maps geocoder to geocode the query.


Properties
location Type: Location

When google answer a geocoding requests with only one result, it sets this property. If maxResultsReturn is set to one then google’s answer always set this property. This property is bindable

locationResults Type: Array

When google answer a geocoding requests with more than one result, it sets this property. This property is bindable

query Type: String

Observes his query to launch the geocoding.


InfoBox class


woosmap.ui.InfoBox

Constructor
InfoBox(opt_opts?:woosmap.ui.InfoBoxOptions)

Creates an InfoBox with the options specified in {@link InfoBoxOptions}.


Methods
onRemove()

Invoked when close is called. Do not call it directly.

draw()

Draws the InfoBox based on the current map projection and zoom level.

setInfoBoxOptions(opt_opts:Infoboxoptions)

Sets the options for the InfoBox. Note that changes to the maxWidth, closeBoxMargin, closeBoxURL, and enableEventPropagation properties have no affect until the current InfoBox is closed and a new one is opened.

setContent(content:String|Node)

Sets the content of the InfoBox. The content can be plain text or an HTML DOM node.

setPosition(latlng:Latlng)

Sets the geographic location of the InfoBox.

setZIndex(index:Number)

Sets the zIndex style for the InfoBox.

setVisible(isVisible:Boolean)

Sets the visibility of the InfoBox.

getContent()

Return Value: String

Returns the content of the InfoBox.

getPosition()

Return Value: Latlng

Returns the geographic location of the InfoBox.

getZIndex()

Return Value: Number

Returns the zIndex for the InfoBox.

getVisible()

Return Value: Boolean

Returns a flag indicating whether the InfoBox is visible.

show()

Shows the InfoBox. [Deprecated; use setVisible instead.]

hide()

Hides the InfoBox. [Deprecated; use setVisible instead.]

open(map:Map|Streetviewpanorama, anchor?:Mvcobject)

Adds the InfoBox to the specified map or Street View panorama. If anchor (usually a google.maps.Marker) is specified, the position of the InfoBox is set to the position of the anchor. If the anchor is dragged to a new location, the InfoBox moves as well.

close()

Removes the InfoBox from the map.


InfoBoxOptions class


woosmap.ui.InfoBoxOptions

Properties
content Type: String|Node

The content of the InfoBox (plain text or an HTML DOM node).

disableAutoPan? Type: Boolean

Disable auto-pan on open.

maxWidth Type: Number

The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.

pixelOffset Type: Size

The offset (in pixels) from the top left corner of the InfoBox (or the bottom left corner if the alignBottom property is true) to the map pixel corresponding to position.

position Type: Latlng

The geographic location at which to display the InfoBox.

zIndex Type: Number

The CSS z-index style value for the InfoBox. Note: This value overrides a zIndex setting specified in the boxStyle property.

boxClass? Type: String

The name of the CSS class defining the styles for the InfoBox container.

boxStyle? Type: Object

An object literal whose properties define specific CSS style values to be applied to the InfoBox. Style values defined here override those that may be defined in the boxClass style sheet. If this property is changed after the InfoBox has been created, all previously set styles (except those defined in the style sheet) are removed from the InfoBox before the new style values are applied.

closeBoxMargin Type: String

The CSS margin style value for the close box. The default is “2px” (a 2-pixel margin on all sides).

closeBoxURL Type: String

The URL of the image representing the close box. Note: The default is the URL for Google’s standard close box. Set this property to “” if no close box is required.

infoBoxClearance Type: Size

Minimum offset (in pixels) from the InfoBox to the map edge after an auto-pan.

isHidden? Type: Boolean

Hide the InfoBox on open. [Deprecated in favor of the visible property.]

visible? Type: Boolean

Show the InfoBox on open.

alignBottom Type: Boolean

Align the bottom left corner of the InfoBox to the position location (default is false which means that the top left corner of the InfoBox is aligned).

pane Type: String

The pane where the InfoBox is to appear (default is “floatPane”). Set the pane to “mapPane” if the InfoBox is being used as a map label. Valid pane names are the property names for the google.maps.MapPanes object.

enableEventPropagation Type: Boolean

Propagate mousedown, mousemove, mouseover, mouseout, mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox (default is false to mimic the behavior of a google.maps.InfoWindow). Set this property to true if the InfoBox is being used as a map label.


Loader class


Loader

Constructor
Loader()

Constructs a new WoosmapLoader instance.


Methods
load(loadOptions:LoadOptions)

Load method with one parameter and no version aliases.


LocationProvider class


woosmap.location.LocationProvider

Constructor
LocationProvider()

Constructs a new LocationProvider, in order to track browser location


Methods
askForLocation(geoLocationProvider)

Set user location given provider.


Properties
location Type: Location

When the LocationProvider returns a result it sets this property. This property is bindable


LocatorWindow class


woosmap.LocatorWindow

Constructor
LocatorWindow(map:google.map.Map, renderer:woosmap.TemplateRenderer, infoBoxOptions?:woosmap.ui.InfoBoxOptions)

Construct a LocatorWindow.


Methods
selectedStore_changed()

When selectedStore changes open the InfoWindow on the current store. if selectedStore is null then close the InfoWindow.

getAnchorForCoordinates(coordinates)

Return Value: google.maps.MVCObject

Computes the Window anchor for coordinates

getMarkerForCoordinates(coordinates)

Return Value: google.maps.Marker

Return a marker for coordinates

openOn(store)

Opens the info window on the store.

close()

Closes the Locatorwindow

setOpeningCallback(openingCallback?:Function)

Adds a listener for domready event of infowindow. This method clears previously added domready listeners.

setInfoBoxOptions(options?:woosmap.ui.InfoBoxOptions)

Method to set InfoboxOptions if it’s not a google InfoWindow


Properties
selectedStore Type: Object

The currently selectedStore. This property is bindable


MVCObject class


woosmap.utils.MVCObject

Constructor
MVCObject()

Constructor for MVCObject.


Methods
bindTo(key:String, target:Object, target_key?:String, notify?:Boolean)

Return Value: Void

Binds the property identified by ‘key’ to the specified target.

isPropertyBound(key:String)

Return Value: Boolean

Is this property a complex object - is it bound as either observer or target

get(key:String)

Return Value: Mixed

Returns the value of the property specified by ‘key’

set(key:String, value:Mixed, force_callback?:Boolean)

Return Value: Void

Sets ‘value’ to ‘key’ on ‘this’.

setValues(key_value_pairs:Object)

Return Value: Void

Set all the values of the properties contained in ‘key_value_pairs’

unbind(key:String)

Return Value: Void

Un-bind the property identified by ‘key’ from it’s current target

unbindAll()

Return Value: Void

Unbind all bound properties on this object


MailView class


woosmap.ui.MailView
This class extends woosmap.utils.MVCObject, woosmap.utils.DelegateProtocol.

Constructor
MailView(template:String, custom_params:Object)

Constructs a new MailView, in order to ask our API endpoint to send a mail for directions


Methods
sendDirectionsMail(receiver_mail:String)

Sends a request to the datastore to send a mail with directions link to the mail provided

getContainer()

Return Value: *


Properties
mailStatus Type: Mailstatus

When the MailView returns a result it sets this property. This property is bindable

selectedStore Type: String

When the MailView sends an email with directions, it needs to have the currently selected store set in in order to send the proper directions. This property is bindable

delegate Type: Object

The delegate object.

status Type: Object

Contains all the available status for the MailView. Status states Sent, Sending, Initialized, and Error`


MapsLoader class


woosmap.MapsLoader

Constructor
MapsLoader(clientIdOrOptions?:MapsLoaderOptions, librariesToLoad?:Array)

Construct a MapsLoader instance with the googleloader


Methods
load(callback:Function)

Loads the google maps api and calls the callback when done.


MarkersRenderer class


woosmap.layers.renderers.MarkersRenderer
This class extends woosmap.layers.renderers.DefaultRenderer.

Constructor
MarkersRenderer()

Markers renderer.


Methods
getMap()

Return Value: Undefined|google.maps.Map

Return the map instance

getDisplayingMarkers()

Return Value: Array.<google.maps.Marker>

Return the markers object for the current bounds

getDisplayingFeatures()

Return Value: Array

Return the features objects for the current bounds

displayMarkers(features, markers:google.maps.Marker)

Display the markers of each features

displayCurrentMarkers()

Display the markers in the current bounds

displayMarkersForStores(stores:GeoJSON)

Display the marker for a stores list

displayStores(stores)

Display the stores list

displayNumberedStores(stores)

Display the stores list with a numbered style


NearbyStoresSource class


woosmap.location.NearbyStoresSource

Constructor
NearbyStoresSource(dataSource, maxStores, maxDistanceFromUser)

Builds a NearbyStoresSource


Methods
location_changed()

This method is called when the location has changed.


Properties
stores Type: Array

An array of stores. This property is bindable.

location Type: Location

The location to search stores from. This property is bindable.


OriginDestinationInput class


woosmap.ui.OriginDestinationInput
This class extends woosmap.utils.MVCObject.

Constructor
OriginDestinationInput(originDestinationPanelTemplate:String, odInputOptions?:OdInputOptions)

Take the template for an Origin Destination Panel and link with an originDestination object


Methods
isSelectedStoreName(name:String)

Return true if the selectedStore has a name equal to the name in parameters

updateOriginDestination()

Set the originDestination object {origin: **, destination: **} with value containing in woosmap-origin and woosmap-destination input If one name is the same that selectedStore’s name then store position is set instead of the name

setOriginValue(newOriginValue:String)

Set the value of woosmap-origin input

setDestinationValue(newDestinationValue:String)

Set the value of woosmap-destination input

getOriginValue(useLatLng?:Boolean)

Get the value of woosmap-origin input return selectedStore position is value is the same tha store name

getDestinationValue(useLatLng:Boolean)

Get the value of woosmap-destination input return selectedStore position is value is the same tha store name

onKeyUp()

Method called when keyUp on origin or destination input

selectedStore_changed()

Method called when selectedStore changed

location_changed()

Method called when location changed

getODContainer()

Return the container instantiated with origin-destination panel


Properties
originDestination Type: OriginDestination
storeIsDestination Type: Boolean

Flag to decide where to put the store name.

selectedStore Type: Store

The selected store. This property is bindable.

location Type: Location

The location to use to compute the directions.


PlacesSearchSource class


woosmap.location.PlacesSearchSource
This class extends woosmap.utils.MVCObject.

Constructor
PlacesSearchSource(options:Object, minQuerySize:Int)

Constructs a new PlacesSearchSource


Methods
autocomplete_query_changed()

Listens the changes of autocomplete_query.

search(autocomplete_query:String)

Use the google Places AutoCompleteService to fetch predictions

getDetails(reference:String, callback:Function)

Get the precise location of Place result


Properties
autocomplete_query Type: String

Observes his autocomplete_query to launch the autocomplete.

predictions Type: Array

When Places returns a prediction list it sets this property. This property is observable

options Type: Object

Observes this property to launch configure autocomplete. should comply to google’s specifications See : AutocompletionRequest

minQuerySize Type: Number

If autocomplete query change but with a length smaller than minQuerySize then no request to google map is done.


PolylineFilter class


PolylineFilter

Properties
encodedPolyline Type: String

a polyline encoded to the google format See : polylineutility

radius? Type: Integer

max distance to retrieve store from the polyline (in meter). Default value is 10000


QuerySearchOptions class


woosmap.QuerySearchOptions

Properties
query? Type: woosmap.TextSearchQuery

search string and its options.

tags? Type: Array.<String>

a list of tags object

types? Type: Array.<String>

a list of types object


SearchParameters class


woosmap.search.SearchParameters

Constructor
SearchParameters(searchParametersOptions:SearchParametersOptions)

Constructs a new SearchParameters


Methods
buildUrl()

Return Value: String

Build encoded parameters of an url to search stores (&max_number=3).


Properties
lat Type: Float

Latitude of the position to search nearest stores

lng Type: Float

Longitude of the position to search nearest stores.

maxStores Type: Integer

Maximum number of stores to return.

maxDistanceFromUser Type: Integer

Maximum distance from user (in meter).

searchQuery Type: woosmap.search.SearchQuery

Query to filter on store’s properties (text, types and tags).

polylineFilter Type: PolylineFilter

PolylineFilter to filter on polyline path


SearchParametersOptions class


SearchParametersOptions

Properties
lat? Type: Float

latitude of the position to search nearest stores.

lng? Type: Float

longitude of the position to search nearest stores.

maxDistanceFromUser? Type: Integer

maximum distance from user (in meter).

maxStores? Type: Integer

maximum number of stores to return.

searchTextOptions? Type: woosmap.QuerySearchOptions

options to filter on store’s text properties.

polylineFilter? Type: PolylineFilter

to filter on polyline path.


SearchQuery class


woosmap.search.SearchQuery

Constructor
SearchQuery(querySearchOptions:woosmap.QuerySearchOptions)

Constructs a new SearchQuery


Methods
addTagFilter(tagName, operator)

Adds a tag filter to the query.

addTypeFilter(typeName, operator)

Adds a type filter to the query.

setQuery(queryText, options?)

Sets the query text

addQueryOption(name, operator)

Adds a query option

removeQueryOption(name)

Removes a QueryOption by name.


Properties
query Type: woosmap.TextSearchQuery

Property for text search

tags Type: Array.<String>

Property for tag search

types Type: Array.<String>

Property for type search

AND Type: String

AND query operator

OR Type: String

OR query operator


SearchView class


woosmap.ui.SearchView
This class extends woosmap.utils.MVCObject, woosmap.utils.DelegateProtocol.

Constructor
SearchView(searchViewOptions?:Searchviewoptions)

Constructs a SearchView


Methods
setupInteraction()

Setups the interactions with the input, button, and clear button

setSearchQueryWithInputValue()

Sets the query property with the value of the input.

clearResults()

Method called when searchView need to clear it’s results.

clearInput()

Method called when searchView need to clear it’s input.

getContainer()

Return Value: *

locationResults_changed()

Method called when locationResults changed.

When changed is trigger searchView will display location results into resultSelector container.

getResultsSelector()

Return Value: *

Return resultsSelector container.


Properties
delegate Type: Object

The delegate object.


Styler class


woosmap.style.Styler

Constructor
Styler(options:DataStyle)

Styler duty is to style google maps Data Layer


Methods
getDefaultStyle()

Return Value: StyleRule

Returns the default style.

getMarkerStyleForStore(store:google.maps.Data.Feature|Store, options:MarkerStyleOptions)

Return Value: google.maps.Icon

Resolves style for the store feature using options.


TableView class


woosmap.ui.TableView
This class extends woosmap.utils.MVCObject.

TableView container

<div class="woosmap-tableview-container"></div>

TableView Store Cell template example

<div>{{name}}</div>
<a class="title">{{name}}</a><br/>
<small class="quiet">{{address.city}}</small>
<div>{{address.lines}} {{address.city}} {{address.zip}}</div>
<div>Tel : <a href="tel:{{phone}}">{{phone}}</a></div>

TableView Places Cell template example

<div>{{description}}</div>

If a card is selected it’s container will bear woosmap-tableview-selected-cell class. If a card is highlighted using arrow keys, it’s container will bear woosmap-tableview-highlighted-cell class.

Deprecated CSS classes

The class card_container is deprecated in favor of woosmap-tableview-container. The class selected-card is deprecated in favor of woosmap-tableview-selected-cell.

deprecated name new name
selected-card woosmap-tableview-selected-cell
card_container woosmap-tableview-container

Constructor
TableView(templates:Object)

Constructs a new TableView


Methods
setupInteraction()

Setups the interactions with the keyboard

selectedStore_changed()

When the selectedStore changes select the right cell in the table view. If the table view cell is not visible then scroll the list to render it visible.

scrollToCell($cell:Jquery)

Scrolls the table view to show the $cell

stores_changed()

When the stores list changes update the table view accordingly.

predictions_changed()

When the predictions list changes update the table view accordingly.

getContainer()

Return Value: *

Returns the container of the TableView.

update()

Displays the stores by rendering a cell for each store.

setStoresTemplate(storesTemplate:String)

Set new template for stores cells.

setPlacesTemplate(placesTemplate:String)

Set new template for places cells.

setOnCellCreatedCallback(callback:Function)

Set a function to be called by the tableView after the rendering of the cells.


Properties
stores Type: Array

An array of stores. This property is bindable.

predictions Type: Array

An array of Places predictions. This property is bindable.

selectedStore Type: Object

When user click on a Store cell, it sets this property This property is observable

location Type: Object

When user click on a Places cell, it sets this property This property is observable


TemplateRenderer class


woosmap.TemplateRenderer

Constructor
TemplateRenderer(template:String)

Constructs a TemplateRendererInstance


Methods
render(properties?:Object)

Return Value: *

Renders the compiled template with the context

registerLambda(name, lambda)

Registers a template Lambda


TextSearchQuery class


woosmap.TextSearchQuery

Properties
value? Type: String

the text to be searched.

options? Type: Object

keys are the attributes of the store where the search will be performed, attached value are operator that will be used. Attributes can be name, city, and store_id. Operators can be SearchQuery.AND, and SearchQuery.OR


TiledDataOverlay class


woosmap.layers.TiledDataOverlay
This class extends woosmap.layers.BaseLayer.

Constructor
TiledDataOverlay()

TiledDataOverlay.


Methods
clear()

Clears the overlay data and cache.

setMap(map:google.maps.Map)

Set the map instance

setSearchQuery(searchQuery:woosmap.search.SearchQuery)

Sets the searchQuery used to filter the displayed data.

setPolylineFilter(polylineFilter:PolylineFilter)

Sets the polylineFilter used to filter the displayed data.

onAdd()
onRemove()
tileDidLoad(data)

Abstract

Called when a tile has finished loading

tilesDidLoad()

Abstract

Called when all the tiles requested from the api server were fetched.


TiledImageLayer class


woosmap.layers.TiledImageLayer

Constructor
TiledImageLayer(options?:TiledImageLayerOptions)

Constructs a new TiledImageLayer


Methods
setMap(map:google.maps.Map)

Set an overlay to a map with the tiles generated by the tiler server

getMap()

Return Value: google.maps.Map|Null

Returns the google map bound to the image layer.

setSearchQuery(searchQuery:woosmap.search.SearchQuery)

Sets the searchQuery used to filter the displayed data.

setPolylineFilter(polylineFilter:PolylineFilter)

Sets the polylineFilter used to filter the displayed data.


TiledView class


woosmap.TiledView
This class extends woosmap.BaseView.

Constructor
TiledView(map:google.maps.Map, options:TiledViewOptions)

TiledView this view is mostly compatible with {woosmap.View}.


Methods
setSearchQuery(searchQuery:woosmap.search.SearchQuery)

Sets the searchQuery used to filter both image and vector layer.

setPolylineFilter(polylineFilter:PolylineFilter)

Sets the polylineFilter used to filter both image and vector layer.


Properties
stores Type: Array.<Store>

List of stores displayed. This property is bindable.

selectedStore Type: Store

The currently selected store. This property is bindable.

location Type: Location

The user defined location. This property is bindable.

padding Type: BoundsPadding

Controls the viewport padding used by fitBounds.

marker Type: google.maps.Marker

This marker is positioned on the map when location property changes. If this marker is set draggable (marker.setDraggable(true)) the location property will be changed when dropping the marker (ie. when the marker fires the dragend event).


TravelModeSelector class


woosmap.ui.TravelModeSelector
This class extends woosmap.utils.MVCObject.

Constructor
TravelModeSelector(travelModeSelectionPanelTemplate:String)

Take the template of travelModePanel to generate an object


Methods
initializedTravelModeChoice()

Initialized comportement of travel mode panel’s objects

getSelectorContainer()

Return the container instantiated with travel mode panel


View class


woosmap.View
This class extends woosmap.BaseView.

Constructor
View(map:google.maps.Map, markers:String|Array.<StyleRule>, zoomLevel:Number)

Constructs a View


Methods

Properties
stores Type: Array.<Store>

List of stores displayed. This property is bindable.

selectedStore Type: Store

The currently selected store. This property is bindable.

location Type: Location

The user defined location. This property is bindable.

padding Type: BoundsPadding

Controls the viewport padding used by fitBounds.

marker Type: google.maps.Marker

This marker is positioned on the map when location property changes. If this marker is set draggable (marker.setDraggable(true)) the location property will be changed when dropping the marker (ie. when the marker fires the dragend event).


ZipCodeProvider class


woosmap.ZipCodeProvider

Constructor
ZipCodeProvider()

Constructs a new ZipCodeProvider


Methods
getZipCode()

Return Value: String

Get the currently saved zipcode

getZipCodeType()

Return Value: String

Get the zipcode type

location_changed()

This method is called when the location has changed. It updates the zipcode by reverse geocoding


Properties
zipcode Type: String

Stores the zipcode associated the the location. This property is bindable.

location Type: Location

The location used by the reverse geocoding to derive the zipcode. This property is bindable.


Address object Specification


Properties
lines Type: Array.<String>

the address lines.

city Type: String
zipCode Type: String

BaseViewOptions object Specification


Properties
style? Type: Style
zoomLevel? Type: Number

BoundsPadding object Specification


Properties
top Type: Number
bottom Type: Number
right Type: Number
left Type: Number

Contact object Specification


Properties
website Type: String

the location website.

phone Type: String

the location phone.

email Type: String

the location email contact.


DataLayerOptions object Specification


Properties
styler Type: woosmap.style.Styler
click Type: clickCallback

DataStyle object Specification


Properties
markers? Type: Markerstyle

deprecated marker style format see [BaseView]{@link woosmap.BaseView}

style? Type: Style

GeoJSON object Specification


Properties
features Type: Array.<Store>

Geometry object Specification


Properties
coordinates Type: Array.<Number>

WGS84 longitude, latitude.


LoadOptions object Specification


Properties
loadJQuery Type: Boolean
version Type: String
publicKey Type: String
callback Type: Function
scope Type: Object

Location object Specification


Properties
lat Type: Number

the latitude.

lng Type: Number

the longitude.


MapsLoaderOptions object Specification


MapsLoaderOptions example

{
   clientId: 'a_client_id',
   librariesToLoad: ['places'],
   channelId: 'a_channel_id',
   language: 'fr'
}
Properties
clientId? Type: String

the google client id.

librariesToLoad? Type: Array

a list of String containing additional google libraries to load.

channelId? Type: String

is a string to track usage across different applications using the same client ID

language Type: String

desired for google maps api


MarkerStyleOptions object Specification


Properties
selected?
number?

OdInputOptions object Specification


Properties
geolocText? Type: String

Text to display in input field after geolocation


OriginDestination object Specification


Properties
origin Type: String
destination Type: String

RouteInformation object Specification


Properties
rendererIndex Type: Number

integer corresponding to the route index on the directionsRenderers property.

travelMode Type: String

the travelMode for the route.

summary Type: String

the travelMode for the route.

distance Type: String

distance of the route.

durationLong Type: String

duration of the route.

durationShort Type: String

duration of the route (abbreviation).

durationInTrafficLong? Type: String

duration of the route with traffic.

durationInTrafficShort? Type: String

duration of the route with traffic (abbreviation).


SearchViewOptions object Specification


Template sample

<div>
     <input class="woosmap-search-input"/>
     <span class="woosmap-search-clear"></span>
     <span class="woosmap-my-location-button">My location</span>
     <button class="woosmap-search-button">Search</button>
<div>

CSS classes purpose

  • woosmap-search-input The input used to fill the search query
  • woosmap-search-clear The element used to clear the search input
  • woosmap-search-button The element used to trigger the search on click.
  • woosmap-my-location-button The element used to trigger geolocation based search

Additionaly the search is triggered when the search input is validated (ie: Enter key is pressed).

Location template sample

<div>
     {{formattedAddress}}
</div>
Properties
template? Type: String

Search input template.

resultsTemplate? Type: String

location results template.

geolocText? Type: String

text to display on input field after a geolocation


SelectedAndUnselectedRendererOptions object Specification


Properties
unselectedRenderersOptions Type: google.maps.DirectionsRendererOptions

options for unselected renderers.

selectedRendererOptions Type: google.maps.DirectionsRendererOptions

options for selected renderer.


Store object Specification


Properties
storeId Type: String

the unique Id for this store.

name Type: String

the store name.

geometry Type: Geometry

The geometry associated to this store

types? Type: Array.<String>

the store types.

tags? Type: Array.<String>

the store tags.

user_properties? Type: Object

user definied properties

address? Type: Address

the Store address

contact? Type: Contact

the contact information.


Style object Specification


Style Example

{
    rules: [
        {
            type: 'value1',
            icon: {url: 'http://url/img/marker1.png'},
            selectedIcon: {url: 'http://url/img/marker1-selected.png'}
        },
        {
            type: 'value2',
            icon: {url: 'http://url/img/marker2.png'},
            selectedIcon: {url: 'http://url/img/marker2-selected.png'}
        }
    ],
    default: {
        icon: {url: 'http://url/img/marker.png'},
        numberedIcon: {url: 'http://url/img/{number}.png'},
        selectedIcon: {url: 'http://url/img/selected.png'}
    }
}
Properties
default Type: StyleRule

the default styling rules, applies when no typed rule matched.

rules Type: Array.<StyleRule>

the typed rules, each rule bears a store type, the last one matching prevails.


StyleRule object Specification


Properties
icon Type: google.maps.Icon
selectedIcon Type: google.maps.Icon
numberedIcon Type: google.maps.Icon
type? Type: String

a store type that controls the rule application.


TileStyle object Specification


Properties
color? Type: String

a color rgba formatted

size? Type: Integer

the size of the marker in pixels, between 1 and 16.

minSize? Type: Integer

the minimum size acceptable for the marker.

updatedAt Type: Integer

the timestamp at which the data was updated.

typeRules? Type: Array.<TypesRules>

rules to display different color depending of types. Two different rules cannot be applied to the same store. In case of conflict the latest type in the array win. If a store has no rule, the default type is apply.


TiledImageLayerOptions object Specification


Properties
map? Type: google.maps.Map

the map where the layer will be displayed.

style? Type: TileStyle

object that contains style parameters for the current layer.

maxZoom? Type: Integer

the layer will be visible between 0 and maxZoom.


TiledOverlayOptions object Specification


Properties
style Type: Style
onClick Type: Function

TiledViewOptions object Specification


Properties
style? Type: Style

the style for the tiled vector layer.

breakPoint? Type: Number

the zoom level to change the representation.

tileStyle? Type: TileStyle

the style for the tiled image layer.

searchQuery? Type: woosmap.search.SearchQuery

a searchQuery to filter stores.

polylineFilter? Type: PolylineFilter

a polylineFilter to filter stores.

interactionRenderer? Type: woosmap.layers.renderers.DefaultRenderer

the renderer used to display search results.

tiledDataRenderer? Type: woosmap.layers.renderers.DefaultRenderer

the renderer used to display vector tiles.


TypesRules object Specification


Properties
type Type: String

of a store

color Type: String

a color rgba formatted


clickCallback object Specification


function(store:Store)