--- a/front_idill/src/mosaic/js/search.js Fri Jun 29 16:16:24 2012 +0200
+++ b/front_idill/src/mosaic/js/search.js Thu Jul 05 16:04:33 2012 +0200
@@ -28,25 +28,27 @@
inMosaic = false;
}
- this.searchCanvas = new searchCanvas(top, left, width, height, margin_top, this.timeSearchFade, inMosaic);
- this.searchCanvas.create();
+ this.searchCanvas = new searchCanvas(top, left, width, height, margin_top, this.timeSearchFade, inMosaic, this);
+ this.searchCanvas.create(this.dictionary);
+}
+
+/*
+ * Lit le dictionnaire pour reconnaître les courbes de recherche.
+*/
+mosaic.prototype.getDictionary = function()
+{
+ var path = this.config['dico'];
+ var dico = [];
- /*$(window).mousedown(function(e)
+ var _this = this;
+
+ $.getJSON(path, function(data)
{
- console.log('DOWN');
- _this.searchCanvas.onPointerIn(e.clientX, e.clientY);
- $(window).mousemove(function(e2)
+ for(var i = 0 ; i < data.gestures.length ; i++)
{
- _this.searchCanvas.onPointerMove(e2.clientX, e2.clientY);
- });
+ _this.dictionary[i] = data.gestures[i];
+ }
});
-
- $(window).mouseup(function(e)
- {
- console.log('UP');
- _this.searchCanvas.onPointerOut(e.clientX, e.clientY);
- $(window).unbind('mousemove');
- });*/
}
mosaic.prototype.listenToPointers = function()
@@ -62,7 +64,10 @@
*/
mosaic.prototype.leaveSearch = function()
{
- this.searchCanvas.leaveSearch();
+ if(this.searchCanvas)
+ {
+ this.searchCanvas.leaveSearch();
+ }
this.searchCanvas = null;
}
@@ -172,7 +177,7 @@
//On récupère la vidéo qui score le nombre d'occurences de la gesture le plus haut.
for(i in gestureNumberByVideo)
{
- console.log(i + " " + gestureNumberByVideo[i] + ' ' + type);
+ // console.log(i + " " + gestureNumberByVideo[i] + ' ' + type);
if(maxAnnotationNumber < gestureNumberByVideo[i])
{
maxAnnotationNumber = gestureNumberByVideo[i];
@@ -290,4 +295,27 @@
$('.filterHiders').remove();
$('.snapshotDivs').fadeTo(_this.config['timeFilterFade'], 1);
}
+}
+
+/*
+ * Parcours le dictionnaire pour trouver la première gesture à avoir un code identique à celui en entrée.
+*/
+mosaic.prototype.gestureWithSameCode = function(code)
+{
+ //Pour tout le dictionnaire.
+ for(var i = 0 ; i < this.dictionary.length ; i++)
+ {
+ //Pour touts les codes de chaque gesture du dictionnaire.
+ for(var j = 0 ; j < this.dictionary[i].codes.length ; j++)
+ {
+ //Si le code en entrée est une partie début d'un des codes.
+ if(this.dictionary[i].codes[j] === code)
+ {
+ //On retourne le nom de la gesture.
+ return this.dictionary[i].name;
+ }
+ }
+ }
+
+ return '';
}
\ No newline at end of file