class
SAPO.Component.MapController
SAPO.Utility.XML
requires SAPO.Component.ZoomController
requires SAPO.Component.PanController
requires either SAPO.Communication.Ajax
requires or SAPO.Communication.Syndication
requires Defined in
Component/MapController/0.1/lib.js
Constructor Summary
init
(Object
options)
Initialization function.
Function Summary
doJSONRequest
(
url,
onSuccess,
onError)
Does a http request to the given url, to return a javascript object.
The response must be JSON.
Mixes the options template object and the options given to this class when initializing
Constructor Details
constructor init
init(Object
options)
Initialization function.
Parameters:
options
- Options for this instance -
Node container
Place in the document where map will be rendered. Will fill 100%/100%. -
Boolean prefillLabels
If true, the map renders the districts and municipalities names in the labels -
Boolean hideOnlyDistrictLabel
if true, only the focused's district label is hidden when zooming in, while the others are shown. If they're shown, then there can be overlap with nearby districts, so you might want to use false instead to disable overlapping.
-
String mapUrlSVG
Url to SVG map. Need to deploy locally. -
String mapUrlVML
Url to VML map. Need to deploy locally. -
Number zoomInMargin
Optional margin in map coordinates used when zoooming, to keep between zoomed in region and viewport edges. -
Number zoomInDuration
Time it takes to do the zoom in animation, in milliseconds. -
Number zoomInAnimateSpeed
Usead for easing: 0 = instant, lt 1 ease out, 1 = linear gt 1 ease in, 'circle' - special ease out with more curved progression of values, instead of a square root.
-
Number maxZoom
Max zooom level. 1 - default, x - x times bigger. -
String restorePosition
Controls which is the default focused district when the map loads. If the configuration has one of the following substrings, in order, the description applies: - last - the last position which was focused before the map being destroyed - location - fetch user's location and use that one
-
Function onLoad
listener for load event -
Function onZoom
listener for zoom event -
Function onDistrictToggle
listener when district is toggled -
Function onMunicipalityToggle
listener when municipality is toggled -
Object styles
object with properties which represent styles to apply to the map. These styles are overriden by the ones passed to fillLabel. The valid property names are: - fontFamily - name of font to use, e.g.: 'sans-serif' - baseFontSize - default font size, e.g.: '12pt' - strokeWidth - district and municipality stroke width in map coordinates , e.g.: 1 - districtStroke - district stroke color, e.g.: '#fff' - districtFill - district fill color, e.g.: '#fff' - districtStrokeHover - district stroke color on hover, e.g.: '#fff' - districtFillHover - district fill color on hover, e.g.: '#fff' - municipalityStroke - municipality stroke color, e.g.: '#fff' - municipalityFill - municipality fill color, e.g.: '#fff' - municipalityStrokeHover - municipality stroke color on hover, e.g.: '#fff' - municipalityFillHover - municipality fill color on hover, e.g.: '#fff' - labelBackgroundColor - background color of labels, e.g.: 'rgba(200,200,200,0.5)'
Function Details
function doJSONRequest
doJSONRequest(
url,
onSuccess,
onError)
Does a http request to the given url, to return a javascript object.
The response must be JSON.
Parameters:
url
onSuccess
Success callback, accepts two arguments: url and json object
onError
Error callback, accepts one argument: url function mixOptions
mixOptions(Object
template, Object
given)
Mixes the options template object and the options given to this class when initializing
Parameters:
template
options template
given
options for this instance