Ero sivun ”Widget:Ol3VesiensuojeluyhdistysMap” versioiden välillä
Järvi-meriwikistä
(Ak: Uusi sivu: <includeonly> <link rel="stylesheet" href="/scripts/ol3/ol.css" type="text/css"> <script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js"></script> <scri...) |
|||
Rivi 21: | Rivi 21: | ||
var <!--{$id|default:CommonObsMap|escape:'html'}-->_memo = { 'SitesO': {}, 'TypesO': {}, 'obsTypeToShow': '' }; | var <!--{$id|default:CommonObsMap|escape:'html'}-->_memo = { 'SitesO': {}, 'TypesO': {}, 'obsTypeToShow': '' }; | ||
− | function <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() { | + | function <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() { |
− | + | if ( typeof window.jQuery == 'undefined' ) { | |
− | + | setTimeout( function(){ <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() }, 300); | |
− | + | } else { | |
− | + | <!--{$id|default:CommonObsMap|escape:'html'}-->_func(); | |
− | + | } | |
− | } | + | } |
− | setTimeout( function(){ <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() }, 300); | + | |
+ | setTimeout( function(){ <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() }, 300); | ||
+ | |||
+ | function <!--{$id|default:CommonObsMap|escape:'html'}-->_func() { | ||
+ | |||
+ | //widget globals | ||
+ | var memo = <!--{$id|default:CommonObsMap|escape:'html'}-->_memo; | ||
+ | memo.g = { 'sizeFactor': 1.5, 'lang': '<!--{$lang|default:fi|escape:'html'}-->' }; | ||
− | + | var lon = parseFloat('<!--{$lon|default:25|escape:'html'}-->'); | |
− | + | var lat = parseFloat('<!--{$lat|default:65|escape:'html'}-->'); | |
− | + | var zoom = parseInt('<!--{$zoom|default:4|escape:'html'}-->'); | |
− | + | var lakes = '<!--{$lakes|escape:'html'}-->'; | |
− | + | var lakeArr = lakes.split('¤!')[0].split('¤'); | |
+ | var drainages = '<!--{$drainages|escape:'html'}-->'; | ||
+ | var drainageArr = drainages.split('¤!')[0].split('¤'); | ||
− | + | var base = '<!--{$base|default:mmlTausta|escape:'html'}-->'; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | var layersArr = []; | |
− | + | ||
− | + | if ( drainageArr.length > 0 ) { | |
− | + | searchArr = []; | |
− | + | for ( var d in drainageArr ) { | |
− | + | searchArr.push("Jako3Tunnus='" + d + "'"); | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | layersArr.push( { | |
− | + | 'type': 'drainage', | |
− | + | 'name': 'Vesistöalue', | |
− | + | 'search': searchArr.join( ' OR ' ), | |
+ | 'opacitySlider': true, | ||
+ | 'showLabels': false, | ||
+ | 'selectable': false, | ||
+ | 'zoomToExtent': true | ||
+ | } ); | ||
} | } | ||
− | + | if ( lakeArr.length > 0 ) { | |
− | + | searchArr = []; | |
− | + | for ( var l in drainageArr ) { | |
− | + | searchArr.push("JarviTunnus='" + l + "'"); | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | layersArr.push( { | |
− | + | 'id': 'lakes', | |
− | + | 'type': 'lake', | |
− | + | 'name': 'Järvet', | |
− | + | 'search': searchArr.join( ' OR ' ), | |
− | + | 'selectable': true, | |
− | + | //'fillColor': 'rgba( 255, 255, 255, 0.1 )', | |
− | + | //'strokeWidth': 1, | |
− | + | //'showLabels': true, | |
− | + | //'labelField': 'JarviTunnus', | |
+ | //'labelMaxResolution': | ||
+ | 'zoomToExtent': true, | ||
+ | 'bbox': false, | ||
+ | }); | ||
+ | } | ||
+ | // do the base map with these settings | ||
+ | var map = ol3_jwMakeMap({ | ||
+ | 'container': '<!--{$id|default:CommonObsMap|escape:'html'}-->_container', | ||
+ | 'base': base, | ||
+ | 'lon': lon, | ||
+ | 'lat': lat, | ||
+ | 'zoom': zoom, | ||
+ | 'layers': layersArr, | ||
+ | 'memo': memo | ||
+ | }); | ||
− | + | } | |
− | |||
− | |||
− | } | ||
− | </script> | + | </script> |
</includeonly> | </includeonly> |