Jump to content

Recommended Posts

Posted

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

  • 4 months later...
Posted

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 ?

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...