client/annotviz/app/js/annotsvizview.js
changeset 121 df6b39f962bc
parent 113 7531e4180915
child 126 13d9a532a0a7
equal deleted inserted replaced
120:89544c28a364 121:df6b39f962bc
    10 var PIXI = require('pixi');
    10 var PIXI = require('pixi');
    11 var _ = require('lodash');
    11 var _ = require('lodash');
    12 var DoubleRoll = require('./doubleroll.js');
    12 var DoubleRoll = require('./doubleroll.js');
    13 var AnnotsTimeLine = require('./annotstimeline.js');
    13 var AnnotsTimeLine = require('./annotstimeline.js');
    14 var AnnotsRoll = require('./annotsroll.js');
    14 var AnnotsRoll = require('./annotsroll.js');
       
    15 var Utils = require('./utils.js');
    15 
    16 
    16 var defaultOptions = {
    17 var defaultOptions = {
    17     xInit: 0,
    18     xInit: 0,
    18     yInit: 0,
    19     yInit: 0,
    19     width: 1024,
    20     width: 1024,
    20     height: 768,
    21     height: 768,
    21     annotCategories: [
    22 //    annotCategories: [
    22     {
    23 //    {
    23         "ts": 1421928213000,
    24 //        "ts": 1421928213000,
    24         "colors": {
    25 //        "colors": {
    25             "transgressions": "#b90000",
    26 //            "transgressions": "#b90000",
    26             "rythmique": "#af931e",
    27 //            "rythmique": "#af931e",
    27             "narration": "#4bdd71",
    28 //            "narration": "#4bdd71",
    28             "relation": "#1c28ba"
    29 //            "relation": "#1c28ba"
    29         },
    30 //        },
    30         "order": [
    31 //        "order": [
    31             "transgressions",
    32 //            "transgressions",
    32             "rythmique",
    33 //            "rythmique",
    33             "narration",
    34 //            "narration",
    34             "relation"
    35 //            "relation"
    35         ],
    36 //        ],
    36         "defaultColor": "#536991"
    37 //        "defaultColor": "#536991"
    37     }]
    38 //    }]
    38 };
    39 };
    39 
    40 
    40 function AnnotsVizView(options){
    41 function AnnotsVizView(options){
    41 	var _this = this;
    42 	var _this = this;
    42     var opts = _(options).defaults(defaultOptions).value();
    43     var opts = _(options).defaults(defaultOptions).value();
    44     this.container = new PIXI.DisplayObjectContainer();
    45     this.container = new PIXI.DisplayObjectContainer();
    45     this.container.x = opts.xInit;
    46     this.container.x = opts.xInit;
    46     this.container.y = opts.yInit;
    47     this.container.y = opts.yInit;
    47 	this.width = opts.width;
    48 	this.width = opts.width;
    48 	this.height= opts.height;
    49 	this.height= opts.height;
    49     this.annotCategories = opts.annotCategories;
       
    50     this.timeBegin = opts.timeBegin;
    50     this.timeBegin = opts.timeBegin;
    51     this.timeEnd = opts.timeEnd;
    51     this.timeEnd = opts.timeEnd;
    52 
    52     
       
    53     this.annotCategories = [];
       
    54     Utils.getAnnotCategories(opts.urlCategories, this.annotCategories);
       
    55     
    53 	var wsPianoroll = opts.wsPianoroll;
    56 	var wsPianoroll = opts.wsPianoroll;
    54 	var wsAnnot = opts.wsAnnot;
    57 	var wsAnnot = opts.wsAnnot;
    55 	var stageView = opts.stageView;
    58 	var stageView = opts.stageView;
    56 
    59 
    57 	stageView.registerComponent(this);
    60 	stageView.registerComponent(this);