author | rougeronj |
Thu, 22 Jan 2015 10:01:59 +0100 | |
changeset 113 | 7531e4180915 |
parent 110 | e4f0c105090d |
child 121 | df6b39f962bc |
permissions | -rw-r--r-- |
98 | 1 |
/** |
2 |
* js/annotsvizview.js |
|
3 |
* |
|
4 |
* This is the starting point for your application. |
|
5 |
* Take a look at http://browserify.org/ for more info |
|
6 |
*/ |
|
103 | 7 |
|
8 |
'use strict'; |
|
9 |
||
10 |
var PIXI = require('pixi'); |
|
11 |
var _ = require('lodash'); |
|
12 |
var DoubleRoll = require('./doubleroll.js'); |
|
13 |
var AnnotsTimeLine = require('./annotstimeline.js'); |
|
14 |
var AnnotsRoll = require('./annotsroll.js'); |
|
15 |
||
108 | 16 |
var defaultOptions = { |
103 | 17 |
xInit: 0, |
18 |
yInit: 0, |
|
104 | 19 |
width: 1024, |
20 |
height: 768, |
|
110
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
21 |
annotCategories: [ |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
22 |
{ |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
23 |
"ts": 1421928213000, |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
24 |
"colors": { |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
25 |
"transgressions": "#b90000", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
26 |
"rythmique": "#af931e", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
27 |
"narration": "#4bdd71", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
28 |
"relation": "#1c28ba" |
108 | 29 |
}, |
110
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
30 |
"order": [ |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
31 |
"transgressions", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
32 |
"rythmique", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
33 |
"narration", |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
34 |
"relation" |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
35 |
], |
e4f0c105090d
some quick and dirty fixes on colors to start the session
ymh <ymh.work@gmail.com>
parents:
108
diff
changeset
|
36 |
"defaultColor": "#536991" |
108 | 37 |
}] |
103 | 38 |
}; |
39 |
||
40 |
function AnnotsVizView(options){ |
|
41 |
var _this = this; |
|
42 |
var opts = _(options).defaults(defaultOptions).value(); |
|
108 | 43 |
|
103 | 44 |
this.container = new PIXI.DisplayObjectContainer(); |
45 |
this.container.x = opts.xInit; |
|
46 |
this.container.y = opts.yInit; |
|
47 |
this.width = opts.width; |
|
48 |
this.height= opts.height; |
|
108 | 49 |
this.annotCategories = opts.annotCategories; |
113 | 50 |
this.timeBegin = opts.timeBegin; |
51 |
this.timeEnd = opts.timeEnd; |
|
108 | 52 |
|
103 | 53 |
var wsPianoroll = opts.wsPianoroll; |
54 |
var wsAnnot = opts.wsAnnot; |
|
55 |
var stageView = opts.stageView; |
|
108 | 56 |
|
103 | 57 |
stageView.registerComponent(this); |
108 | 58 |
|
103 | 59 |
var timeLine = new AnnotsTimeLine.AnnotsTimeLine({ |
60 |
stageView : stageView, |
|
61 |
logger: logger, |
|
62 |
ws: new annotviz.WsWrapper(wsUriAnnotation, logger), |
|
63 |
xInit: 0, |
|
64 |
yInit: 0, |
|
104 | 65 |
width: 1024 - 200 - 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
66 |
height: 768-200, |
113 | 67 |
timeBegin: this.timeBegin, |
68 |
timeEnd: this.timeEnd, |
|
103 | 69 |
intervalWidth: 6, |
70 |
intervalHeight: 10, |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
71 |
maxCellHeight: 70, |
104 | 72 |
radius: 200, |
108 | 73 |
annotCategories: this.annotCategories |
103 | 74 |
}); |
108 | 75 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
76 |
var doubleRollH = new DoubleRoll.DoubleRoll({ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
77 |
stageView : stageView, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
78 |
logger: logger, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
79 |
ws: wsPianoroll, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
80 |
yInit: (this.height - 200), |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
81 |
sceneHeight: 200, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
82 |
pianorolls : [ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
83 |
{ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
84 |
height: 200, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
85 |
timeWidth: 10, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
86 |
lineInterval: 5000, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
87 |
noteHeight: 10 |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
88 |
}, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
89 |
] |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
90 |
}); |
108 | 91 |
|
103 | 92 |
var doubleRollV = new DoubleRoll.DoubleRoll({ |
93 |
stageView : stageView, |
|
94 |
logger: logger, |
|
95 |
ws: wsPianoroll, |
|
96 |
orientation: 'vertical', |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
97 |
sceneHeight: 768-200, |
103 | 98 |
pianorolls : [ |
99 |
{ |
|
104 | 100 |
height: 200, |
103 | 101 |
timeWidth: 60, |
102 |
lineInterval: 5000, |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
103 |
noteHeight: 5, |
103 | 104 |
}, |
105 |
] |
|
106 |
}); |
|
108 | 107 |
|
103 | 108 |
var annotsRoll = new AnnotsRoll.AnnotsRoll({ |
109 |
stageView : stageView, |
|
110 |
logger: logger, |
|
111 |
ws: wsAnnot, |
|
112 |
parentContainer: doubleRollV.stage, |
|
104 | 113 |
xInit: 1024 - 200 - 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
114 |
yInit: 768-200, |
104 | 115 |
width: 200 + 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
116 |
height: 768-200, |
104 | 117 |
widthRoll: 200, |
103 | 118 |
framerate: doubleRollV.framerate, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
119 |
pixelsPerSecond: Math.floor(1024 / 60), |
108 | 120 |
annotColors: this.annotCategories |
103 | 121 |
}); |
108 | 122 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
123 |
var limiters = new PIXI.Graphics() |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
124 |
.lineStyle(1, 0x646464) |
103 | 125 |
.moveTo(annotsRoll.container.x, annotsRoll.container.y) |
126 |
.lineTo(annotsRoll.container.x, annotsRoll.container.y - annotsRoll.height) |
|
127 |
.moveTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y) |
|
128 |
.lineTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y - annotsRoll.height) |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
129 |
.moveTo(0, this.height - 200) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
130 |
.lineTo(this.width, this.height - 200) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
131 |
.drawRect(0, 0, this.width -1, this.height -1) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
132 |
.beginFill(0xECECEC) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
133 |
.drawRect(1024 - 200, 0, 200, 768-200) |
103 | 134 |
.endFill(); |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
135 |
this.container.addChild(limiters); |
108 | 136 |
|
103 | 137 |
// var doubleRollV = new DoubleRoll.DoubleRoll({}); |
108 | 138 |
|
103 | 139 |
this.init = function(){ |
108 | 140 |
|
103 | 141 |
} |
108 | 142 |
|
103 | 143 |
this.start = function() { |
144 |
}; |
|
108 | 145 |
|
103 | 146 |
this.refresh = function() { |
147 |
}; |
|
108 | 148 |
|
103 | 149 |
this.stop = function(){ |
150 |
}; |
|
108 | 151 |
|
103 | 152 |
return this; |
108 | 153 |
|
103 | 154 |
} |
155 |
||
156 |
module.exports = { |
|
157 |
AnnotsVizView: AnnotsVizView |
|
108 | 158 |
}; |