[OpenLayers-Commits] r12348 - in
sandbox/mpriour/temporal_map/openlayers: examples
lib/OpenLayers/Control
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Sep 8 21:49:50 EDT 2011
Author: mpriour
Date: 2011-09-08 18:49:49 -0700 (Thu, 08 Sep 2011)
New Revision: 12348
Modified:
sandbox/mpriour/temporal_map/openlayers/examples/time-control.html
sandbox/mpriour/temporal_map/openlayers/lib/OpenLayers/Control/TimeManager.js
Log:
- Make time-control.html example a better example, rather than using it as an interactive test bed.
- Add property "maxFrameDelay" to TimeManager to make the frame cycle delay when using layers with async onTick methods configurable.
- Update naturaldocs comments to distinguish public api and private members
Modified: sandbox/mpriour/temporal_map/openlayers/examples/time-control.html
===================================================================
--- sandbox/mpriour/temporal_map/openlayers/examples/time-control.html 2011-09-09 01:40:39 UTC (rev 12347)
+++ sandbox/mpriour/temporal_map/openlayers/examples/time-control.html 2011-09-09 01:49:49 UTC (rev 12348)
@@ -27,11 +27,11 @@
maxResolution: osm.maxResolution
});
- startTime = OpenLayers.Date.parse('2011-08-17T12:00:00.000Z').toISOString();
+ startTime = OpenLayers.Date.parse('2011-08-18T12:00:00.000Z').toISOString();
- pts_wms = new OpenLayers.Layer.WMS("Irene Centroid",
+ storm_wms = new OpenLayers.Layer.WMS("Irene Eye & Storm Winds",
"http://mapstory.demo.opengeo.org:8080/geoserver/wms", {
- layers: "irene_11_pts",
+ layers: "irene_11_pts,irene_11_radii",
transparent: true,
format: 'image/png',
srs:'EPSG:900913',
@@ -39,22 +39,7 @@
},{
metadata: {
timeInterval:
- ['2011-08-17T12:00:00.000Z','2011-08-17T18:00:00.000Z','2011-08-18T00:00:00.000Z',
- '2011-08-18T06:00:00.000Z','2011-08-18T12:00:00.000Z','2011-08-18T18:00:00.000Z',
- '2011-08-19T00:00:00.000Z','2011-08-19T06:00:00.000Z','2011-08-19T12:00:00.000Z',
- '2011-08-19T18:00:00.000Z','2011-08-20T00:00:00.000Z','2011-08-20T06:00:00.000Z',
- '2011-08-20T12:00:00.000Z','2011-08-20T18:00:00.000Z','2011-08-21T00:00:00.000Z',
- '2011-08-21T06:00:00.000Z','2011-08-21T12:00:00.000Z','2011-08-21T18:00:00.000Z',
- '2011-08-22T00:00:00.000Z','2011-08-22T06:00:00.000Z','2011-08-22T12:00:00.000Z',
- '2011-08-22T18:00:00.000Z','2011-08-23T00:00:00.000Z','2011-08-23T06:00:00.000Z',
- '2011-08-23T12:00:00.000Z','2011-08-23T18:00:00.000Z','2011-08-24T00:00:00.000Z',
- '2011-08-24T06:00:00.000Z','2011-08-24T12:00:00.000Z','2011-08-24T18:00:00.000Z',
- '2011-08-25T00:00:00.000Z','2011-08-25T06:00:00.000Z','2011-08-25T12:00:00.000Z',
- '2011-08-25T18:00:00.000Z','2011-08-26T00:00:00.000Z','2011-08-26T06:00:00.000Z',
- '2011-08-26T12:00:00.000Z','2011-08-26T18:00:00.000Z','2011-08-27T00:00:00.000Z',
- '2011-08-27T06:00:00.000Z','2011-08-27T12:00:00.000Z','2011-08-27T18:00:00.000Z',
- '2011-08-28T00:00:00.000Z','2011-08-28T06:00:00.000Z','2011-08-28T12:00:00.000Z',
- '2011-08-28T18:00:00.000Z','2011-08-29T00:00:00.000Z']
+ ['2011-08-18T12:00:00.000Z','2011-08-29T00:00:00.000Z']
},
singleTile:true,
ratio:1,
@@ -62,22 +47,6 @@
visibility:true
});
- radii_wms = new OpenLayers.Layer.WMS("Irene Storm Winds", "http://mapstory.demo.opengeo.org:8080/geoserver/wms", {
- layers: "irene_11_radii",
- transparent: true,
- format: 'image/png',
- srs: 'EPSG:900913',
- time:startTime
- }, {
- metadata: {
- timeInterval: ['2011-08-17T12:00:00.000Z', '2011-08-29T00:00:00.000Z']
- },
- singleTile: true,
- ratio: 1,
- transitionEffect: 'resize',
- visibility: true
- });
-
ia_wms = new OpenLayers.Layer.WMS("Nexrad", "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?", {
layers: "nexrad-n0r-wmst",
transparent: true,
@@ -85,7 +54,7 @@
time:startTime
}, {
metadata: {
- timeInterval: ['2011-08-17T12:00:00.000Z', '2011-08-29T00:00:00.000Z']
+ timeInterval: ['2011-08-18T12:00:00.000Z', '2011-08-29T00:00:00.000Z']
},
singleTile: true,
ratio: 1,
@@ -108,10 +77,7 @@
timeCtl = new OpenLayers.Control.TimeManager({
units:OpenLayers.TimeUnit.HOURS,
step:6,
- frameRate:1.2,
- handlerOptions:{
- WMS:{intervalMode:'exact'}
- }
+ frameRate:0.85
});
timeCtl.events.on({
'tick': update_date,
@@ -121,7 +87,7 @@
});
map.addControls([timeCtl,new OpenLayers.Control.LayerSwitcher()]);
- map.addLayers([osm,ia_wms,line_wms,pts_wms,radii_wms]);
+ map.addLayers([osm,ia_wms,line_wms,storm_wms]);
map.zoomToExtent(new OpenLayers.Bounds(-8627260.535278,1425478.519205,-3729202.941056,5496444.989113));
update_date({
object: timeCtl,
Modified: sandbox/mpriour/temporal_map/openlayers/lib/OpenLayers/Control/TimeManager.js
===================================================================
--- sandbox/mpriour/temporal_map/openlayers/lib/OpenLayers/Control/TimeManager.js 2011-09-09 01:40:39 UTC (rev 12347)
+++ sandbox/mpriour/temporal_map/openlayers/lib/OpenLayers/Control/TimeManager.js 2011-09-09 01:49:49 UTC (rev 12348)
@@ -43,19 +43,19 @@
/**
- * Property: layers
+ * APIProperty: layers
* {Array(<OpenLayers.Layer>)}
*/
layers: null,
/**
- * Property: units
+ * APIProperty: units
* {OpenLayers.TimeUnit}
*/
units:null,
/**
- * Property: step
+ * APIProperty: step
* {Number} The number of time units each tick will advance the current
* animation time. Negative units with tick time in reverse.
* Default : 1.
@@ -63,7 +63,7 @@
step:1,
/**
- * Property: range
+ * APIProperty: range
* {Array(Date|String)} 2 member array containing the minimum and maximum times
* in UTC that the time-series animation will use. (Optional if using
* the intervals property). The 1st value should ALWAYS be less than
@@ -74,7 +74,7 @@
range:null,
/**
- * Property: intervals
+ * APIProperty: intervals
* {Array(Date|String)} Array of valid distinct UTC dates/times that the time-
* series animation can use. (Optional)
* Note: You can use an ISO 8601 formated string (see
@@ -83,7 +83,7 @@
intervals:null,
/**
- * Property: frameRate
+ * APIProperty: frameRate
* {Number} A positive floating point number of frames (or ticks) per
* second to use in time-series animations. Values less than 1 will
* make each tick last for more than 1 second. Example: 0.5 = 1 tick
@@ -93,14 +93,14 @@
frameRate:1,
/**
- * Property: loop
+ * APIProperty: loop
* {Boolean} true to continue running the animation until stop is called
* Default:false
*/
loop:false,
/**
- * Property: snapToIntervals
+ * APIProperty: snapToIntervals
* {Boolean} If intervals are configured and this property is true then
* tick will advance to the next time/date in the intervals array
* regardless of the step value.
@@ -108,13 +108,20 @@
snapToIntervals:false,
/**
- * Property: currentTime
+ * APIProperty: maxFrameDelay
+ * {Number} The number of frame counts to delay the firing of the tick event
+ * while the control waits for its time handlers to be ready to advance.
+ * Default: 1
+ */
+ maxFrameDelay:1,
+ /**
+ * APIProperty: currentTime
* {Date} The current time of the time-series animation
*/
currentTime:null,
/**
- * Private Property: timeHandlers
+ * Property: timeHandlers
* {Array(<OpenLayers.TimeHandler>)} An array of the handlers that
* this control "manages". Read-Only
*/
@@ -315,10 +322,10 @@
if (this.canTickCheck()) {
this.events.triggerEvent('tick', {currentTime: this.currentTime});
}else{
- var intervalId,checkCount = 0;
+ var intervalId,checkCount = 0,maxDelays = this.maxFrameDelay * 4;
intervalId = setInterval(OpenLayers.Function.bind(function(){
- var doTick = this.canTickCheck() || checkCount++ >= 8
- if(checkCount>8){console.log('ADVANCED DUE TO TIME LIMIT')}
+ var doTick = this.canTickCheck() || checkCount++ >= maxDelays
+ if(checkCount>maxDelays){console.log('ADVANCED DUE TO TIME LIMIT')}
if (doTick) {
clearInterval(intervalId);
this.events.triggerEvent('tick', {currentTime: this.currentTime});
@@ -328,7 +335,7 @@
}
},
/**
- * Method: play
+ * APIMethod: play
* Begins/resumes the time-series animation. Fires the 'play' event,
* then calls 'tick' at the interval set by the frameRate property
*/
@@ -341,7 +348,7 @@
this.timer = setInterval(OpenLayers.Function.bind(this.tick,this),1000/this.frameRate);
},
/**
- * Method: stop
+ * APIMethod: stop
* Stops the time-series animation. Fires the 'stop' event.
*/
stop:function(){
@@ -349,7 +356,7 @@
this.events.triggerEvent('stop',{'rangeExceeded':false});
},
/**
- * Method: setRange
+ * APIMethod: setRange
* Sets the time range used by this control. Will modify the start time or
* current time only if the animation is not currently running
*
@@ -365,7 +372,7 @@
if(!this.timer){this.currentTime = new Date(this.range[(this.step>0)?0:1].getTime())}
},
/**
- * Method:setStart
+ * APIMethod:setStart
* Sets the start time for an animation. If the step is negative then this
* sets the maximum time in the control's range parameter. Will only effect
* the currentTime if an animation has not begun.
@@ -381,7 +388,7 @@
!this.timer && (this.currentTime=new Date(time.getTime()));
},
/**
- * Method:setEnd
+ * APIMethod:setEnd
* Sets the end time for an animation. If the step is negative then this
* sets the minimum time in the control's range parameter. Will not effect
* the current time.
@@ -395,7 +402,7 @@
this.range[(this.step>0)?1:0]=time;
},
/**
- * Method:setTime
+ * APIMethod:setTime
* Manually sets the currentTime used in the control's animation.
*
* Parameters: {Object} time
@@ -408,7 +415,7 @@
this.events.triggerEvent('tick',{'currentTime':this.currentTime});
},
/**
- * Method:reset
+ * APIMethod:reset
* Resets the time to the animation start time. Fires the 'reset' event.
*
* Returns:
@@ -422,7 +429,7 @@
return this.currentTime;
},
/**
- * Method: incrementTime
+ * APIMethod: incrementTime
* Moves the current animation time forward by the specified step & stepUnit
*
* Parameters:
@@ -435,7 +442,7 @@
this.currentTime['setUTC'+stepUnit](this.currentTime['getUTC'+stepUnit]()+step);
},
/**
- * Private Method: buildTimeHandlers
+ * Method: buildTimeHandlers
* Creates the controls "managed" by this control.
*
* Parameters:
More information about the Commits
mailing list