Zeke Posted August 25, 2012 Report Share Posted August 25, 2012 On / Off function acarsmap.js /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ * * Rewritten for Google Maps v3 */ var flightMarkers = []; var routeMarkers = []; var flightPath = null; var depMarker = null, arrMarker = null; var info_window= null; var run_once = false; var mapOptions = { zoom: 4, center: new google.maps.LatLng(47.437047,19.248515), mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById("acarsmap"), mapOptions); var weatherLayer = new google.maps.weather.WeatherLayer({ temperatureUnits: google.maps.weather.TemperatureUnit.CELSIUS }); weatherLayer.setMap(null); var cloudLayer = new google.maps.weather.CloudLayer(); cloudLayer.setMap(null) setWindSpeed(google.maps.weather.WindSpeedUnit.KILOMETERS_PER_HOUR) var defaultOptions = { autozoom: true, refreshTime: 38000, autorefresh: true }; function toggleClouds() { cloudLayer.setMap(cloudLayer.getMap() ? null : map); } function toggleIcons() { weatherLayer.setMap(weatherLayer.getMap() ? null : map); } function setWindSpeed(units) { weatherLayer.setOptions({'windSpeedUnits': units}); } var options = $.extend({}, defaultOptions, acars_map_defaults); //var map = new google.maps.Map(document.getElementById("acarsmap"), options); acarsmap.tpl <div align="right"> Wind speed units: <input name="wind" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.MILES_PER_HOUR)" type="radio">mph <input name="wind" checked="" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.KILOMETERS_PER_HOUR)" type="radio">km/h <input name="wind" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.METERS_PER_SECOND)" type="radio">m/s</td> <button onclick="toggleClouds()">Toggle clouds</button> <button onclick="toggleIcons()">Toggle icons</button> </div> Demo:http://matraair.tarhely.biz Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted January 15, 2013 Report Share Posted January 15, 2013 On / Off function acarsmap.js /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ * * Rewritten for Google Maps v3 */ var flightMarkers = []; var routeMarkers = []; var flightPath = null; var depMarker = null, arrMarker = null; var info_window= null; var run_once = false; var mapOptions = { zoom: 4, center: new google.maps.LatLng(47.437047,19.248515), mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById("acarsmap"), mapOptions); var weatherLayer = new google.maps.weather.WeatherLayer({ temperatureUnits: google.maps.weather.TemperatureUnit.CELSIUS }); weatherLayer.setMap(null); var cloudLayer = new google.maps.weather.CloudLayer(); cloudLayer.setMap(null) setWindSpeed(google.maps.weather.WindSpeedUnit.KILOMETERS_PER_HOUR) var defaultOptions = { autozoom: true, refreshTime: 38000, autorefresh: true }; function toggleClouds() { cloudLayer.setMap(cloudLayer.getMap() ? null : map); } function toggleIcons() { weatherLayer.setMap(weatherLayer.getMap() ? null : map); } function setWindSpeed(units) { weatherLayer.setOptions({'windSpeedUnits': units}); } var options = $.extend({}, defaultOptions, acars_map_defaults); //var map = new google.maps.Map(document.getElementById("acarsmap"), options); acarsmap.tpl <div align="right"> Wind speed units: <input name="wind" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.MILES_PER_HOUR)" type="radio">mph <input name="wind" checked="" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.KILOMETERS_PER_HOUR)" type="radio">km/h <input name="wind" onclick="setWindSpeed(google.maps.weather.WindSpeedUnit.METERS_PER_SECOND)" type="radio">m/s</td> <button onclick="toggleClouds()">Toggle clouds</button> <button onclick="toggleIcons()">Toggle icons</button> </div> Demo:http://matraair.tarhely.biz G'day Zeke, Thanks for the code, all is working for me except the toggle for the weather icons, for some reason they won't toggle on and off. Any Idea's ? 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.