class SAPO.Component.WeatherMapController
requires SAPO.Component.MapController requires SAPO.Utility.JSPath
 Our all mighty weather map controller.
 Everything just works with some minor initializations.
  - specify 'container' for where the map will be placed. The controller will
    inject an iframe
  - place http://js.sapo.pt/SAPO/Component/MapController/map-pt.svg and
    http://js.sapo.pt/SAPO/Component/MapController/map-pt.vml.html in your
    domain and setup urls for them in mapUrlSVG and mapUrlVML options.

 Event listeners:
  onLoad
   - when map finishes loading and is ready for user interaction
  onZoom
   - dispatched when map changes zoom, both mouswheel and when
     clicking districts.
   - detail equals new width to old width ratio.
   - no default action
  onDistrictToggle
   - dispatched when district is clicked
   - default action: toggle and zoom on district
  onMunicipalityToggle
   - dispatched when municipality is clicked
   - id is element id
   - no default action
 
Defined in Component/WeatherMapController/0.1/lib.js

Constructor Summary
init (Object options)
Initialization function.

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:
                                               - iconUrl - url for weather icon. Sub token {WEATHER_CODE} will be replaced with weather code.
                                               - 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)'
  • Object gradient
    object with properties which control the color gradient that is applied to the map representing temperatures. All colors are hex values.
                                               - enable - if true, the gradient is used, else it's not, and default colors apply.
                                               - minTemp - minimum temperature which will be represented using the color minTempColor
                                               - minTempColor - color for minTemp. Temperatures below this will be adjusted to this value, e.g.: #0000ff
                                               - maxTemp - maximum temperature which will be represented using the color maxTempColor
                                               - maxTempColor - color for maxTemp. Temperatures below this will be adjusted to this value, e.g.: #ff0000
                                               - hoverColor - color when district or municipality is hovered, while having a gradient, e.g.: #ffff00
                                               - hoverColorBlend - percentage used to mix hoverColor with  the district color. Use 0 to ignore, 1 to use full hoverColor.
  • Function onRequestError listener when network request to weather service fails