wrld.js

WrldMarkerController

The WrldMarkerController is an optional component for creating and manipulating styled markers.

Dependencies

  • JQuery
  • wrld.css
  • marker_controller.js

For a full example of how to use the WrldMarkerController, see this example.

Constructor

var markerController = new WrldMarkerController(map, options);
Argument Type Description
map L.Wrld.map The eegeo.js map object to associate the Marker Controller with
options object An object containing optional parameters, described below

Options

Options Type Default Description
searchbar WrldSearchbar   An instance of an WrldSearchbar from which to automatically generate markers. Each search result will generate a marker with an appropriate icon and title, which will be cleared when the search is cleared.

Methods

markerController.addMarker(id, latLng, options)

Creates a marker on the map with the given properties.

Argument Type Description
id number A unique id to associate with the new marker
latLng L.LatLng The location to place the marker at
options object An object containing optional parameters, described below

Options

Options Type Default Description
elevation number 0 The elevation of the marker from the ground in meters
isIndoor bool * Whether the marker is indoors. Defaults to whatever the current state is
indoorId string * The id of the indoor map this marker is within, if any. Defaults to the current indoor map, if any
floorIndex number * The index of the floor this marker is on, if any. Defaults to the current floor, if any
iconKey string   A string that describes the icon that will be used for the marker. See a list of valid iconKeys below. Leave unspecified if you want to set your own icons

markerController.removeMarker(marker)

Remove the given marker.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to remove

markerController.removeAllMarkers()

Remove all markers.

markerController.hideMarker(marker)

Hide the given marker, without removing it permanently.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to hide

markerController.showMarker(marker)

Show a currently hidden marker.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to show

markerController.selectMarker(marker)

Select the given marker, changing its display.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to select

markerController.deselectMarker()

Deselect the currently selected marker.

markerController.moveMarker(marker, location)

Move a marker to a new location.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to move
latLng L.LatLng The LatLng to move the marker to

markerController.updateMarker(marker, options)

Update the options of the marker with the given id.

Argument Type Description
marker L.Wrld.marker | number The marker, or marker id, to update
options object The new set of options. The same values as addMarker can be passed

markerController.getAllMarkerIds()

Returns an array of all marker ids.

markerController.getMarker(id)

Returns the marker associated with the given id.

Argument Type Description
id number The id of the marker to be returned

IconKey values

These values can be passed as the iconKey option to addMarker to create a marker with any of the following icons:

iconKey Icon
“misc”
“aroundme”
“accommodation”
“airport”
“amenities”
“art_museums”
“atm”
“bank”
“bed_breakfast”
“beer”
“burgers”
“bus”
“business”
“camping”
“casino”
“charge_point”
“childcare”
“christianity”
“cinema”
“cocktail”
“coffee”
“cycling”
“defibrillator”
“dentist”
“department”
“disabled_access”
“donuts”
“education”
“elevator”
“emergency_exit”
“entertainment”
“escalator”
“facebook”
“farm”
“ferry”
“fire”
“fire_extinguisher”
“first_aid”
“fishing”
“florist”
“food_drink”
“football”
“golf”
“google_plus”
“groceries”
“health”
“historic_monument”
“hospital”
“hostel”
“hotel”
“islam”
“judaism”
“lamppost”
“library”
“lifeguard”
“limo”
“link”
“lodge”
“meter”
“meeting_room”
“music”
“office”
“park”
“parking”
“payphone”
“person”
“petrol_station”
“pharmacy”
“picasa”
“pizza”
“place_of_worship”
“playing_field”
“police”
“post_office”
“printer”
“race_track”
“reception”
“sailing”
“shooting”
“shopping”
“skiing”
“spa”
“sports_field”
“sports_leisure”
“stairs”
“stationery”
“subway”
“taxi”
“toilets”
“tourism”
“town_hall”
“train”
“trash_empty”
“trash_full”
“tram”
“transport”
“twitter”
“education”
“vet”
“vimeo”
“wikipedia”
“wine”
“working_group”
“youtube”
“zoo”
v0.1.1290