[OpenLayers-Commits] r12433 - in addins/timedpointtrack/trunk:
examples lib
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Nov 3 04:17:26 EDT 2011
Author: ahocevar
Date: 2011-11-03 01:17:25 -0700 (Thu, 03 Nov 2011)
New Revision: 12433
Modified:
addins/timedpointtrack/trunk/examples/time-select-control.html
addins/timedpointtrack/trunk/examples/timed-point-track-markers.html
addins/timedpointtrack/trunk/lib/TimedPointTrack.js
Log:
Making script loader FF4+ compatible; updating examples
Modified: addins/timedpointtrack/trunk/examples/time-select-control.html
===================================================================
--- addins/timedpointtrack/trunk/examples/time-select-control.html 2011-10-20 09:53:09 UTC (rev 12432)
+++ addins/timedpointtrack/trunk/examples/time-select-control.html 2011-11-03 08:17:25 UTC (rev 12433)
@@ -14,15 +14,11 @@
<script src="../lib/TimedPointTrack.js"></script>
<!--<script src="http://www.javascripttoolbox.com/libsource.php/date/source/date.js"></script>-->
<script type="text/javascript">
- var map, layer, rss, popup, timeBar, timepos;
+ var map, rss, popup, timeBar, timepos;
OpenLayers.ProxyHost = "proxy.cgi?url=";
function init(){
- map = new OpenLayers.Map('map', {maxResolution:'auto'});
- layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(20.22, 22.05), 9);
+ map = new OpenLayers.Map('map', {allOverlays: true, maxResolution:'auto'});
map.addControl(new OpenLayers.Control.LayerSwitcher());
timeBar = new OpenLayers.Control.TimeSliderBar( {continuous: true} );
map.addControl(timeBar);
@@ -81,6 +77,7 @@
rss.events.register("loadend", null, function() {
timeBar.rangeFromTrack(rss.features[0].geometry);
+ map.zoomToExtent(rss.getDataExtent());
});
}
@@ -94,7 +91,7 @@
<h1>Select time in time-aware layers</h1>
<p style="font-size:.9em;">This demo uses OpenLayers.Control.TimeSliderBar with OpenLayers.Layer.GeoRSS and OpenLayers.Layer.TimedPointTrack. The track is created by connecting the points of the GeoRSS feed, and the points can be tracked based on their temporal attribute.</a></p>
<form onsubmit="return false;">
- Load GeoRSS URL: <input type="text" id="url" size="50" /><input type="submit" onclick="addUrl(); return false;" value="Load Feed" onsubmit="addUrl(); return false;" />
+ Load GeoRSS URL: <input type="text" id="url" size="50" value="xml/track1.xml" /><input type="submit" onclick="addUrl(); return false;" value="Load Feed" onsubmit="addUrl(); return false;" />
</form> <form onsubmit="return false;">
Selected time: <input type="text" id="date" value="1995-12-12T09:20:00Z" > <input type="submit" onSubmit="setTime(); return false;" onClick="setTime(); return false;">
</form>
Modified: addins/timedpointtrack/trunk/examples/timed-point-track-markers.html
===================================================================
--- addins/timedpointtrack/trunk/examples/timed-point-track-markers.html 2011-10-20 09:53:09 UTC (rev 12432)
+++ addins/timedpointtrack/trunk/examples/timed-point-track-markers.html 2011-11-03 08:17:25 UTC (rev 12433)
@@ -2,7 +2,7 @@
<head>
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css" />
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css" />
- <link rel="stylesheet" href="../../../../theme/default/timedpointtrack.css" type="text/css" />
+ <link rel="stylesheet" href="../theme/default/timedpointtrack.css" type="text/css" />
<style type="text/css">
#map {
width: 800px;
@@ -17,11 +17,7 @@
OpenLayers.ProxyHost = "proxy.cgi?url=";
function init(){
- map = new OpenLayers.Map('map', {maxResolution:'auto'});
- layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(20.22, 22.05), 9);
+ map = new OpenLayers.Map('map', {allOverlays: true, maxResolution:'auto'});
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
@@ -43,7 +39,12 @@
strokeColor: "yellow",
strokeWidth: 2
}
- })
+ }),
+ eventListeners: {
+ loadend: function() {
+ map.zoomToExtent(rss.getDataExtent());
+ }
+ }
});
map.addLayer(rss);
Modified: addins/timedpointtrack/trunk/lib/TimedPointTrack.js
===================================================================
--- addins/timedpointtrack/trunk/lib/TimedPointTrack.js 2011-10-20 09:53:09 UTC (rev 12432)
+++ addins/timedpointtrack/trunk/lib/TimedPointTrack.js 2011-11-03 08:17:25 UTC (rev 12433)
@@ -32,28 +32,13 @@
"OpenLayers/Layer/TimedPointTrack.js"
);
- var agent = navigator.userAgent;
- var docWrite = (agent.match("MSIE") || agent.match("Safari"));
- if(docWrite) {
- var allScriptTags = new Array(jsfiles.length);
- }
+ var allScriptTags = new Array(jsfiles.length);
for (var i=0, len=jsfiles.length; i<len; i++) {
- if (docWrite) {
- allScriptTags[i] = "<script src='" + addinPath + jsfiles[i] +
+ allScriptTags[i] = "<script src='" + addinPath + jsfiles[i] +
"'></script>";
- } else {
- var s = document.createElement("script");
- s.src = addinPath + jsfiles[i];
- var h = document.getElementsByTagName("head").length ?
- document.getElementsByTagName("head")[0] :
- document.body;
- h.appendChild(s);
- }
}
- if (docWrite) {
- document.write(allScriptTags.join(""));
- }
+ document.write(allScriptTags.join(""));
}
/**
@@ -90,8 +75,6 @@
}
};
- OpenLayers.Map.prototype.EVENT_TYPES.push("datechanged");
-
/**
* Property: OpenLayers.Map.currentDateTime
* {Date} The current date/time if the map has temporal layers
More information about the Commits
mailing list