client/annotviz/app/js/annotsvizview.js
changeset 144 1762372184ae
parent 141 e6892a30d454
child 161 0b01cbd8ed9e
equal deleted inserted replaced
143:95104e98d78d 144:1762372184ae
     1 /**
     1 /**
     2 * js/annotsvizview.js
     2 * js/annotsvizview.js
     3 *
     3 *
     4 * This is the starting point for your application.
     4 * This is the starting point for your application.
     5 * Take a look at http://browserify.org/ for more info
     5 * Take a look at http://browserify.org/ for more info
       
     6 *
     6 */
     7 */
       
     8 /*jshint unused: false */
     7 
     9 
     8 'use strict';
    10 'use strict';
     9 
    11 
    10 var PIXI = require('pixi');
    12 var PIXI = require('pixi');
    11 var _ = require('lodash');
    13 var _ = require('lodash');
    38     this.annotCategoriesDay1 = [];
    40     this.annotCategoriesDay1 = [];
    39 
    41 
    40     var wsPianoroll = opts.wsPianoroll;
    42     var wsPianoroll = opts.wsPianoroll;
    41     var wsAnnot = opts.wsAnnot;
    43     var wsAnnot = opts.wsAnnot;
    42     var stageView = opts.stageView;
    44     var stageView = opts.stageView;
    43     var currentTime = Date.now() + 3600*1000;
       
    44     var channel = opts.channel;
    45     var channel = opts.channel;
    45     var serverUrl = opts.serverUrl;
    46     var serverUrl = opts.serverUrl;
    46     
    47 
    47     var eventCode = opts.eventCode;
    48     var eventCode = opts.eventCode;
    48     var eventCodeSessionDay2 = opts.eventCodeSessionDay2;
    49     var eventCodeSessionDay2 = opts.eventCodeSessionDay2;
    49 	var eventCodeSessionDay1 = opts.eventCodeSessionDay1;
    50 	var eventCodeSessionDay1 = opts.eventCodeSessionDay1;
       
    51     var logger = opts.logger;
    50 
    52 
    51 	Utils.getAnnotCategories(opts.urlCategories + eventCode, this.annotCategories);
    53 	Utils.getAnnotCategories(opts.urlCategories + eventCode, this.annotCategories);
    52     Utils.getAnnotCategories(opts.urlCategories + eventCodeSessionDay2, this.annotCategoriesDay2);
    54     Utils.getAnnotCategories(opts.urlCategories + eventCodeSessionDay2, this.annotCategoriesDay2);
    53     Utils.getAnnotCategories(opts.urlCategories + eventCodeSessionDay1, this.annotCategoriesDay1);
    55     Utils.getAnnotCategories(opts.urlCategories + eventCodeSessionDay1, this.annotCategoriesDay1);
    54 
    56 
    71         eventCode: eventCode,
    73         eventCode: eventCode,
    72         channel: channel,
    74         channel: channel,
    73         serverUrl: serverUrl,
    75         serverUrl: serverUrl,
    74         annotCategories: this.annotCategories
    76         annotCategories: this.annotCategories
    75     });
    77     });
    76 	
    78 
    77 	//Archive day 2
    79 	//Archive day 2
    78     var timeLineDay2 = new AnnotsTimeLine.AnnotsTimeLine({
    80     var timeLineDay2 = new AnnotsTimeLine.AnnotsTimeLine({
    79     	stageView : stageView,
    81     	stageView : stageView,
    80         xInit: 0,
    82         xInit: 0,
    81         yInit: 0,
    83         yInit: 0,
    82         width: 1024 - 200 - 200,
    84         width: 1024 - 200 - 200,
    83         height: 768-200,
    85         height: 768-200,
    84         timeBegin: Date.parse("2015-01-23T09:30:00+01:00"),
    86         timeBegin: Date.parse('2015-01-23T09:30:00+01:00'),
    85         timeEnd: Date.parse("2015-01-23T18:30:00+01:00"),
    87         timeEnd: Date.parse('2015-01-23T18:30:00+01:00'),
    86         circleX: currentDay.circleX,
    88         circleX: currentDay.circleX,
    87         circleY: currentDay.circleY,
    89         circleY: currentDay.circleY,
    88         intervalWidth: (currentDay.radius*2/3)* currentDay.intervalWidth / currentDay.radius,
    90         intervalWidth: (currentDay.radius*2/3)* currentDay.intervalWidth / currentDay.radius,
    89         intervalHeight: (currentDay.intervalHeight * (currentDay.radius - currentDay.radius*2/3))/ currentDay.maxCellHeight,
    91         intervalHeight: (currentDay.intervalHeight * (currentDay.radius - currentDay.radius*2/3))/ currentDay.maxCellHeight,
    90         maxCellHeight: (currentDay.radius - currentDay.radius*2/3)/2,
    92         maxCellHeight: (currentDay.radius - currentDay.radius*2/3)/2,
    94         channel: channel,
    96         channel: channel,
    95         serverUrl: serverUrl,
    97         serverUrl: serverUrl,
    96         showClockGraphics:false,
    98         showClockGraphics:false,
    97         archive: true
    99         archive: true
    98     });
   100     });
    99 	
   101 
   100 	//Archive day 1
   102 	//Archive day 1
   101     var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
   103     var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
   102     	stageView : stageView,
   104     	stageView : stageView,
   103         xInit: 0,
   105         xInit: 0,
   104         yInit: 0,
   106         yInit: 0,
   105         width: 1024 - 200 - 200,
   107         width: 1024 - 200 - 200,
   106         height: 768-200,
   108         height: 768-200,
   107         timeBegin: Date.parse("2015-01-22T09:30:00+01:00"),
   109         timeBegin: Date.parse('2015-01-22T09:30:00+01:00'),
   108         timeEnd: Date.parse("2015-01-22T18:30:00+01:00"),
   110         timeEnd: Date.parse('2015-01-22T18:30:00+01:00'),
   109         circleX: currentDay.circleX,
   111         circleX: currentDay.circleX,
   110         circleY: currentDay.circleY,
   112         circleY: currentDay.circleY,
   111         intervalWidth: (currentDay.radius*2/3)* currentDay.intervalWidth / currentDay.radius,
   113         intervalWidth: (currentDay.radius*2/3)* currentDay.intervalWidth / currentDay.radius,
   112         intervalHeight: (currentDay.intervalHeight * (currentDay.radius - currentDay.radius/3))/ currentDay.maxCellHeight,
   114         intervalHeight: (currentDay.intervalHeight * (currentDay.radius - currentDay.radius/3))/ currentDay.maxCellHeight,
   113         maxCellHeight: (currentDay.radius*2/3 - currentDay.radius/3)/4,
   115         maxCellHeight: (currentDay.radius*2/3 - currentDay.radius/3)/4,
   118         serverUrl: serverUrl,
   120         serverUrl: serverUrl,
   119         showClockGraphics:false,
   121         showClockGraphics:false,
   120         archive: true,
   122         archive: true,
   121     });
   123     });
   122 
   124 
   123     var currentTimeText = new PIXI.Text("-- : -- : --", { font: '18pt Gothic Standard', fill: '#646464' });
   125     var currentTimeText = new PIXI.Text('-- : -- : --', { font: '18pt Gothic Standard', fill: '#646464' });
   124     currentTimeText.x = timeLineDay2.circleX - currentTimeText.width/2;
   126     currentTimeText.x = timeLineDay2.circleX - currentTimeText.width/2;
   125     currentTimeText.y = timeLineDay2.circleY - currentTimeText.height/2;
   127     currentTimeText.y = timeLineDay2.circleY - currentTimeText.height/2;
   126     this.container.addChild(currentTimeText);
   128     this.container.addChild(currentTimeText);
       
   129 
   127 
   130 
   128     var doubleRollH = new DoubleRoll.DoubleRoll({
   131     var doubleRollH = new DoubleRoll.DoubleRoll({
   129         stageView : stageView,
   132         stageView : stageView,
   130         logger: logger,
   133         logger: logger,
   131         ws: wsPianoroll,
   134         ws: wsPianoroll,