Add timeline of the 2nd day - take out from the clock annotstimeline and put it in annotsvizview - make the clocks graphics optional through showClockGraphics
/**
* js/annotsvizview.js
*
* This is the starting point for your application.
* Take a look at http://browserify.org/ for more info
*/
'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 defaultOptions = {
xInit: 0,
yInit: 0,
width: 1024,
height: 768
};
function AnnotsVizView(options){
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.timeBegin = opts.timeBegin;
this.timeEnd = opts.timeEnd;
Utils.getAnnotCategories(opts.urlCategories, this.annotCategories);
var wsPianoroll = opts.wsPianoroll;
var wsAnnot = opts.wsAnnot;
var stageView = opts.stageView;
var currentTime = Date.now() + 3600*1000;
stageView.registerComponent(this);
var timeLineDay2 = new AnnotsTimeLine.AnnotsTimeLine({
stageView : stageView,
logger: logger,
ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
xInit: 0,
yInit: 0,
width: 1024 - 200 - 200,
height: 768-200,
timeBegin: this.timeBegin,
timeEnd: this.timeEnd,
intervalWidth: 6,
intervalHeight: 10,
maxCellHeight: 70,
radius: 200,
annotCategories: this.annotCategories
});
var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
stageView : stageView,
logger: logger,
ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
xInit: 0,
yInit: 0,
width: 1024 - 200 - 200,
height: 768-200,
timeBegin: this.timeBegin,
timeEnd: this.timeEnd,
circleX: timeLineDay2.circleX,
circleY: timeLineDay2.circleY,
intervalWidth: (timeLineDay2.radius*2/3)* timeLineDay2.intervalWidth / timeLineDay2.radius,
intervalHeight: (timeLineDay2.intervalHeight * (timeLineDay2.radius - timeLineDay2.radius*2/3))/ timeLineDay2.maxCellHeight,
maxCellHeight: (timeLineDay2.radius - timeLineDay2.radius*2/3)/4,
radius: timeLineDay2.radius*2/3,
annotCategories: this.annotCategories,
showClockGraphics:false
});
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()
this.container.addChild(timeLineDay3);
var doubleRollH = new DoubleRoll.DoubleRoll({
stageView : stageView,
logger: logger,
ws: wsPianoroll,
yInit: (this.height - 200),
sceneHeight: 200,
pianorolls : [
{
height: 200,
timeWidth: 10,
lineInterval: 5000,
noteHeight: 10
},
]
});
var doubleRollV = new DoubleRoll.DoubleRoll({
stageView : stageView,
logger: logger,
ws: wsPianoroll,
orientation: 'vertical',
sceneHeight: 768-200,
pianorolls : [
{
height: 200,
timeWidth: 60,
lineInterval: 5000,
noteHeight: 5,
},
]
});
var annotsRoll = new AnnotsRoll.AnnotsRoll({
stageView : stageView,
logger: logger,
ws: wsAnnot,
parentContainer: doubleRollV.stage,
xInit: 1024 - 200 - 200,
yInit: 768-200,
width: 200 + 200,
height: 768-200,
widthRoll: 200,
framerate: doubleRollV.framerate,
pixelsPerSecond: Math.floor(1024 / 60),
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 doubleRollV = new DoubleRoll.DoubleRoll({});
this.init = function(){
};
this.updateTime = function(){
currentTime = Date.now() + 3600*1000;
var nbSec = currentTime / 1000;
var hours = Math.floor( nbSec / 3600 ) % 24;
var minutes = Math.floor( nbSec / 60 ) % 60;
var seconds = Math.floor(nbSec % 60);
var timeStr = (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);
currentTimeText.setText(timeStr);
};
var refreshTimeInterval;
this.start = function() {
refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000);
};
this.refresh = function() {
};
this.stop = function(){
};
return this;
}
module.exports = {
AnnotsVizView: AnnotsVizView
};