You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.8 KiB
1 lines
2.8 KiB
function IvsDraw(){function a(a,b){this.data=a,this.timeStamp=b,this.next=null}function b(){function a(){this.first=null,this.size=0}return a.prototype={enqueue:function(a){if(null===this.first)this.first=a;else{for(var b=this.first;null!==b.next;)b=b.next;b.next=a}this.size+=1},dequeue:function(){var a=null;return null!==this.first&&(a=this.first,this.first=this.first.next,this.size-=1),a},clear:function(){this.size=0,this.first=null}},new a}function c(a,b){var c=b.first;if(c)if(a>c.timeStamp){for(;c&&a>c.timeStamp;)c=b.dequeue(),2===c.data.type&&f&&f(c.data);c&&f&&f(c.data)}else a<c.timeStamp?2!==c.data.type&&f&&f(c.data):(f&&f(c.data),b.dequeue())}function d(){}var e={},f=null,g=b(),h=b(),i=500;return d.prototype={draw:function(b,d,j){debug.log("type:"+b.type+" jsondata:"+JSON.stringify(b.params));var k=b.params;if(k){var l={type:0,data:null};if(k.hasOwnProperty("VideoAnalyseRule")&&(l.type=0,l.data=k.VideoAnalyseRule,f&&f(l)),k.hasOwnProperty("Event")&&(l.type=2,l.data=k.Event,h.enqueue(new a(JSON.parse(JSON.stringify(l)),j))),c(d,h),5===b.type)for(var m=k.object,n=k.coordinate,o=0;o<m.length;o++)!function(a){switch(m[a].operateType){case 1:e[m[a].objectId]={},e[m[a].objectId].show=!0,m[a].hasOwnProperty("track")&&(e[m[a].objectId].pos=m[a].track[0]),e[m[a].objectId].type=m[a].objectType,e[m[a].objectId].coordinate=n,e[m[a].objectId].timeout=setTimeout(function(){e[m[a].objectId].show=!1},i);break;case 2:e.hasOwnProperty(m[a].objectId)||(e[m[a].objectId]={},e[m[a].objectId].coordinate=n),m[a].hasOwnProperty("track")&&(e[m[a].objectId].pos=m[a].track[0],e[m[a].objectId].show=!0),e[m[a].objectId].type=m[a].objectType,e[m[a].objectId].timeout&&clearTimeout(e[m[a].objectId].timeout),e[m[a].objectId].timeout=setTimeout(function(){e[m[a].objectId].show=!1},i);break;case 3:e.hasOwnProperty(m[a].objectId)&&(e[m[a].objectId].timeout&&clearTimeout(e[m[a].objectId].timeout),delete e[m[a].objectId]);break;case 4:e.hasOwnProperty(m[a].objectId)&&(e[m[a].objectId].show=!1)}}(o);else if(14===b.type)for(var n=k.coordinate,m=k.object&&k.object.commonObject||[],o=0;o<m.length;o++)!function(a){for(var b in m[a])if("object"==typeof m[a][b])switch(m[a].operateType){case 1:e[m[a].objectId]={},e[m[a].objectId].show=!0,e[m[a].objectId].pos=m[a][b][0].track[0],e[m[a].objectId].type=m[a].type,e[m[a].objectId].coordinate=n,e[m[a].objectId].timeout=setTimeout(function(){delete e[m[a].objectId]},i);break;case 2:e.hasOwnProperty(m[a].objectId)||(e[m[a].objectId]={},e[m[a].objectId].coordinate=n),e[m[a].objectId].pos=m[a][b][0].track[0],e[m[a].objectId].show=!0,e[m[a].objectId].type=m[a].type,e[m[a].objectId].timeout&&clearTimeout(e[m[a].objectId].timeout),e[m[a].objectId].timeout=setTimeout(function(){delete e[m[a].objectId]},i)}}(o);l.type=1,l.data=e,g.enqueue(new a(JSON.parse(JSON.stringify(l)),j)),c(d,g)}},setCallback:function(a){f||(f=a)}},new d}
|