client/annotviz/app/js/annotstimeline.js
changeset 137 750d9076a4a8
parent 135 d3066fa80a81
child 144 1762372184ae
equal deleted inserted replaced
136:83a5ab5e2e81 137:750d9076a4a8
    84     var loadArchives = function() {
    84     var loadArchives = function() {
    85         //start timeBegin end startTime
    85         //start timeBegin end startTime
    86         //query -> need channel + eventCode
    86         //query -> need channel + eventCode
    87         //iterate over data fill cells
    87         //iterate over data fill cells
    88         var startTs = _this.timeBegin;
    88         var startTs = _this.timeBegin;
    89         var endTs = _this.startTs;
    89         var endTs = Math.min(_this.timeEnd,_this.startTs);
       
    90 
       
    91         console.log("START TS",new Date(startTs).toISOString());
       
    92         console.log("END TS",new Date(endTs).toISOString());
    90 
    93 
    91         var url = serverUrl + '/p/api/v1/annotation';
    94         var url = serverUrl + '/p/api/v1/annotation';
    92         var filters = [
    95         var filters = [
    93             { name: 'ts', op: '>', val: new Date(startTs).toISOString()}, //start
    96             { name: 'ts', op: '>', val: new Date(startTs).toISOString()}, //start
    94             { name: 'ts', op: '<=', val: new Date(endTs).toISOString()}, //end
    97             { name: 'ts', op: '<=', val: new Date(endTs).toISOString()}, //end
   100 
   103 
   101         var totalPage = 1;
   104         var totalPage = 1;
   102         var currentPage = 1;
   105         var currentPage = 1;
   103 
   106 
   104         var processResFunction = function(res) {
   107         var processResFunction = function(res) {
   105 
   108             //console.log("RES archive", res);
   106             if(res) {
   109             if(res) {
   107                 var data = res.target.json;
   110                 var data = res.target.json;
   108                 /*jshint -W069 */
   111                 /*jshint -W069 */
   109                 totalPage = Math.min(maxPages,parseInt(data['total_pages']));
   112                 totalPage = Math.min(maxPages,parseInt(data['total_pages']));
   110                 data.objects.forEach(function(annotation) {
   113                 data.objects.forEach(function(annotation) {
   115                 var jsonLoader = new PIXI.JsonLoader(url+'&page='+currentPage, true);
   118                 var jsonLoader = new PIXI.JsonLoader(url+'&page='+currentPage, true);
   116                 jsonLoader.on('loaded', processResFunction);
   119                 jsonLoader.on('loaded', processResFunction);
   117                 jsonLoader.load();
   120                 jsonLoader.load();
   118                 currentPage++;
   121                 currentPage++;
   119             }
   122             }
   120             console.log(res);
       
   121         };
   123         };
   122         processResFunction();
   124         processResFunction();
   123 
   125 
   124     };
   126     };
   125 
   127 
   132             if(cdef.ts < ts) {
   134             if(cdef.ts < ts) {
   133                 colorsDef = cdef;
   135                 colorsDef = cdef;
   134                 return false;
   136                 return false;
   135             }
   137             }
   136         });
   138         });
       
   139 
       
   140         if(!colorsDef) {
       
   141             return;
       
   142         }
   137 
   143 
   138         if (this.timeEnd > ts){
   144         if (this.timeEnd > ts){
   139             var i = Math.floor((ts - this.timeBegin)/(1000*this.intervalDuration));
   145             var i = Math.floor((ts - this.timeBegin)/(1000*this.intervalDuration));
   140 
   146 
   141             if (typeof(this.cells[i].graphics) === 'undefined'){
   147             if (typeof(this.cells[i].graphics) === 'undefined'){