[Commits] r2275 - in sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator: build lib/GeoExt.ux

commits at geoext.org commits at geoext.org
Wed Aug 18 00:42:30 CEST 2010


Author: tschaub
Date: 2010-08-18 00:42:30 +0200 (Wed, 18 Aug 2010)
New Revision: 2275

Modified:
   sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/build/ux.js
   sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/lib/GeoExt.ux/TrackAnimator.js
Log:
Add fields config and create altitude field by default.

Modified: sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/build/ux.js
===================================================================
--- sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/build/ux.js	2010-08-17 19:13:52 UTC (rev 2274)
+++ sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/build/ux.js	2010-08-17 22:42:30 UTC (rev 2275)
@@ -1,4 +1,4 @@
-Ext.namespace("GeoExt.ux");GeoExt.ux.TrackAnimator=Ext.extend(Ext.Container,{textReset:"reset",textPlay:"play",textStop:"stop",textRepeat:"repeat",url:null,protocolOptions:null,formatOptions:null,store:null,layer:null,span:60,speed:10,frameRate:6,repeat:false,aggressive:true,playing:false,initComponent:function(){this.addEvents("load","exception");if(!this.store){var formatOptions=Ext.apply(this.formatOptions||{},{extractTracks:true});var protocolOptions=Ext.apply(this.protocolOptions||{},{url:this.url,format:new OpenLayers.Format.KML(formatOptions)});this.store=new GeoExt.data.FeatureStore({fields:[{name:"when",type:"date"},{name:"heading",type:"number"},{name:"tilt",type:"number"},{name:"roll",type:"number"},{name:"trackId",type:"string"}],proxy:new GeoExt.data.ProtocolProxy({protocol:new OpenLayers.Protocol.HTTP(protocolOptions)}),autoLoad:true,listeners:{load:function(store){this.startTime=Number.POSITIVE_INFINITY;this.endTime=Number.NEGATIVE_INFINITY;store.each(function(rec){var when=rec.get("when").getTime();if(when<this.startTime){this.startTime=when;}if(when>this.endTime){this.endTime=when;}},this);this.slider.minValue=this.startTime;this.slider.maxValue=this.endTime;this.slider.setValue(this.startTime);this.slider.enable();this.updateDisplay();},scope:this}});}
+Ext.namespace("GeoExt.ux");GeoExt.ux.TrackAnimator=Ext.extend(Ext.Container,{textReset:"reset",textPlay:"play",textStop:"stop",textRepeat:"repeat",url:null,protocolOptions:null,formatOptions:null,store:null,fields:null,layer:null,span:60,speed:10,frameRate:6,repeat:false,aggressive:true,playing:false,initComponent:function(){this.addEvents("load","exception");if(!this.store){var formatOptions=Ext.apply(this.formatOptions||{},{extractTracks:true});var protocolOptions=Ext.apply(this.protocolOptions||{},{url:this.url,format:new OpenLayers.Format.KML(formatOptions)});this.store=new GeoExt.data.FeatureStore({fields:this.fields||[{name:"when",type:"date"},{name:"heading",type:"number"},{name:"tilt",type:"number"},{name:"roll",type:"number"},{name:"altitude",type:"number"},{name:"trackId",type:"string"}],proxy:new GeoExt.data.ProtocolProxy({protocol:new OpenLayers.Protocol.HTTP(protocolOptions)}),autoLoad:true,listeners:{load:function(store){this.startTime=Number.POSITIVE_INFINITY;this.endTime=Number.NEGATIVE_INFINITY;store.each(function(rec){var when=rec.get("when").getTime();if(when<this.startTime){this.startTime=when;}if(when>this.endTime){this.endTime=when;}},this);this.slider.minValue=this.startTime;this.slider.maxValue=this.endTime;this.slider.setValue(this.startTime);this.slider.enable();this.updateDisplay();},scope:this}});}
 this.relayEvents(this.store,["load","exception"]);this.dateDisplay=new Ext.BoxComponent({cls:"gxux-trackanimator-datedisplay",autoEl:{tag:"div",html:""}});this.slider=new Ext.Slider({cls:"gxux-trackanimator-slider",disabled:true,listeners:{change:function(){if(this.aggressive){this.updateDisplay.apply(this,arguments);}},changecomplete:this.updateDisplay,scope:this}});this.items=[this.dateDisplay,this.slider,{xtype:"toolbar",buttonAlign:"center",cls:"gxux-trackanimator-toolbar",items:[{xtype:"button",tooltip:this.textReset,iconCls:"gxux-icon-start",handler:function(){this.reset();},scope:this},{xtype:"button",tooltip:this.textPlay,iconCls:"gxux-icon-play",handler:function(){this.play();},scope:this},{xtype:"button",tooltip:this.textStop,iconCls:"gxux-icon-stop",handler:function(){this.stop();},scope:this},{xtype:"button",tooltip:this.textRepeat,enableToggle:true,pressed:this.repeat,iconCls:"gxux-icon-repeat",handler:function(button){this.repeat=!!button.pressed},scope:this}]}];GeoExt.ux.TrackAnimator.superclass.initComponent.call(this);},updateDisplay:function(){var maxTime=this.slider.getValue();var minTime=maxTime-(this.span*1000);var trackIds={};this.store.filterBy(function(rec){var when=rec.get("when").getTime();var include=minTime<=when&&maxTime>=when;if(include){var trackId=rec.get("trackId");var feature=rec.data.feature;var obj=trackIds[trackId];if(!obj){obj={points:[]};trackIds[trackId]=obj;}
 obj.points.push(feature.geometry);obj.attributes=feature.attributes;}
 return include;});if(this.layer){this.layer.removeAllFeatures();var tracks=[];var heads=[];var obj;for(var trackId in trackIds){obj=trackIds[trackId];tracks.push(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(obj.points),obj.attributes));heads.push(new OpenLayers.Feature.Vector(obj.points[obj.points.length-1].clone(),obj.attributes));}

Modified: sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/lib/GeoExt.ux/TrackAnimator.js
===================================================================
--- sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/lib/GeoExt.ux/TrackAnimator.js	2010-08-17 19:13:52 UTC (rev 2274)
+++ sandbox/tschaub/trackanimator/geoext.ux/ux/TrackAnimator/lib/GeoExt.ux/TrackAnimator.js	2010-08-17 22:42:30 UTC (rev 2275)
@@ -75,6 +75,15 @@
      */
     store: null,
     
+    /** api: config[fields]
+     *  ``Array``
+     *  Optional list of field definitions for records in the store.  If not 
+     *  provided, fields are assumed to be "when" (date), "heading" (number), 
+     *  "tilt" (number), "roll" (number), "altitude" (number), and "trackId"
+     *  (string).
+     */
+    fields: null,
+    
     /** api: config[layer]
      *  :class:`OpenLayers.Layer.Vector`
      *  A layer for diplaying tracks.  Features on this layer are managed
@@ -156,11 +165,12 @@
             });
             
             this.store = new GeoExt.data.FeatureStore({
-                fields: [
+                fields: this.fields || [
                     {name: "when", type: "date"},
                     {name: "heading", type: "number"},
                     {name: "tilt", type: "number"},
                     {name: "roll", type: "number"},
+                    {name: "altitude", type: "number"},
                     {name: "trackId", type: "string"}
                 ],
                 proxy: new GeoExt.data.ProtocolProxy({



More information about the Commits mailing list