rename components
authorymh <ymh.work@gmail.com>
Mon, 19 Jan 2015 16:44:59 +0100
changeset 97 545803e685e0
parent 96 f58715468f1e
child 98 72d767c5142d
rename components
client/annotviz/app/js/annotsRoll.js
client/annotviz/app/js/annotsroll.js
client/annotviz/app/js/annotstimeline.js
client/annotviz/app/js/generalView.js
--- a/client/annotviz/app/js/annotsRoll.js	Mon Jan 19 15:55:17 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/**
-* js/annotsRoll.js
-*
-* annotsRoll basic component
-*
-*/
-
-'use strict';
-
-var PIXI = require('pixi');
-var randomColor = require('randomColor');
-
-function AnnotsRoll(parentContainer, xInit, yInit, width, height, widthRoll, pixelsPerSecond, annotColors, lineInterval){
-    var _this = this;
-    this.container = new PIXI.DisplayObjectContainer();
-    this.container.position.x = xInit;
-    this.container.position.y = yInit;
-    this.container.width = width;
-    parentContainer.addChild(this.container);
-
-    this.height = height;
-    this.width = width;
-    this.widthRoll = widthRoll;
-    this.pixelsPerSecond = pixelsPerSecond;
-    this.lineInterval = lineInterval;
-
-    this.addAnnot = function(category, user, catColor){
-    	var graphics = new PIXI.Graphics();
-    	var color = catColor;
-    	var x = 0;
-    	var y = -this.container.y;
-        graphics.beginFill(color);
-        graphics.drawRect(x, y, 10, 3);
-        graphics.endFill();
-        
-        this.container.addChild(graphics);
-
-        var catText = new PIXI.Text(category, { font: '16pt Arial', fill: '#65A954' });
-        catText.x = x + 20;
-        catText.y = y - 23;
-        this.container.addChild(catText);
-        
-        var userText = new PIXI.Text(user, { font: '10pt Arial', fill: '#444444' });
-        userText.x = x + 20;
-        userText.y = y + 2;
-        this.container.addChild(userText);
-        
-        this.addAnnotLine(color)
-    };
-
-    this.addAnnotLine = function(color){
-    	var x = this.widthRoll;
-    	var y = -this.container.y;
-    	
-    	var graphics = new PIXI.Graphics();
-    	
-        graphics.beginFill(color);
-        graphics.drawRect(x, y, this.width - x, 3);
-        graphics.endFill();
-        
-        this.container.addChild(graphics);
-    };
-
-    this.moveTo = function(diffTime){
-    	this.container.y = Math.floor(diffTime*this.pixelsPerSecond);
-    };
-
-    this.removePassedObjets = function(){
-        var nbChilds = _this.container.children.length;
-        var i = 0, childIsNowDisplayed = false, childrenToRemove = [];
-        while(i<nbChilds && !childIsNowDisplayed){
-            var child = _this.container.children[i++];
-            
-            if(typeof(child) == 'undefined') {
-                continue;
-            }
-        	if((child.y + child.height) < (Math.abs(_this.container.y) - _this.height)){
-                childrenToRemove.push(child);
-            }
-            else {
-                childIsNowDisplayed = true;
-            }
-        }
-        childrenToRemove.forEach(function(child) {
-            _this.container.removeChild(child);
-        });
-    };
-
-	window.setInterval(this.removePassedObjets, 1000 * this.height / this.pixelsPerSecond );
-
-}
-
-module.exports = AnnotsRoll;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/annotviz/app/js/annotsroll.js	Mon Jan 19 16:44:59 2015 +0100
@@ -0,0 +1,93 @@
+/**
+* js/annotsRoll.js
+*
+* annotsRoll basic component
+*
+*/
+
+'use strict';
+
+var PIXI = require('pixi');
+var randomColor = require('randomColor');
+
+function AnnotsRoll(parentContainer, xInit, yInit, width, height, widthRoll, pixelsPerSecond, annotColors, lineInterval){
+    var _this = this;
+    this.container = new PIXI.DisplayObjectContainer();
+    this.container.position.x = xInit;
+    this.container.position.y = yInit;
+    this.container.width = width;
+    parentContainer.addChild(this.container);
+
+    this.height = height;
+    this.width = width;
+    this.widthRoll = widthRoll;
+    this.pixelsPerSecond = pixelsPerSecond;
+    this.lineInterval = lineInterval;
+
+    this.addAnnot = function(category, user, catColor){
+    	var graphics = new PIXI.Graphics();
+    	var color = catColor;
+    	var x = 0;
+    	var y = -this.container.y;
+        graphics.beginFill(color);
+        graphics.drawRect(x, y, 10, 3);
+        graphics.endFill();
+        
+        this.container.addChild(graphics);
+
+        var catText = new PIXI.Text(category, { font: '16pt Arial', fill: '#65A954' });
+        catText.x = x + 20;
+        catText.y = y - 23;
+        this.container.addChild(catText);
+        
+        var userText = new PIXI.Text(user, { font: '10pt Arial', fill: '#444444' });
+        userText.x = x + 20;
+        userText.y = y + 2;
+        this.container.addChild(userText);
+        
+        this.addAnnotLine(color)
+    };
+
+    this.addAnnotLine = function(color){
+    	var x = this.widthRoll;
+    	var y = -this.container.y;
+    	
+    	var graphics = new PIXI.Graphics();
+    	
+        graphics.beginFill(color);
+        graphics.drawRect(x, y, this.width - x, 3);
+        graphics.endFill();
+        
+        this.container.addChild(graphics);
+    };
+
+    this.moveTo = function(diffTime){
+    	this.container.y = Math.floor(diffTime*this.pixelsPerSecond);
+    };
+
+    this.removePassedObjets = function(){
+        var nbChilds = _this.container.children.length;
+        var i = 0, childIsNowDisplayed = false, childrenToRemove = [];
+        while(i<nbChilds && !childIsNowDisplayed){
+            var child = _this.container.children[i++];
+            
+            if(typeof(child) == 'undefined') {
+                continue;
+            }
+        	if((child.y + child.height) < (Math.abs(_this.container.y) - _this.height)){
+                childrenToRemove.push(child);
+            }
+            else {
+                childIsNowDisplayed = true;
+            }
+        }
+        childrenToRemove.forEach(function(child) {
+            _this.container.removeChild(child);
+        });
+    };
+
+	window.setInterval(this.removePassedObjets, 1000 * this.height / this.pixelsPerSecond );
+
+}
+
+module.exports = AnnotsRoll;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/annotviz/app/js/annotstimeline.js	Mon Jan 19 16:44:59 2015 +0100
@@ -0,0 +1,78 @@
+/**
+* js/generalView
+*
+* generalView basic component
+*
+*/
+
+'use strict';
+
+var PIXI = require('pixi');
+var randomColor = require('randomColor');
+
+function GeneralView(parentContainer, xInit, yInit, width, height, timeBegin, timeEnd, intervalSize){
+	console.log(width);
+    var _this = this;
+    this.container = new PIXI.DisplayObjectContainer();
+    this.container.position.x = xInit;
+    this.container.position.y = yInit;
+    this.container.width = width;
+    this.container.height = height;
+    parentContainer.addChild(this.container);
+
+    this.timeBegin = timeBegin;
+    this.timeEnd = timeEnd;
+    this.duration = (timeEnd - timeBegin)/1000
+    this.width = width;
+    this.height = height;
+    //define interval corresponding to the time of one step
+    //e.g: 60 for a step of 60 seconds
+    this.intervalSize = intervalSize;
+    // define the step depending the interval we passed and the duration
+    this.intervalDuration = (intervalSize*this.duration/width);
+
+  //Initialise the list of step
+    //each cell will contain the list categories and the number of annotations per categories
+    this.cells = []
+
+
+    // draw temp line to locate the middle of the container
+    var graphics = new PIXI.Graphics();
+    graphics.beginFill(0x000000);
+    graphics.lineStyle(1, 0x000000);
+    graphics.moveTo(xInit, (-this.height/2) );
+    graphics.lineTo(this.width, (-this.height/2));
+    graphics.endFill();
+    this.container.addChild(graphics);
+
+    this.addAnnot = function(category, time){
+    	var x = Math.floor( (time-this.timeBegin)/(1000*this.intervalDuration)) * this.intervalSize;
+    	var y = (-this.height/2);
+
+    	//Check if cell is already set.
+    	//If yes get increment the numbere of annots in the category corresponding
+    	//If not initialise the cell
+//    	if (this.cells[x] === "undefined"){
+//    		cells[x].push({
+//    			"code" : category.code,
+//    			"color" : category.color,
+//    			"count" : 1
+//    		});
+//    	} else {
+//    		if (c)
+//    	}
+
+    	console.log("x : " + x + " | y : " + y);
+
+    	// We draw the rectangle
+        var graphics = new PIXI.Graphics();
+        graphics.beginFill(0x536991);
+        graphics.drawRect(x, y, this.intervalSize, -10);
+        graphics.endFill();
+
+        this.container.addChild(graphics);
+    };
+
+}
+
+module.exports = GeneralView;
--- a/client/annotviz/app/js/generalView.js	Mon Jan 19 15:55:17 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/**
-* js/generalView
-*
-* generalView basic component
-*
-*/
-
-'use strict';
-
-var PIXI = require('pixi');
-var randomColor = require('randomColor');
-
-function GeneralView(parentContainer, xInit, yInit, width, height, timeBegin, timeEnd, intervalSize){
-	console.log(width);
-    var _this = this;
-    this.container = new PIXI.DisplayObjectContainer();
-    this.container.position.x = xInit;
-    this.container.position.y = yInit;
-    this.container.width = width;
-    this.container.height = height;
-    parentContainer.addChild(this.container);
-    
-    this.timeBegin = timeBegin;
-    this.timeEnd = timeEnd;
-    this.duration = (timeEnd - timeBegin)/1000 
-    this.width = width;
-    this.height = height;
-    //define interval corresponding to the time of one step
-    //e.g: 60 for a step of 60 seconds
-    this.intervalSize = intervalSize;
-    // define the step depending the interval we passed and the duration
-    this.intervalDuration = (intervalSize*this.duration/width);
-    
-  //Initialise the list of step
-    //each cell will contain the list categories and the number of annotations per categories
-    this.cells = []
-    
-    
-    // draw temp line to locate the middle of the container
-    var graphics = new PIXI.Graphics();
-    graphics.beginFill(0x000000);
-    graphics.lineStyle(1, 0x000000);
-    graphics.moveTo(xInit, (-this.height/2) );
-    graphics.lineTo(this.width, (-this.height/2));
-    graphics.endFill();
-    this.container.addChild(graphics);
-
-    this.addAnnot = function(category, time){
-    	var x = Math.floor( (time-this.timeBegin)/(1000*this.intervalDuration)) * this.intervalSize;
-    	var y = (-this.height/2);
-    	
-    	//Check if cell is already set.
-    	//If yes get increment the numbere of annots in the category corresponding
-    	//If not initialise the cell
-//    	if (this.cells[x] === "undefined"){
-//    		cells[x].push({
-//    			"code" : category.code,
-//    			"color" : category.color,
-//    			"count" : 1
-//    		});
-//    	} else {
-//    		if (c)
-//    	} 
-    	
-    	console.log("x : " + x + " | y : " + y);
-        
-    	// We draw the rectangle
-        var graphics = new PIXI.Graphics();
-        graphics.beginFill(0x536991);
-        graphics.drawRect(x, y, this.intervalSize, -10);
-        graphics.endFill();
-        
-        this.container.addChild(graphics);
-    };
-
-}
-
-module.exports = GeneralView;