Reference Source
public class | source

MapModel

Extends:

* → MapModel

Class for the Map model which controls the map view and the markers.

Constructor Summary

Public Constructor
public

Creates an instance of the MapModel

Member Summary

Public Members
public

get: Object: *

Returns the data from the model.

public

Returns the user's current location.

public

showMaps(destination: Object): *

Opens the prompt to get the user to pick a third-party app to get directions from.

public

update: *

Updates the map model data by inserting the data as markers

Private Members
private

_data: *[]

private

_insertDataOnRead(newData: Object): *

Inserts an object with a list of objects into the map model as new data.

Method Summary

Public Methods
public

createMarker(markerElement: Object): Object

Creates a marker from provided data.

Public Constructors

public constructor() source

Creates an instance of the MapModel

Public Members

public get: Object: * source

Returns the data from the model.

Return:

Object

The data stored in the model. Has property 'data' which is a list of objects

public getCurrentLocation: Object: * source

Returns the user's current location.

Return:

Object

The current user's location, with longitude and latitude

public showMaps(destination: Object): * source

Opens the prompt to get the user to pick a third-party app to get directions from. Default source location is the user's current location.

public update: * source

Updates the map model data by inserting the data as markers

Private Members

private _data: *[] source

private _insertDataOnRead(newData: Object): * source

Inserts an object with a list of objects into the map model as new data.

Public Methods

public createMarker(markerElement: Object): Object source

Creates a marker from provided data.

Params:

NameTypeAttributeDescription
markerElement Object

An object element

Return:

Object

A formed marker