KUMobile

API Docs for: 0.0.2

KUMobile.Map

Module: KUMobile

Contains all map related functions for loading and controlling the map page.

addPOIs

(
  • category
)

Add POI's of a certain category to the map if it is a match with the user's input through the search bar.

Parameters:

Name Type Description
category KUMobile.Map.POICategory
  • the category data containing the POIs to be searched through and added upon match

Example:

// Add matching POIs
KUMobile.Map.addPOIs(categoryData);

clearMarkers

()

Removes all markers from the map and then clears them from the array.

Example:

KUMobile.Map.clearMarkers();

filterMap

()

Filters the map POI's to only add markers that the user searched for!

Example:

// Filter!
KUMobile.Map.filterMap();

initializeMap

()

Initialize the leaflet map with category data, list and basic settings.

Example:

// Initialize leaflet map
KUMobile.Map.initializeMap();

readPOIData

()

Reads POI's from local file system. Note that if this fails, we will attempt to download the failed category!

Example:

// Update POIs
KUMobile.Map.readPOIData();

showPOIDetails

(
  • poi
)

Shows the footer with POI detail information at the bottom of the map.

Parameters:

Name Type Description
poi Object
  • the point of interest as returned through foursquare venue search API

Example:

// Show POI details
KUMobile.Map.showPOIDetails(poi)

updatePOIData

()

Updates POI data for every category in the category list.

Example:

// Update POIs
KUMobile.Map.updatePOIData();

BB_NELAT

float

Northeast latitude for map's bounding box. Essentially most northeast latitude for POI's we are concerned with to show the user.

Default: 43.05107777204538

BB_NELNG

float

Northeast longitude for map's bounding box. Essentially most northeast longitude for POI's we are concerned with to show the user.

Default: -83.64904403686523

BB_SWLAT

float

Southwest latitude for map's bounding box. Essentially most southwest latitude for POI's we are concerned with to show the user.

Default: 42.97513915795521

BB_SWLNG

float

Southwest longitude for map's bounding box. Essentially most southwest longitude for POI's we are concerned with to show the user.

Default: -83.77864837646484

CATEGORIES_LIST

Array

List of POI categories (order that they will be downloaded in) containing the corresponding foursquare ID's.

categoryData

Array

Stores the data for each POI category.

debug

boolean private

Enables debug messages via alert messages. Do NOT enable this unless there are legitimate problems with plugins (not available to debug via browser).

downloadIndex

int private

The index related to categories for which we are currently downloading or importing from a cached session.

footerVisible

boolean

Is the footer showing? The footer contains the POI details and starts off hidden. It is only shown when the user clicks on the POI or searches.

Default: false

INCR_WAIT_TIME

int

Wait time for incremental searching. This distinguishes how long to wait after the user has searched something, before we assume they are done typing.

Default: 850

lastValue

string

Represents the last value the user has searched for from the free text field search bar located on the map page.

Default: ""

loading

boolean

Tells whether or not map is currently attempting to download or parse article lists. Essentially used to tell whether map is considered to be busy.

Default: false

map

Object

The leaflet map object

Default: null

MAP_FILE_TEMPLATE

string

File template for local storage of foursquare map data for each category. E.g for saving food it would be MAPDATAFood filename.

Default: "MAP_DATA_"

markers

Array

All current POI markers that are currently added to the map.

MIN_UPDATE_MS

int

This is the minimum time that needs to have passed in order to allow for another foursquare update to both the map and local filesystem.

Default: 172800000

selectedMarker

Object

Contains the selected marker. This is useful to store so we can easily disable the markers selection.

Default: null

SERIALIZE_ID

int

The 'version' of how we save map data to local filesystem. Whenever the structure of this changes, we must change the serialized ID. When we notice the ID change a new download will be triggered!

Default: 3

START_CENTER

Array

Starting center of the map as a coordinate array.

Default: [43.013070, -83.713853]

userLocation

Object

The latest user location (if any).

Default: null

directSearch

Triggered when the user does a direct change. The direct change includes typing then changing focus or pressing the clear button. This is redundant to the incremental search event, except for the clear button!!

incrementalSearch

Triggered when the user does a key up event in order to simulate incremental searching for the attached search bar.

locationfound

User's location was found! Add it to the map as a blue circle including an accuracy circle.

mapClick

User has clicked the map. We can use this as a way to exit the footer! Then also deselect the marker

markerClick

Triggered when the user clicks on a POI marker.

markerClick

Deselects the currently selected marker from the map. Basically it only switches the icon back to the 'non-selected' icon.

pageCreate

Triggered when the map page is first created based on jQuery Mobile pagecreate event. This is called after the page itself is created but before any jQuery Mobile styling is applied.

pageInit

Triggered when the map page is first initialized based on jQuery Mobile pageinit event.

readPOI_Fail

Triggered after a failed read of POI file.

readPOI_Success

Triggered after a successful read of POI file.