client/annotviz/app/js/annotsvizview.js
changeset 131 0bb70072a56f
parent 129 7181e1f28eb0
child 134 119b6193c493
--- a/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 01:08:34 2015 +0100
+++ b/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 02:00:19 2015 +0100
@@ -4,15 +4,16 @@
 * This is the starting point for your application.
 * Take a look at http://browserify.org/ for more info
 */
+/*jshint unused:false */
 
 'use strict';
 
 var PIXI = require('pixi');
 var _ = require('lodash');
-var DoubleRoll = require('./doubleroll.js');
-var AnnotsTimeLine = require('./annotstimeline.js');
-var AnnotsRoll = require('./annotsroll.js');
-var Utils = require('./utils.js');
+var DoubleRoll = require('./doubleroll');
+var AnnotsTimeLine = require('./annotstimeline');
+var AnnotsRoll = require('./annotsroll');
+var Utils = require('./utils');
 
 var defaultOptions = {
     xInit: 0,
@@ -22,33 +23,33 @@
 };
 
 function AnnotsVizView(options){
-	var _this = this;
+    var _this = this;
     var opts = _(options).defaults(defaultOptions).value();
 
     this.container = new PIXI.DisplayObjectContainer();
     this.container.x = opts.xInit;
     this.container.y = opts.yInit;
-	this.width = opts.width;
-	this.height= opts.height;
+    this.width = opts.width;
+    this.height= opts.height;
     this.timeBegin = opts.timeBegin;
     this.timeEnd = opts.timeEnd;
     this.annotCategories = [];
-    
+
     Utils.getAnnotCategories(opts.urlCategories, this.annotCategories);
-    
-	var wsPianoroll = opts.wsPianoroll;
-	var wsAnnot = opts.wsAnnot;
-	var stageView = opts.stageView;
-	var currentTime = Date.now() + 3600*1000;
-	var eventCode = opts.eventCode;
+
+    var wsPianoroll = opts.wsPianoroll;
+    var wsAnnot = opts.wsAnnot;
+    var stageView = opts.stageView;
+    var eventCode = opts.eventCode;
     var channel = opts.channel;
+    var logger = opts.logger;
 
-	stageView.registerComponent(this);
+    stageView.registerComponent(this);
 
-	var timeLineDay2 = new AnnotsTimeLine.AnnotsTimeLine({
-    	stageView : stageView,
+    var timeLineDay2 = new AnnotsTimeLine.AnnotsTimeLine({
+        stageView : stageView,
         logger: logger,
-        ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
+        ws: wsAnnot,
         xInit: 0,
         yInit: 0,
         width: 1024 - 200 - 200,
@@ -63,17 +64,18 @@
         channel: channel,
         annotCategories: this.annotCategories
     });
-	
+
     //Archive day 1
+    /*jshint -W098 */
     var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
-    	stageView : stageView,
+        stageView : stageView,
         archive: true,
         xInit: 0,
         yInit: 0,
         width: 1024 - 200 - 200,
         height: 768-200,
-        timeBegin: Date.parse("2015-01-22T09:30:00+01:00"),
-        timeEnd: Date.parse("2015-01-22T18:30:00+01:00"),
+        timeBegin: Date.parse('2015-01-22T09:30:00+01:00'),
+        timeEnd: Date.parse('2015-01-22T18:30:00+01:00'),
         circleX: timeLineDay2.circleX,
         circleY: timeLineDay2.circleY,
         intervalWidth: (timeLineDay2.radius*2/3)* timeLineDay2.intervalWidth / timeLineDay2.radius,
@@ -85,21 +87,22 @@
         channel: channel,
         showClockGraphics:false
     });
-    
-    var currentTimeText = new PIXI.Text("-- : -- : --", { font: '18pt Gothic Standard', fill: '#646464' });
+
+    var currentTimeText = new PIXI.Text('-- : -- : --', { font: '18pt Gothic Standard', fill: '#646464' });
     currentTimeText.x = timeLineDay2.circleX - currentTimeText.width/2;
     currentTimeText.y = timeLineDay2.circleY - currentTimeText.height/2;
     this.container.addChild(currentTimeText);
 
     var timeLineDay3 = new PIXI.Graphics();
     timeLineDay3.lineStyle(1, 0x646464)
-    	.drawCircle(timeLineDay2.circleX, timeLineDay2.circleY, timeLineDay2.radius/3)
-    	.endFill()
+        .drawCircle(timeLineDay2.circleX, timeLineDay2.circleY, timeLineDay2.radius/3)
+        .endFill();
     this.container.addChild(timeLineDay3);
-    
-	var doubleRollH = new DoubleRoll.DoubleRoll({
+
+    /*jshint -W098 */
+    var doubleRollH = new DoubleRoll.DoubleRoll({
         stageView : stageView,
-    	logger: logger,
+        logger: logger,
         ws: wsPianoroll,
         yInit: (this.height - 200),
         sceneHeight: 200,
@@ -113,9 +116,9 @@
         ]
     });
 
-	var doubleRollV = new DoubleRoll.DoubleRoll({
+    var doubleRollV = new DoubleRoll.DoubleRoll({
         stageView : stageView,
-    	logger: logger,
+        logger: logger,
         ws: wsPianoroll,
         orientation: 'vertical',
         sceneHeight: 768-200,
@@ -129,8 +132,8 @@
         ]
     });
 
-	var annotsRoll = new AnnotsRoll.AnnotsRoll({
-    	stageView : stageView,
+    var annotsRoll = new AnnotsRoll.AnnotsRoll({
+        stageView : stageView,
         logger: logger,
         ws: wsAnnot,
         parentContainer: doubleRollV.stage,
@@ -144,31 +147,31 @@
         annotColors: this.annotCategories
     });
 
-	var limiters = new PIXI.Graphics()
-		.lineStyle(1, 0x646464)
-		.moveTo(annotsRoll.container.x, annotsRoll.container.y)
-		.lineTo(annotsRoll.container.x, annotsRoll.container.y - annotsRoll.height)
-		.moveTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y)
-		.lineTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y - annotsRoll.height)
-		.moveTo(0, this.height - 200)
-		.lineTo(this.width, this.height - 200)
-		.drawRect(0, 0, this.width -1, this.height -1)
-		.beginFill(0xECECEC)
-		.drawRect(1024 - 200, 0, 200, 768-200)
-		.endFill();
-	this.container.addChild(limiters);
+    var limiters = new PIXI.Graphics()
+        .lineStyle(1, 0x646464)
+        .moveTo(annotsRoll.container.x, annotsRoll.container.y)
+        .lineTo(annotsRoll.container.x, annotsRoll.container.y - annotsRoll.height)
+        .moveTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y)
+        .lineTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y - annotsRoll.height)
+        .moveTo(0, this.height - 200)
+        .lineTo(this.width, this.height - 200)
+        .drawRect(0, 0, this.width -1, this.height -1)
+        .beginFill(0xECECEC)
+        .drawRect(1024 - 200, 0, 200, 768-200)
+        .endFill();
+    this.container.addChild(limiters);
 
-	this.init = function(){
-	};
+    this.init = function(){
+    };
 
-	this.updateTime = function(){
+    this.updateTime = function(){
         currentTimeText.setText(Utils.formatTime(Date.now()));
     };
 
     var refreshTimeInterval;
-    
-	this.start = function() {
-		refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000);
+
+    this.start = function() {
+        refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000);
     };
 
     this.refresh = function() {
@@ -182,5 +185,5 @@
 }
 
 module.exports = {
-	AnnotsVizView: AnnotsVizView
+    AnnotsVizView: AnnotsVizView
 };