Commit 88a40a81 authored by Romain Loth's avatar Romain Loth

add debug traces to each function, remove trailing spaces in scripts, add...

add debug traces to each function, remove trailing spaces in scripts, add initialization call graph schema
parent 8c5a4451
// dot call_graph.dot -Tpng -o tina_call_graph.png
digraph tina_call_graph {
graph [ordering="out"];
rankdir=LR ;
edge [fontsize=10] ;
label=<<B><U>tinawebJS</U></B><BR/>(initialization callgraph)>;
labelloc="t" ;
// settings
"settings var" -> "settings:SystemStates";
"settings var" -> "settings:sigmaJsDrawingProperties";
"settings var" -> "etc.";
// getUrlParam
"t.globalUtils:getUrlParam" -> "var mainfile (url)" ;
// main 1: get graph
"t.main" -> "var mainfile (url)" ;
"var mainfile (url)" -> "ajax garg" ;
"ajax garg" -> "t.main:MainFunction" ;
// main 2: parse graph
"t.main:MainFunction" -> "t.sigma.parseCustom:ParseCustom" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:scanFile" ;
"t.sigma.parseCustom:scanFile" -> "t.sigma.parseCustom:getJSONCategories" ;
"t.sigma.parseCustom:getJSONCategories" -> "t.sigma.parseCustom:scanJSON" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:makeSystemStates" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:buildInitialState" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:makeDicts" ;
"t.sigma.parseCustom:makeDicts" -> "t.sigma.parseCustom:dictfyJSON" [label="cats={'terms':0}"] ;
// main 3: new TinaWebJS()
"t.main:MainFunction" -> "var twjs_" ;
"var twjs_" -> "t.TinawebJS:TinaWebJS:new" ;
// main 4: adjust canvas routine
"t.main:MainFunction" -> "t.TinawebJS:AdjustSigmaCanvas" ; // twjs_.AdjustSigmaCanvas()
"t.TinawebJS:AdjustSigmaCanvas" -> "t.TinawebJS:sigmaLimits" ;
"t.TinawebJS:sigmaLimits" -> "t.TinawebJS:visibleHeight" ;
"t.TinawebJS:sigmaLimits" -> "new canvas!" ;
// main 5: partialGraph and new SigmaUtils()
"t.main:MainFunction" -> "var partialGraph" ;
"var partialGraph" -> "sigma:init";
"t.main:MainFunction" -> "t.SigmaUtils:SigmaUtils:new" ;
"t.main:MainFunction" -> "t.SigmaUtils:SigmaUtils:FillGraph" ; // [ Poblating the Sigma-Graph ]
"t.SigmaUtils:SigmaUtils:FillGraph" -> "SigmaPublic.addNode" [label="x N"];
"t.SigmaUtils:SigmaUtils:FillGraph" -> "SigmaPublic.addEdge" [label="x N"];
"SigmaPublic.addEdge" -> "t.globalUtils:hex2rga" [label="x M"];
"t.SigmaUtils:SigmaUtils:FillGraph" -> "t.enviroment:updateSearchLabels" [label="N x push labels"];
// main 6: state and settings for partialGraph
// "settings:sigmaJsDrawingProperties" -> "var partialGraph" ;
// "settings:SystemStates" -> "var partialGraph" ;
"var partialGraph" -> "t.main:partialGraph:setState";
// main 7: twjs_.initListeners( categories , partialGraph)
"t.main:MainFunction" -> "t.TinawebJS:initListeners" ;
"t.TinawebJS:initListeners" -> "t.TinawebJS:SelectionEngine:new" [label="initListeners:SelInst"] ;
"t.TinawebJS:initListeners" -> "onclick:#changetype" ;
"t.TinawebJS:initListeners" -> "onclick:#changelevel" ;
"t.TinawebJS:initListeners" -> "onclick:#aUnfold" ;
"t.TinawebJS:initListeners" -> "t.minimap:startMiniMap" [label = "if minimap"] ;
"t.TinawebJS:initListeners" -> "t.methods:pushSWClick" [label = "var swclickActual"] ;
"t.TinawebJS:initListeners" -> "t.methods:cancelSelection" ;
"t.methods:cancelSelection" -> "t.methods:highlightSelectedNodes" [label = "false"] ;
"t.methods:highlightSelectedNodes" -> "t.globalUtils:is_empty" ;
"t.methods:cancelSelection" -> "erase:#names" ;
"t.methods:cancelSelection" -> "erase:#ngrams_actions" ;
"t.methods:cancelSelection" -> "erase:#topPapers" ;
"t.methods:cancelSelection" -> "erase:#opossiteNodes" ;
"t.methods:cancelSelection" -> "erase:#searchinput" ;
"t.methods:cancelSelection" -> "t.methods:LevelButtonDisable" ;
"t.TinawebJS:initListeners" -> "t.sigmaUtils:showMeSomeLabels" ;
"t.sigmaUtils:showMeSomeLabels" -> "t.sigmaUtils:getVisibleNodes" ;
"t.TinawebJS:initListeners" -> "t.TinawebJS:SearchListeners" ;
"t.TinawebJS:SearchListeners" -> "autocomplete:#searchinput" ;
"autocomplete:#searchinput" -> "t.TinawebJS:SelectionEngine:new" [label="SearchListeners:SelInst"] ;
/*t.methods:highlightSelectedNodes*/
}
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.2).draw();
SystemStates
// {
// "level": true,
// "type": [
// true
// ],
// "selections": [],
// "opposites": [],
// "categories": [
// "terms"
// ],
// "categoriesDict": {
// "terms": "0"
// },
// "LouvainFait": false
// }
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
*/ */
function newPopup(url) { function newPopup(url) {
console.log('FUN extras_explorerjs:newPopup')
popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no') popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
} }
function getIDFromURL( item ) { function getIDFromURL( item ) {
console.log('FUN extras_explorerjs:getIDFromURL')
var pageurl = window.location.href.split("/") var pageurl = window.location.href.split("/")
var cid; var cid;
for(var i in pageurl) { for(var i in pageurl) {
...@@ -20,6 +22,7 @@ function getIDFromURL( item ) { ...@@ -20,6 +22,7 @@ function getIDFromURL( item ) {
} }
function modify_ngrams( classname ) { function modify_ngrams( classname ) {
console.log('FUN extras_explorerjs:modify_ngrams')
console.clear() console.clear()
var corpus_id = getIDFromURL( "corpora" ) // not used var corpus_id = getIDFromURL( "corpora" ) // not used
...@@ -54,6 +57,7 @@ function modify_ngrams( classname ) { ...@@ -54,6 +57,7 @@ function modify_ngrams( classname ) {
} }
function CRUD( parent_id , action , nodes , args , http_method , callback) { function CRUD( parent_id , action , nodes , args , http_method , callback) {
console.log('FUN extras_explorerjs:CRUD')
var the_url = window.location.origin+"/api/node/"+parent_id+"/ngrams"+action+"/"+nodes.join("+"); var the_url = window.location.origin+"/api/node/"+parent_id+"/ngrams"+action+"/"+nodes.join("+");
the_url = the_url.replace(/\/$/, ""); //remove trailing slash the_url = the_url.replace(/\/$/, ""); //remove trailing slash
console.log( the_url ) console.log( the_url )
...@@ -87,6 +91,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -87,6 +91,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
// then, add the button in the html with the sigmaUtils.clustersBy(x) listener. // then, add the button in the html with the sigmaUtils.clustersBy(x) listener.
//TODO: move to ClustersPlugin.js or smntng //TODO: move to ClustersPlugin.js or smntng
function ChangeGraphAppearanceByAtt( manualflag ) { function ChangeGraphAppearanceByAtt( manualflag ) {
console.log('FUN extras_explorerjs:ChangeGraphAppearanceByAtt')
if ( !isUndef(manualflag) && !colorByAtt ) colorByAtt = manualflag; if ( !isUndef(manualflag) && !colorByAtt ) colorByAtt = manualflag;
if(!colorByAtt) return; if(!colorByAtt) return;
...@@ -225,6 +230,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -225,6 +230,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
// then, it runs external library jLouvain() // then, it runs external library jLouvain()
//TODO: move to ClustersPlugin.js or smntng //TODO: move to ClustersPlugin.js or smntng
function RunLouvain() { function RunLouvain() {
console.log('FUN extras_explorerjs:RunLouvain')
var node_realdata = [] var node_realdata = []
var nodesV = getVisibleNodes() var nodesV = getVisibleNodes()
...@@ -251,6 +257,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -251,6 +257,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
// Highlight nodes belonging to cluster_i when you click in thecluster_i of the legend // Highlight nodes belonging to cluster_i when you click in thecluster_i of the legend
//TODO: move to ClustersPlugin.js or smntng //TODO: move to ClustersPlugin.js or smntng
function HoverCluster( ClusterCode ) { function HoverCluster( ClusterCode ) {
console.log('FUN extras_explorerjs:HoverCluster')
console.log( ClusterCode ) console.log( ClusterCode )
var raw = ClusterCode.split("||") var raw = ClusterCode.split("||")
...@@ -338,6 +345,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -338,6 +345,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
// daclass = "clust_default" | "clust_louvain" | "clust_x" ... // daclass = "clust_default" | "clust_louvain" | "clust_x" ...
//TODO: move to ClustersPlugin.js or smntng //TODO: move to ClustersPlugin.js or smntng
function set_ClustersLegend ( daclass ) { function set_ClustersLegend ( daclass ) {
console.log('FUN extras_explorerjs:set_ClustersLegend')
//partialGraph.states.slice(-1)[0].LouvainFait = true //partialGraph.states.slice(-1)[0].LouvainFait = true
if( daclass=="clust_default" && Clusters.length==0) if( daclass=="clust_default" && Clusters.length==0)
...@@ -399,6 +407,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -399,6 +407,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
// PHP-mode when you've a cortext db. // PHP-mode when you've a cortext db.
function getTopPapers_OriginalVersion(type){ function getTopPapers_OriginalVersion(type){
console.log('FUN extras_explorerjs:getTopPapers_OriginalVersion')
if(getAdditionalInfo){ if(getAdditionalInfo){
jsonparams=JSON.stringify(getSelections()); jsonparams=JSON.stringify(getSelections());
bi=(Object.keys(categories).length==2)?1:0; bi=(Object.keys(categories).length==2)?1:0;
...@@ -430,7 +439,7 @@ function getTopPapers_OriginalVersion(type){ ...@@ -430,7 +439,7 @@ function getTopPapers_OriginalVersion(type){
// PHP-mode when you've a cortext db. // PHP-mode when you've a cortext db.
function getTopProposals(type , jsonparams , thisgexf) { function getTopProposals(type , jsonparams , thisgexf) {
console.log('FUN extras_explorerjs:getTopProposals')
type = "semantic"; type = "semantic";
if(swclickActual=="social") { if(swclickActual=="social") {
nodesA = [] nodesA = []
...@@ -486,6 +495,7 @@ function getTopProposals(type , jsonparams , thisgexf) { ...@@ -486,6 +495,7 @@ function getTopProposals(type , jsonparams , thisgexf) {
// Just for Garg // Just for Garg
function genericGetTopPapers(theids , corpus_id , thediv) { function genericGetTopPapers(theids , corpus_id , thediv) {
console.log('FUN extras_explorerjs:genericGetTopPapers')
if(getAdditionalInfo) { if(getAdditionalInfo) {
$("#"+thediv).show(); $("#"+thediv).show();
$.ajax({ $.ajax({
...@@ -546,6 +556,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) { ...@@ -546,6 +556,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
// Just for Garg: woops, override // Just for Garg: woops, override
function getTopPapers(type){ function getTopPapers(type){
console.log('FUN extras_explorerjs:getTopPapers')
if(getAdditionalInfo){ if(getAdditionalInfo){
$("#topPapers").show(); $("#topPapers").show();
...@@ -645,6 +656,7 @@ function getTopPapers(type){ ...@@ -645,6 +656,7 @@ function getTopPapers(type){
} }
function getCookie(name) { function getCookie(name) {
console.log('FUN extras_explorerjs:getCookie')
var cookieValue = null; var cookieValue = null;
if (document.cookie && document.cookie != '') { if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';'); var cookies = document.cookie.split(';');
...@@ -661,6 +673,7 @@ function getCookie(name) { ...@@ -661,6 +673,7 @@ function getCookie(name) {
} }
// Just for Garg // Just for Garg
function printCorpuses() { function printCorpuses() {
console.log('FUN extras_explorerjs:printCorpuses')
console.clear() console.clear()
console.log( "!!!!!!!! in printCorpuses() !!!!!!!! " ) console.log( "!!!!!!!! in printCorpuses() !!!!!!!! " )
pr(corpusesList) pr(corpusesList)
...@@ -782,6 +795,7 @@ function printCorpuses() { ...@@ -782,6 +795,7 @@ function printCorpuses() {
// Just for Garg // Just for Garg
function GetUserPortfolio() { function GetUserPortfolio() {
console.log('FUN extras_explorerjs:GetUserPortfolio')
//http://localhost:8000/api/corpusintersection/1a50317a50145 //http://localhost:8000/api/corpusintersection/1a50317a50145
var pageurl = window.location.href.split("/") var pageurl = window.location.href.split("/")
var pid; var pid;
...@@ -865,6 +879,7 @@ function GetUserPortfolio() { ...@@ -865,6 +879,7 @@ function GetUserPortfolio() {
} }
function camaraButton(){ function camaraButton(){
console.log('FUN extras_explorerjs:camaraButton')
$("#PhotoGraph").click(function (){ $("#PhotoGraph").click(function (){
//canvas=partialGraph._core.domElements.nodes; //canvas=partialGraph._core.domElements.nodes;
...@@ -917,6 +932,7 @@ function camaraButton(){ ...@@ -917,6 +932,7 @@ function camaraButton(){
} }
function getTips(){ function getTips(){
console.log('FUN extras_explorerjs:getTips')
param=''; param='';
text = text =
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
* Customize as you want ;) * Customize as you want ;)
*/ */
console.log('FUN settings_explorerjs:main')
// ============ < DEVELOPER OPTIONS > ============ // ============ < DEVELOPER OPTIONS > ============
var geomap=false; var geomap=false;
var colorByAtt = false; var colorByAtt = false;
...@@ -268,4 +270,3 @@ var RVUniformC = function(seed){ ...@@ -268,4 +270,3 @@ var RVUniformC = function(seed){
}; };
} }
//unifCont = new RVUniformC(100000000) //unifCont = new RVUniformC(100000000)
function scanDataFolder(){ function scanDataFolder(){
console.log('FUN t.DataScanner:scanDataFolder')
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'php/DirScan_main.php', url: 'php/DirScan_main.php',
...@@ -17,16 +18,19 @@ function scanDataFolder(){ ...@@ -17,16 +18,19 @@ function scanDataFolder(){
} }
function getGexfPath(v){ function getGexfPath(v){
console.log('FUN t.DataScanner:getGexfPath')
gexfpath=(gexfDictReverse[v])?gexfDictReverse[v]:v; gexfpath=(gexfDictReverse[v])?gexfDictReverse[v]:v;
return gexfpath; return gexfpath;
} }
function getGexfLegend(gexfPath){ function getGexfLegend(gexfPath){
console.log('FUN t.DataScanner:getGexfLegend')
legend=(gexfDict[gexfPath])?gexfDict[gexfPath]:gexfPath; legend=(gexfDict[gexfPath])?gexfDict[gexfPath]:gexfPath;
return legend; return legend;
} }
function jsActionOnGexfSelector(gexfLegend){ function jsActionOnGexfSelector(gexfLegend){
console.log('FUN t.DataScanner:jsActionOnGexfSelector')
if(getGexfPath[gexfLegend]) if(getGexfPath[gexfLegend])
window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent(getGexfPath(gexfLegend)); window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent(getGexfPath(gexfLegend));
else else
...@@ -34,6 +38,7 @@ function jsActionOnGexfSelector(gexfLegend){ ...@@ -34,6 +38,7 @@ function jsActionOnGexfSelector(gexfLegend){
} }
function listGexfs(){ function listGexfs(){
console.log('FUN t.DataScanner:listGexfs')
divlen=$("#gexfs").length; divlen=$("#gexfs").length;
if(divlen>0) { if(divlen>0) {
param = JSON.stringify(gexfDict); param = JSON.stringify(gexfDict);
......
// Function.prototype.index // Function.prototype.index
(function(reComments, reParams, reNames) { (function(reComments, reParams, reNames) {
Function.prototype.index = function(arrParamNames) { Function.prototype.index = function(arrParamNames) {
console.log('FUN t.TinawebJS:Function=>index')
var fnMe = this; var fnMe = this;
arrParamNames = arrParamNames arrParamNames = arrParamNames
|| (((fnMe + '').replace(reComments, '') || (((fnMe + '').replace(reComments, '')
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
); );
$.fn.visibleHeight = function() { $.fn.visibleHeight = function() {
console.log('FUN t.TinawebJS:visibleHeight')
var elBottom, elTop, scrollBot, scrollTop, visibleBottom, visibleTop; var elBottom, elTop, scrollBot, scrollTop, visibleBottom, visibleTop;
scrollTop = $(window).scrollTop(); scrollTop = $(window).scrollTop();
scrollBot = scrollTop + $(window).height(); scrollBot = scrollTop + $(window).height();
...@@ -34,6 +36,7 @@ $.fn.visibleHeight = function() { ...@@ -34,6 +36,7 @@ $.fn.visibleHeight = function() {
// for new SigmaUtils // for new SigmaUtils
function sigmaLimits( sigmacanvas ) { function sigmaLimits( sigmacanvas ) {
console.log('FUN t.TinawebJS:sigmaLimits')
pw=$( sigmacanvas ).width(); pw=$( sigmacanvas ).width();
ph=$( sigmacanvas ).height(); ph=$( sigmacanvas ).height();
// $("body").css("padding-top",0) // $("body").css("padding-top",0)
...@@ -59,8 +62,10 @@ function sigmaLimits( sigmacanvas ) { ...@@ -59,8 +62,10 @@ function sigmaLimits( sigmacanvas ) {
SelectionEngine = function() { SelectionEngine = function() {
console.log('FUN t.TinawebJS:SelectionEngine:new')
// Selection Engine!! finally... // Selection Engine!! finally...
this.SelectorEngine_part01 = (function(cursorsize, area ) { this.SelectorEngine_part01 = (function(cursorsize, area ) {
console.log('FUN t.TinawebJS:SelectionEngine:SelectorEngine_part01')
var clickedNodes = [] var clickedNodes = []
if(cursorsize>0) { if(cursorsize>0) {
clickedNodes = this.SelectThis2( area ) clickedNodes = this.SelectThis2( area )
...@@ -75,7 +80,7 @@ SelectionEngine = function() { ...@@ -75,7 +80,7 @@ SelectionEngine = function() {
}).index(); }).index();
this.SelectorEngine_part02 = (function( addvalue , clicktype , prevsels , currsels ) { this.SelectorEngine_part02 = (function( addvalue , clicktype , prevsels , currsels ) {
console.log('FUN t.TinawebJS:SelectionEngine:SelectorEngine_part02')
print("Add[]:") print("Add[]:")
print(addvalue) print(addvalue)
print("clicktype:") print("clicktype:")
...@@ -132,6 +137,7 @@ SelectionEngine = function() { ...@@ -132,6 +137,7 @@ SelectionEngine = function() {
}).index(); }).index();
this.SelectorEngine = (function( cursorsize , area , addvalue , clicktype , prevsels , currsels ) { this.SelectorEngine = (function( cursorsize , area , addvalue , clicktype , prevsels , currsels ) {
console.log('FUN t.TinawebJS:SelectionEngine:SelectorEngine')
var targeted = [] var targeted = []
var buffer = Object.keys(prevsels).map(Number).sort(this.sortNumber); var buffer = Object.keys(prevsels).map(Number).sort(this.sortNumber);
...@@ -203,6 +209,7 @@ SelectionEngine = function() { ...@@ -203,6 +209,7 @@ SelectionEngine = function() {
// uses: SelectorEngine() and MultipleSelection2() // uses: SelectorEngine() and MultipleSelection2()
this.search = function(string) { this.search = function(string) {
console.log('FUN t.TinawebJS:SelectionEngine:search')
var id_node = ''; var id_node = '';
var results = find(string) var results = find(string)
...@@ -233,6 +240,7 @@ SelectionEngine = function() { ...@@ -233,6 +240,7 @@ SelectionEngine = function() {
//Util //Util
this.intersect_safe = function(a, b) { this.intersect_safe = function(a, b) {
console.log('FUN t.TinawebJS:SelectionEngine:intersect_safe')
var ai=0, bi=0; var ai=0, bi=0;
var result = new Array(); var result = new Array();
...@@ -251,6 +259,7 @@ SelectionEngine = function() { ...@@ -251,6 +259,7 @@ SelectionEngine = function() {
// return Nodes-ids under the clicked Area // return Nodes-ids under the clicked Area
// external usage : partialGraph // external usage : partialGraph
this.SelectThis2 = function( area ) { this.SelectThis2 = function( area ) {
console.log('FUN t.TinawebJS:SelectionEngine:SelectThis2')
var x1 = area.x1; var x1 = area.x1;
var y1 = area.y1; var y1 = area.y1;
...@@ -274,8 +283,8 @@ SelectionEngine = function() { ...@@ -274,8 +283,8 @@ SelectionEngine = function() {
// external usage : partialGraph , updateLeftPanel_fix(); // external usage : partialGraph , updateLeftPanel_fix();
this.MultipleSelection2 = (function(nodes,nodesDict,edgesDict) { this.MultipleSelection2 = (function(nodes,nodesDict,edgesDict) {
console.log('FUN t.TinawebJS:SelectionEngine:MultipleSelection2')
pr("IN SelectionEngine.MultipleSelection2:") // pr("IN SelectionEngine.MultipleSelection2:")
print(nodes) print(nodes)
greyEverything(); greyEverything();
...@@ -371,6 +380,7 @@ SelectionEngine = function() { ...@@ -371,6 +380,7 @@ SelectionEngine = function() {
}; };
TinaWebJS = function ( sigmacanvas ) { TinaWebJS = function ( sigmacanvas ) {
console.log('FUN t.TinawebJS:TinaWebJS:new')
this.sigmacanvas = sigmacanvas; this.sigmacanvas = sigmacanvas;
this.init = function () { this.init = function () {
...@@ -378,10 +388,12 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -378,10 +388,12 @@ TinaWebJS = function ( sigmacanvas ) {
} }
this.getSigmaCanvas = function () { this.getSigmaCanvas = function () {
console.log('FUN t.TinawebJS:getSigmaCanvas')
return this.sigmacanvas; return this.sigmacanvas;
} }
this.AdjustSigmaCanvas = function ( sigmacanvas ) { this.AdjustSigmaCanvas = function ( sigmacanvas ) {
console.log('FUN t.TinawebJS:AdjustSigmaCanvas')
var canvasdiv = ""; var canvasdiv = "";
if( sigmacanvas ) canvasdiv = sigmacanvas; if( sigmacanvas ) canvasdiv = sigmacanvas;
else canvasdiv = this.sigmacanvas; else canvasdiv = this.sigmacanvas;
...@@ -390,7 +402,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -390,7 +402,7 @@ TinaWebJS = function ( sigmacanvas ) {
} }
this.SearchListeners = function () { this.SearchListeners = function () {
console.log('FUN t.TinawebJS:SearchListeners')
var SelInst = new SelectionEngine(); var SelInst = new SelectionEngine();
$.ui.autocomplete.prototype._renderItem = function(ul, item) { $.ui.autocomplete.prototype._renderItem = function(ul, item) {
...@@ -511,7 +523,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -511,7 +523,7 @@ TinaWebJS = function ( sigmacanvas ) {
// external usage: SelectorEngine*() , MultipleSelection2() , // external usage: SelectorEngine*() , MultipleSelection2() ,
// enviroment.js:changeType()|changeLevel()|NodeWeightFilter()|EdgeWeightFilter // enviroment.js:changeType()|changeLevel()|NodeWeightFilter()|EdgeWeightFilter
this.initListeners = function (categories, partialGraph) { this.initListeners = function (categories, partialGraph) {
console.log('FUN t.TinawebJS:initListeners')
var SelInst = new SelectionEngine(); var SelInst = new SelectionEngine();
$("#semLoader").hide(); $("#semLoader").hide();
...@@ -809,4 +821,3 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -809,4 +821,3 @@ TinaWebJS = function ( sigmacanvas ) {
} }
}; };
// Mathieu Jacomy @ Sciences Po Médialab & WebAtlas // Mathieu Jacomy @ Sciences Po Médialab & WebAtlas
var ForceAtlas2 = function(graph) { var ForceAtlas2 = function(graph) {
console.log('FUN t.asyncFA2:ForceAtlas2')
var self = this; var self = this;
this.graph = graph; this.graph = graph;
...@@ -31,6 +32,7 @@ var ForceAtlas2 = function(graph) { ...@@ -31,6 +32,7 @@ var ForceAtlas2 = function(graph) {
// Runtime (the ForceAtlas2 itself) // Runtime (the ForceAtlas2 itself)
this.init = function() { this.init = function() {
console.log('FUN t.asyncFA2:init')
self.state = {step: 0, index: 0}; self.state = {step: 0, index: 0};
self.graph.nodes.forEach(function(n) { self.graph.nodes.forEach(function(n) {
n.fa2 = { n.fa2 = {
...@@ -46,10 +48,12 @@ var ForceAtlas2 = function(graph) { ...@@ -46,10 +48,12 @@ var ForceAtlas2 = function(graph) {
} }
this.go = function() { this.go = function() {
console.log('FUN t.asyncFA2:go')
while (self.onebucle()) {} while (self.onebucle()) {}
} }
this.onebucle = function() { this.onebucle = function() {
console.log('FUN t.asyncFA2:onebucle')
var graph = self.graph; var graph = self.graph;
var nodes = graph.nodes; var nodes = graph.nodes;
var edges = graph.edges; var edges = graph.edges;
...@@ -346,6 +350,7 @@ var ForceAtlas2 = function(graph) { ...@@ -346,6 +350,7 @@ var ForceAtlas2 = function(graph) {
} }
this.end = function() { this.end = function() {
console.log('FUN t.asyncFA2:end')
this.graph.nodes.forEach(function(n) { this.graph.nodes.forEach(function(n) {
n.fa2 = null; n.fa2 = null;
}); });
...@@ -353,6 +358,7 @@ var ForceAtlas2 = function(graph) { ...@@ -353,6 +358,7 @@ var ForceAtlas2 = function(graph) {
// Auto Settings // Auto Settings
this.setAutoSettings = function() { this.setAutoSettings = function() {
console.log('FUN t.asyncFA2:setAutoSettings')
var graph = this.graph; var graph = this.graph;
// Tuning // Tuning
...@@ -833,6 +839,7 @@ var ForceAtlas2 = function(graph) { ...@@ -833,6 +839,7 @@ var ForceAtlas2 = function(graph) {
var updateMassAndGeometry = function() { var updateMassAndGeometry = function() {
console.log('FUN t.asyncFA2:updateMassAndGeometry')
if (this.nodes.length > 1) { if (this.nodes.length > 1) {
// Compute Mass // Compute Mass
var mass = 0; var mass = 0;
...@@ -885,6 +892,7 @@ var Region = function(nodes, depth) { ...@@ -885,6 +892,7 @@ var Region = function(nodes, depth) {
var buildSubRegions = function() { var buildSubRegions = function() {
console.log('FUN t.asyncFA2:buildSubRegions')
if (this.nodes.length > 1) { if (this.nodes.length > 1) {
var leftNodes = []; var leftNodes = [];
var rightNodes = []; var rightNodes = [];
...@@ -936,6 +944,7 @@ var buildSubRegions = function() { ...@@ -936,6 +944,7 @@ var buildSubRegions = function() {
}; };
var applyForce = function(n, Force, theta) { var applyForce = function(n, Force, theta) {
console.log('FUN t.asyncFA2:applyForce')
if (this.nodes.length < 2) { if (this.nodes.length < 2) {
var regionNode = this.nodes[0]; var regionNode = this.nodes[0];
Force.apply_nn(n, regionNode); Force.apply_nn(n, regionNode);
...@@ -958,6 +967,7 @@ var applyForce = function(n, Force, theta) { ...@@ -958,6 +967,7 @@ var applyForce = function(n, Force, theta) {
}; };
var startForceAtlas2 = function(graph,limit_it) { var startForceAtlas2 = function(graph,limit_it) {
console.log('FUN t.asyncFA2:startForceAtlas2')
// pr("inside FA2") // pr("inside FA2")
//// if(!this.forceatlas2) { //// if(!this.forceatlas2) {
// pr(graph); // pr(graph);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
//============================ < NEW BUTTONS > =============================// //============================ < NEW BUTTONS > =============================//
function changeType_old() { function changeType_old() {
console.log('FUN t.enviroment:changeType_old')
pr("***swclickActual:"+swclickActual+" , swMacro:"+swMacro); pr("***swclickActual:"+swclickActual+" , swMacro:"+swMacro);
if(swclickActual=="social") { if(swclickActual=="social") {
...@@ -118,6 +119,7 @@ function changeType_old() { ...@@ -118,6 +119,7 @@ function changeType_old() {
function changeType() { function changeType() {
console.log('FUN t.enviroment:changeType')
var present = partialGraph.states.slice(-1)[0]; // Last var present = partialGraph.states.slice(-1)[0]; // Last
var past = partialGraph.states.slice(-2)[0] // avant Last var past = partialGraph.states.slice(-2)[0] // avant Last
var lastpos = partialGraph.states.length-1; var lastpos = partialGraph.states.length-1;
...@@ -375,6 +377,7 @@ function changeType() { ...@@ -375,6 +377,7 @@ function changeType() {
} }
function changeLevel() { function changeLevel() {
console.log('FUN t.enviroment:changeLevel')
var present = partialGraph.states.slice(-1)[0]; // Last var present = partialGraph.states.slice(-1)[0]; // Last
var past = partialGraph.states.slice(-2)[0] // avant Last var past = partialGraph.states.slice(-2)[0] // avant Last
var lastpos = partialGraph.states.length-1; var lastpos = partialGraph.states.length-1;
...@@ -501,6 +504,7 @@ function changeLevel() { ...@@ -501,6 +504,7 @@ function changeLevel() {
} }
function changeLevel_old() { function changeLevel_old() {
console.log('FUN t.enviroment:changeLevel_old')
bf=swclickActual bf=swclickActual
pushSWClick(swclickActual); pushSWClick(swclickActual);
pr("swMacro: "+swMacro+" - [swclickPrev: "+bf+"] - [swclickActual: "+swclickActual+"]") pr("swMacro: "+swMacro+" - [swclickPrev: "+bf+"] - [swclickActual: "+swclickActual+"]")
...@@ -549,6 +553,7 @@ function changeLevel_old() { ...@@ -549,6 +553,7 @@ function changeLevel_old() {
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight"); // EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); // EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
console.log('FUN t.enviroment:EdgeWeightFilter')
// console.log("") // console.log("")
// console.log("") // console.log("")
// console.log(" - - - - EdgeWeightFilter - - - ") // console.log(" - - - - EdgeWeightFilter - - - ")
...@@ -760,6 +765,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -760,6 +765,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size") // NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size") // NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function NodeWeightFilter( categories , sliderDivID , type_attrb , type , criteria) { function NodeWeightFilter( categories , sliderDivID , type_attrb , type , criteria) {
console.log('FUN t.enviroment:NodeWeightFilter')
// if ($(sliderDivID).html()!="") { // if ($(sliderDivID).html()!="") {
// pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]") // pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
...@@ -873,6 +879,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -873,6 +879,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
} }
function getGraphElement(elem) { function getGraphElement(elem) {
console.log('FUN t.enviroment:getGraphElement')
if(elem.split(";").length==1) return partialGraph._core.graph.nodesIndex[elem]; if(elem.split(";").length==1) return partialGraph._core.graph.nodesIndex[elem];
else { else {
if(!isUndef(partialGraph._core.graph.edgesIndex[elem])) if(!isUndef(partialGraph._core.graph.edgesIndex[elem]))
...@@ -889,6 +896,7 @@ function getGraphElement(elem) { ...@@ -889,6 +896,7 @@ function getGraphElement(elem) {
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
function AlgorithmForSliders( elements , type_attrb , type , criteria) { function AlgorithmForSliders( elements , type_attrb , type , criteria) {
console.log('FUN t.enviroment:AlgorithmForSliders')
// console.clear() // console.clear()
// console.log( "\t - - - - - AlgorithmForSliders - - - - -" ) // console.log( "\t - - - - - AlgorithmForSliders - - - - -" )
// console.log( "" ) // console.log( "" )
...@@ -995,6 +1003,7 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) { ...@@ -995,6 +1003,7 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
//============================= < SEARCH > =============================// //============================= < SEARCH > =============================//
function updateSearchLabels(id,name,type){ function updateSearchLabels(id,name,type){
console.log('FUN t.enviroment:updateSearchLabels')
labels.push({ labels.push({
'id' : id, 'id' : id,
'label' : name, 'label' : name,
...@@ -1003,6 +1012,7 @@ function updateSearchLabels(id,name,type){ ...@@ -1003,6 +1012,7 @@ function updateSearchLabels(id,name,type){
} }
function extractContext(string, context) { function extractContext(string, context) {
console.log('FUN t.enviroment:extractContext')
var matched = string.toLowerCase().indexOf(context.toLowerCase()); var matched = string.toLowerCase().indexOf(context.toLowerCase());
if (matched == -1) if (matched == -1)
...@@ -1033,6 +1043,7 @@ function extractContext(string, context) { ...@@ -1033,6 +1043,7 @@ function extractContext(string, context) {
} }
function searchLabel(string){ function searchLabel(string){
console.log('FUN t.enviroment:searchLabel')
var id_node = ''; var id_node = '';
var n; var n;
......
...@@ -10,6 +10,7 @@ function print(msg) { ...@@ -10,6 +10,7 @@ function print(msg) {
//to general utils //to general utils
function getClientTime(){ function getClientTime(){
console.log('FUN t.globalUtils:getClientTime')
var totalSec = new Date().getTime() / 1000; var totalSec = new Date().getTime() / 1000;
var d = new Date(); var d = new Date();
var hours = d.getHours(); var hours = d.getHours();
...@@ -20,11 +21,13 @@ function getClientTime(){ ...@@ -20,11 +21,13 @@ function getClientTime(){
} }
function compareNumbers(a, b) { function compareNumbers(a, b) {
console.log('FUN t.globalUtils:compareNumbers')
return a - b; return a - b;
} }
//python range(a,b) | range(a) //python range(a,b) | range(a)
function calc_range(begin, end) { function calc_range(begin, end) {
console.log('FUN t.globalUtils:calc_range')
if (typeof end === "undefined") { if (typeof end === "undefined") {
end = begin; begin = 0; end = begin; begin = 0;
} }
...@@ -38,6 +41,7 @@ function calc_range(begin, end) { ...@@ -38,6 +41,7 @@ function calc_range(begin, end) {
//to general utils (not used btw) //to general utils (not used btw)
function cloneObject(source) { function cloneObject(source) {
console.log('FUN t.globalUtils:cloneObject')
for (i in source) { for (i in source) {
if (typeof source[i] == 'source') { if (typeof source[i] == 'source') {
this[i] = new cloneObject(source[i]); this[i] = new cloneObject(source[i]);
...@@ -49,12 +53,14 @@ function cloneObject(source) { ...@@ -49,12 +53,14 @@ function cloneObject(source) {
} }
function isUndef(variable){ function isUndef(variable){
// console.log('FUN t.globalUtils:isUndef')
if(typeof(variable)==="undefined") return true; if(typeof(variable)==="undefined") return true;
else return false; else return false;
} }
$.fn.toggleClick = function(){ $.fn.toggleClick = function(){
console.log('FUN t.globalUtils:toggleClick')
methods = arguments, // store the passed arguments for future reference methods = arguments, // store the passed arguments for future reference
count = methods.length; // cache the number of methods count = methods.length; // cache the number of methods
...@@ -71,6 +77,7 @@ $.fn.toggleClick = function(){ ...@@ -71,6 +77,7 @@ $.fn.toggleClick = function(){
getUrlParam = (function () { getUrlParam = (function () {
console.log('FUN t.globalUtils:getUrlParam')
var get = { var get = {
push:function (key,value){ push:function (key,value){
var cur = this[key]; var cur = this[key];
...@@ -101,6 +108,7 @@ getUrlParam = (function () { ...@@ -101,6 +108,7 @@ getUrlParam = (function () {
function ArraySortByValue(array, sortFunc){ function ArraySortByValue(array, sortFunc){
console.log('FUN t.globalUtils:ArraySortByValue')
var tmp = []; var tmp = [];
oposMAX=0; oposMAX=0;
for (var k in array) { for (var k in array) {
...@@ -122,6 +130,7 @@ function ArraySortByValue(array, sortFunc){ ...@@ -122,6 +130,7 @@ function ArraySortByValue(array, sortFunc){
function ArraySortByKey(array, sortFunc){ function ArraySortByKey(array, sortFunc){
console.log('FUN t.globalUtils:ArraySortByKey')
var tmp = []; var tmp = [];
for (var k in array) { for (var k in array) {
if (array.hasOwnProperty(k)) { if (array.hasOwnProperty(k)) {
...@@ -140,6 +149,7 @@ function ArraySortByKey(array, sortFunc){ ...@@ -140,6 +149,7 @@ function ArraySortByKey(array, sortFunc){
function is_empty(obj) { function is_empty(obj) {
console.log('FUN t.globalUtils:is_empty')
// Assume if it has a length property with a non-zero value // Assume if it has a length property with a non-zero value
// that that property is correct. // that that property is correct.
if (obj.length && obj.length > 0) return false; if (obj.length && obj.length > 0) return false;
...@@ -153,12 +163,14 @@ function is_empty(obj) { ...@@ -153,12 +163,14 @@ function is_empty(obj) {
function getByID(elem) { function getByID(elem) {
console.log('FUN t.globalUtils:getByID')
return document.getElementById(elem); return document.getElementById(elem);
} }
function hex2rga(sent_hex) { function hex2rga(sent_hex) {
// console.log('FUN t.globalUtils:hex2rga')
result = [] result = []
hex = ( sent_hex.charAt(0) === "#" ? sent_hex.substr(1) : sent_hex ); hex = ( sent_hex.charAt(0) === "#" ? sent_hex.substr(1) : sent_hex );
// check if 6 letters are provided // check if 6 letters are provided
...@@ -173,6 +185,7 @@ function hex2rga(sent_hex) { ...@@ -173,6 +185,7 @@ function hex2rga(sent_hex) {
} }
function calculateFull(hex) { function calculateFull(hex) {
// console.log('FUN t.globalUtils:calculateFull')
var r = parseInt(hex.substring(0, 2), 16); var r = parseInt(hex.substring(0, 2), 16);
var g = parseInt(hex.substring(2, 4), 16); var g = parseInt(hex.substring(2, 4), 16);
var b = parseInt(hex.substring(4, 6), 16); var b = parseInt(hex.substring(4, 6), 16);
...@@ -182,6 +195,7 @@ function calculateFull(hex) { ...@@ -182,6 +195,7 @@ function calculateFull(hex) {
// function for calculating 3 letters hex value // function for calculating 3 letters hex value
function calculatePartial(hex) { function calculatePartial(hex) {
console.log('FUN t.globalUtils:calculatePartial')
var r = parseInt(hex.substring(0, 1) + hex.substring(0, 1), 16); var r = parseInt(hex.substring(0, 1) + hex.substring(0, 1), 16);
var g = parseInt(hex.substring(1, 2) + hex.substring(1, 2), 16); var g = parseInt(hex.substring(1, 2) + hex.substring(1, 2), 16);
var b = parseInt(hex.substring(2, 3) + hex.substring(2, 3), 16); var b = parseInt(hex.substring(2, 3) + hex.substring(2, 3), 16);
...@@ -189,11 +203,13 @@ function calculatePartial(hex) { ...@@ -189,11 +203,13 @@ function calculatePartial(hex) {
} }
function componentToHex(c) { function componentToHex(c) {
console.log('FUN t.globalUtils:componentToHex')
var hex = c.toString(16); var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex; return hex.length == 1 ? "0" + hex : hex;
} }
function rgbToHex(r, g, b) { function rgbToHex(r, g, b) {
console.log('FUN t.globalUtils:rgbToHex')
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
} }
...@@ -202,6 +218,7 @@ function rgbToHex(r, g, b) { ...@@ -202,6 +218,7 @@ function rgbToHex(r, g, b) {
* function to load a given css file * function to load a given css file
*/ */
loadCSS = function(href) { loadCSS = function(href) {
console.log('FUN t.globalUtils:loadCSS')
var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>"); var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>");
$("head").append(cssLink); $("head").append(cssLink);
}; };
...@@ -210,6 +227,7 @@ function rgbToHex(r, g, b) { ...@@ -210,6 +227,7 @@ function rgbToHex(r, g, b) {
* function to load a given js file * function to load a given js file
*/ */
loadJS = function(src) { loadJS = function(src) {
console.log('FUN t.globalUtils:loadJS')
var jsLink = $("<script type='text/javascript' src='"+src+"'>"); var jsLink = $("<script type='text/javascript' src='"+src+"'>");
$("head").append(jsLink); $("head").append(jsLink);
}; };
...@@ -8,6 +8,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -8,6 +8,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
*/ */
(function(){ (function(){
jLouvain = function(){ jLouvain = function(){
console.log('FUN t.jLouvain:jLouvain')
//Constants //Constants
var __PASS_MAX = -1 var __PASS_MAX = -1
var __MIN = 0.0000001 var __MIN = 0.0000001
...@@ -115,6 +116,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -115,6 +116,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
//Core-Algorithm Related //Core-Algorithm Related
function init_status(graph, status, part){ function init_status(graph, status, part){
console.log('FUN t.jLouvain:init_status')
status['nodes_to_com'] = {}; status['nodes_to_com'] = {};
status['total_weight'] = 0; status['total_weight'] = 0;
status['internals'] = {}; status['internals'] = {};
...@@ -269,6 +271,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -269,6 +271,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
} }
function induced_graph(partition, graph){ function induced_graph(partition, graph){
console.log('FUN t.jLouvain:induced_graph')
var ret = {nodes:[], edges:[], _assoc_mat: {}}; var ret = {nodes:[], edges:[], _assoc_mat: {}};
var w_prec, weight; var w_prec, weight;
//add nodes from partition values //add nodes from partition values
...@@ -286,6 +289,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -286,6 +289,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
} }
function partition_at_level(dendogram, level){ function partition_at_level(dendogram, level){
console.log('FUN t.jLouvain:partition_at_level')
var partition = clone(dendogram[0]); var partition = clone(dendogram[0]);
for(var i = 1; i < level + 1; i++ ) for(var i = 1; i < level + 1; i++ )
Object.keys(partition).forEach(function(key,j){ Object.keys(partition).forEach(function(key,j){
...@@ -298,6 +302,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -298,6 +302,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
function generate_dendogram(graph, part_init){ function generate_dendogram(graph, part_init){
console.log('FUN t.jLouvain:generate_dendogram')
if(graph.edges.length == 0){ if(graph.edges.length == 0){
var part = {}; var part = {};
......
...@@ -86,6 +86,9 @@ $.ajax({ ...@@ -86,6 +86,9 @@ $.ajax({
}); });
function MainFunction( RES ) { function MainFunction( RES ) {
console.log(' ------------')
console.log('FUN t.main:MainFunction')
console.log(' ------------')
if(!RES["OK"]) { if(!RES["OK"]) {
alert("error: "+RES["data"]) alert("error: "+RES["data"])
return false; return false;
...@@ -311,7 +314,7 @@ function MainFunction( RES ) { ...@@ -311,7 +314,7 @@ function MainFunction( RES ) {
} }
}).index(); }).index();
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw(); // partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw();
// fa2enabled=true; //partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw(); // fa2enabled=true; //partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw();
// $.doTimeout(1,function(){ // $.doTimeout(1,function(){
...@@ -342,6 +345,7 @@ function MainFunction( RES ) { ...@@ -342,6 +345,7 @@ function MainFunction( RES ) {
fa2enabled=true; partialGraph.startForceAtlas2(); fa2enabled=true; partialGraph.startForceAtlas2();
setTimeout(function() { setTimeout(function() {
console.log( "LALALALALALLA" ) console.log( "LALALALALALLA" )
console.log( "hello" )
partialGraph.stopForceAtlas2(); partialGraph.stopForceAtlas2();
}, fa2seconds*1000); }, fa2seconds*1000);
...@@ -349,6 +353,3 @@ function MainFunction( RES ) { ...@@ -349,6 +353,3 @@ function MainFunction( RES ) {
console.log("finish") console.log("finish")
...@@ -71,6 +71,7 @@ else { ...@@ -71,6 +71,7 @@ else {
//just CSS //just CSS
function sigmaLimits(){ function sigmaLimits(){
console.log('FUN t.main_backup:sigmaLimits')
pr("\t*** sigmaLimits()") pr("\t*** sigmaLimits()")
pw=$('#sigma-example').width(); pw=$('#sigma-example').width();
...@@ -91,6 +92,7 @@ function sigmaLimits(){ ...@@ -91,6 +92,7 @@ function sigmaLimits(){
} }
function bringTheNoise(pathfile,type){ function bringTheNoise(pathfile,type){
console.log('FUN t.main_backup:bringTheNoise')
$("#semLoader").hide(); $("#semLoader").hide();
...@@ -305,6 +307,7 @@ function bringTheNoise(pathfile,type){ ...@@ -305,6 +307,7 @@ function bringTheNoise(pathfile,type){
function theListeners(){ function theListeners(){
console.log('FUN t.main_backup:theListeners')
pr("in THELISTENERS"); pr("in THELISTENERS");
// leftPanel("close"); // leftPanel("close");
$("#closeloader").click();//modal.hide doesnt work :c $("#closeloader").click();//modal.hide doesnt work :c
...@@ -689,6 +692,7 @@ function theListeners(){ ...@@ -689,6 +692,7 @@ function theListeners(){
// Social Spatialization // Social Spatialization
// Semantic Spatialization // Semantic Spatialization
function SigmaLayouting( URL, DATA, NAME) { function SigmaLayouting( URL, DATA, NAME) {
console.log('FUN t.main_backup:SigmaLayouting')
pr(URL+"?"+DATA) pr(URL+"?"+DATA)
return $.ajax({ return $.ajax({
type: 'GET', type: 'GET',
......
function cancelSelection (fromTagCloud) { function cancelSelection (fromTagCloud) {
console.log('FUN t.methods:cancelSelection')
pr("\t***in cancelSelection"); pr("\t***in cancelSelection");
highlightSelectedNodes(false); //Unselect the selected ones :D highlightSelectedNodes(false); //Unselect the selected ones :D
opossites = []; opossites = [];
...@@ -54,6 +55,7 @@ function cancelSelection (fromTagCloud) { ...@@ -54,6 +55,7 @@ function cancelSelection (fromTagCloud) {
} }
function highlightSelectedNodes(flag){ function highlightSelectedNodes(flag){
console.log('FUN t.methods:highlightSelectedNodes')
pr("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections)) pr("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections))
if(!is_empty(selections)){ if(!is_empty(selections)){
for(var i in selections) { for(var i in selections) {
...@@ -76,6 +78,7 @@ function highlightSelectedNodes(flag){ ...@@ -76,6 +78,7 @@ function highlightSelectedNodes(flag){
} }
function alertCheckBox(eventCheck){ function alertCheckBox(eventCheck){
console.log('FUN t.methods:alertCheckBox')
if(!isUndef(eventCheck.checked)) checkBox=eventCheck.checked; if(!isUndef(eventCheck.checked)) checkBox=eventCheck.checked;
} }
...@@ -88,7 +91,7 @@ function alertCheckBox(eventCheck){ ...@@ -88,7 +91,7 @@ function alertCheckBox(eventCheck){
// b : Meso-Semantic // b : Meso-Semantic
// AaBb: Socio-Semantic // AaBb: Socio-Semantic
function RefreshState(newNOW){ function RefreshState(newNOW){
console.log('FUN t.methods:RefreshState')
pr("\t\t\tin RefreshState newNOW:_"+newNOW+"_.") pr("\t\t\tin RefreshState newNOW:_"+newNOW+"_.")
if (newNOW!="") { if (newNOW!="") {
...@@ -175,6 +178,7 @@ function RefreshState(newNOW){ ...@@ -175,6 +178,7 @@ function RefreshState(newNOW){
} }
function pushSWClick(arg){ function pushSWClick(arg){
console.log('FUN t.methods:pushSWClick')
swclickPrev = swclickActual; swclickPrev = swclickActual;
swclickActual = arg; swclickActual = arg;
} }
...@@ -182,6 +186,7 @@ function pushSWClick(arg){ ...@@ -182,6 +186,7 @@ function pushSWClick(arg){
//FOR UNI-PARTITE //FOR UNI-PARTITE
function selectionUni(currentNode){ function selectionUni(currentNode){
console.log('FUN t.methods:selectionUni')
pr("\tin selectionUni:"+currentNode.id); pr("\tin selectionUni:"+currentNode.id);
if(checkBox==false && cursor_size==0) { if(checkBox==false && cursor_size==0) {
highlightSelectedNodes(false); highlightSelectedNodes(false);
...@@ -211,6 +216,7 @@ function selectionUni(currentNode){ ...@@ -211,6 +216,7 @@ function selectionUni(currentNode){
// it receives entire node // it receives entire node
function selection(currentNode){ function selection(currentNode){
console.log('FUN t.methods:selection')
if(checkBox==false && cursor_size==0) { if(checkBox==false && cursor_size==0) {
highlightSelectedNodes(false); highlightSelectedNodes(false);
opossites = []; opossites = [];
...@@ -345,6 +351,7 @@ function selection(currentNode){ ...@@ -345,6 +351,7 @@ function selection(currentNode){
} }
function getOpossitesNodes(node_id, entireNode) { function getOpossitesNodes(node_id, entireNode) {
console.log('FUN t.methods:getOpossitesNodes')
node=""; node="";
if(entireNode==true) node=node_id; if(entireNode==true) node=node_id;
else node = partialGraph._core.graph.nodesIndex[node_id]; else node = partialGraph._core.graph.nodesIndex[node_id];
...@@ -366,6 +373,7 @@ function getOpossitesNodes(node_id, entireNode) { ...@@ -366,6 +373,7 @@ function getOpossitesNodes(node_id, entireNode) {
// tag cloud div // tag cloud div
function htmlfied_alternodes(elems) { function htmlfied_alternodes(elems) {
console.log('FUN t.methods:htmlfied_alternodes')
var oppositesNodes=[] var oppositesNodes=[]
js1='onclick="graphTagCloudElem(\''; js1='onclick="graphTagCloudElem(\'';
js2="');\"" js2="');\""
...@@ -391,12 +399,14 @@ function htmlfied_alternodes(elems) { ...@@ -391,12 +399,14 @@ function htmlfied_alternodes(elems) {
} }
function manualForceLabel(nodeid,active) { function manualForceLabel(nodeid,active) {
console.log('FUN t.methods:manualForceLabel')
// pr("manual|"+nodeid+"|"+active) // pr("manual|"+nodeid+"|"+active)
partialGraph._core.graph.nodesIndex[nodeid].active=active; partialGraph._core.graph.nodesIndex[nodeid].active=active;
partialGraph.draw(); partialGraph.draw();
} }
function htmlfied_samenodes(elems) { function htmlfied_samenodes(elems) {
console.log('FUN t.methods:htmlfied_samenodes')
var sameNodes=[] var sameNodes=[]
js1=' onmouseover="manualForceLabel(this.id,true);" '; js1=' onmouseover="manualForceLabel(this.id,true);" ';
js2=' onmouseout="manualForceLabel(this.id,true);" '; js2=' onmouseout="manualForceLabel(this.id,true);" ';
...@@ -414,7 +424,7 @@ function htmlfied_samenodes(elems) { ...@@ -414,7 +424,7 @@ function htmlfied_samenodes(elems) {
// nodes information div // nodes information div
function htmlfied_nodesatts(elems){ function htmlfied_nodesatts(elems){
console.log('FUN t.methods:htmlfied_nodesatts')
var socnodes=[] var socnodes=[]
var semnodes=[] var semnodes=[]
for(var i in elems) { for(var i in elems) {
...@@ -462,6 +472,7 @@ function htmlfied_nodesatts(elems){ ...@@ -462,6 +472,7 @@ function htmlfied_nodesatts(elems){
//missing: getTopPapers for both node types //missing: getTopPapers for both node types
//considering complete graphs case! <= maybe i should mv it //considering complete graphs case! <= maybe i should mv it
function updateLeftPanel_fix( sels , oppos ) { function updateLeftPanel_fix( sels , oppos ) {
console.log('FUN t.methods:updateLeftPanel_fix')
pr("updateLeftPanel() corrected version** ") pr("updateLeftPanel() corrected version** ")
var namesDIV='' var namesDIV=''
var alterNodesDIV='' var alterNodesDIV=''
...@@ -519,6 +530,7 @@ function updateLeftPanel_fix( sels , oppos ) { ...@@ -519,6 +530,7 @@ function updateLeftPanel_fix( sels , oppos ) {
} }
function printStates() { function printStates() {
console.log('FUN t.methods:printStates')
pr("\t\t\t\t---------"+getClientTime()+"---------") pr("\t\t\t\t---------"+getClientTime()+"---------")
pr("\t\t\t\tswMacro: "+swMacro) pr("\t\t\t\tswMacro: "+swMacro)
pr("\t\t\t\tswActual: "+swclickActual+" | swPrev: "+swclickPrev) pr("\t\t\t\tswActual: "+swclickActual+" | swPrev: "+swclickPrev)
...@@ -534,11 +546,13 @@ function printStates() { ...@@ -534,11 +546,13 @@ function printStates() {
//true: button disabled //true: button disabled
//false: button enabled //false: button enabled
function LevelButtonDisable( TF ){ function LevelButtonDisable( TF ){
console.log('FUN t.methods:LevelButtonDisable')
$('#changelevel').prop('disabled', TF); $('#changelevel').prop('disabled', TF);
} }
//Fixed! apres: refactor! //Fixed! apres: refactor!
function graphTagCloudElem(nodes) { function graphTagCloudElem(nodes) {
console.log('FUN t.methods:graphTagCloudElem')
pr("in graphTagCloudElem, nodae_id: "+nodes); pr("in graphTagCloudElem, nodae_id: "+nodes);
cancelSelection(); cancelSelection();
partialGraph.emptyGraph(); partialGraph.emptyGraph();
...@@ -648,7 +662,7 @@ function graphTagCloudElem(nodes) { ...@@ -648,7 +662,7 @@ function graphTagCloudElem(nodes) {
function greyEverything(){ function greyEverything(){
console.log('FUN t.methods:greyEverything')
nds = partialGraph._core.graph.nodes.filter(function(n) { nds = partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden']; return !n['hidden'];
}); });
...@@ -689,7 +703,7 @@ function greyEverything(){ ...@@ -689,7 +703,7 @@ function greyEverything(){
function markAsSelected_new(n_id) { function markAsSelected_new(n_id) {
console.log('FUN t.methods:markAsSelected_new')
if(n_id.id) nodeSel=n_id; if(n_id.id) nodeSel=n_id;
else nodeSel = partialGraph._core.graph.nodesIndex[n_id]; else nodeSel = partialGraph._core.graph.nodesIndex[n_id];
...@@ -747,6 +761,7 @@ function markAsSelected_new(n_id) { ...@@ -747,6 +761,7 @@ function markAsSelected_new(n_id) {
//it is a mess but it works. //it is a mess but it works.
// TODO: refactor this // TODO: refactor this
function markAsSelected(n_id,sel) { function markAsSelected(n_id,sel) {
console.log('FUN t.methods:markAsSelected')
if(!isUndef(n_id.id)) nodeSel=n_id; if(!isUndef(n_id.id)) nodeSel=n_id;
else nodeSel = partialGraph._core.graph.nodesIndex[n_id]; else nodeSel = partialGraph._core.graph.nodesIndex[n_id];
...@@ -1038,6 +1053,7 @@ function markAsSelected(n_id,sel) { ...@@ -1038,6 +1053,7 @@ function markAsSelected(n_id,sel) {
//to_del //to_del
function DrawAsSelectedNodes( nodeskeys ) { function DrawAsSelectedNodes( nodeskeys ) {
console.log('FUN t.methods:DrawAsSelectedNodes')
greyEverything(); greyEverything();
var ndsids=[] var ndsids=[]
...@@ -1063,7 +1079,7 @@ function DrawAsSelectedNodes( nodeskeys ) { ...@@ -1063,7 +1079,7 @@ function DrawAsSelectedNodes( nodeskeys ) {
//to_del //to_del
function MultipleSelection(nodes , desalg){ function MultipleSelection(nodes , desalg){
console.log('FUN t.methods:MultipleSelection')
pr("IN MULTIPLE SELECTION: checkbox="+checkBox) pr("IN MULTIPLE SELECTION: checkbox="+checkBox)
var prevsels = selections; var prevsels = selections;
...@@ -1146,6 +1162,7 @@ function MultipleSelection(nodes , desalg){ ...@@ -1146,6 +1162,7 @@ function MultipleSelection(nodes , desalg){
function graphResetColor(){ function graphResetColor(){
console.log('FUN t.methods:graphResetColor')
nds = partialGraph._core.graph.nodes.filter(function(x) { nds = partialGraph._core.graph.nodes.filter(function(x) {
return !x['hidden']; return !x['hidden'];
}); });
...@@ -1168,7 +1185,7 @@ function graphResetColor(){ ...@@ -1168,7 +1185,7 @@ function graphResetColor(){
//to_del //to_del
function createEdgesForExistingNodes (typeOfNodes) { function createEdgesForExistingNodes (typeOfNodes) {
console.log('FUN t.methods:createEdgesForExistingNodes')
if(typeOfNodes=="social") typeOfNodes="Scholars" if(typeOfNodes=="social") typeOfNodes="Scholars"
if(typeOfNodes=="semantic") typeOfNodes="Keywords" if(typeOfNodes=="semantic") typeOfNodes="Keywords"
if(typeOfNodes=="sociosemantic") typeOfNodes="Bipartite" if(typeOfNodes=="sociosemantic") typeOfNodes="Bipartite"
...@@ -1315,6 +1332,7 @@ function createEdgesForExistingNodes (typeOfNodes) { ...@@ -1315,6 +1332,7 @@ function createEdgesForExistingNodes (typeOfNodes) {
} }
function hideEverything(){ function hideEverything(){
console.log('FUN t.methods:hideEverything')
pr("\thiding all"); pr("\thiding all");
nodeslength=0; nodeslength=0;
for(var n in partialGraph._core.graph.nodesIndex){ for(var n in partialGraph._core.graph.nodesIndex){
...@@ -1331,7 +1349,7 @@ function hideEverything(){ ...@@ -1331,7 +1349,7 @@ function hideEverything(){
function add1Elem(id) { function add1Elem(id) {
console.log('FUN t.methods:add1Elem')
id = ""+id; id = ""+id;
if(id.split(";").length==1) { // i've received a NODE if(id.split(";").length==1) { // i've received a NODE
id = parseInt(id) id = parseInt(id)
...@@ -1381,6 +1399,7 @@ function add1Elem(id) { ...@@ -1381,6 +1399,7 @@ function add1Elem(id) {
//to_del //to_del
function unHide(id){ function unHide(id){
console.log('FUN t.methods:unHide')
// pr("unhide "+id) // pr("unhide "+id)
id = ""+id; id = ""+id;
if(id.split(";").length==1) { if(id.split(";").length==1) {
...@@ -1430,6 +1449,7 @@ function unHide(id){ ...@@ -1430,6 +1449,7 @@ function unHide(id){
} }
function pushFilterValue(filtername,arg){ function pushFilterValue(filtername,arg){
console.log('FUN t.methods:pushFilterValue')
if(lastFilter[filtername]["orig"]=="-") { if(lastFilter[filtername]["orig"]=="-") {
lastFilter[filtername]["orig"] = arg; lastFilter[filtername]["orig"] = arg;
lastFilter[filtername]["last"] = arg; lastFilter[filtername]["last"] = arg;
...@@ -1442,6 +1462,7 @@ function pushFilterValue(filtername,arg){ ...@@ -1442,6 +1462,7 @@ function pushFilterValue(filtername,arg){
//to_del //to_del
function add1Edge(ID) { function add1Edge(ID) {
console.log('FUN t.methods:add1Edge')
if(gete(ID)) return; if(gete(ID)) return;
var s = Edges[ID].sourceID var s = Edges[ID].sourceID
var t = Edges[ID].targetID var t = Edges[ID].targetID
...@@ -1472,6 +1493,7 @@ function add1Edge(ID) { ...@@ -1472,6 +1493,7 @@ function add1Edge(ID) {
//to_del //to_del
function hideElem(id){ function hideElem(id){
console.log('FUN t.methods:hideElem')
if(id.split(";").length==1){ if(id.split(";").length==1){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type); //updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
partialGraph._core.graph.nodesIndex[id].hidden=true; partialGraph._core.graph.nodesIndex[id].hidden=true;
...@@ -1484,6 +1506,7 @@ function hideElem(id){ ...@@ -1484,6 +1506,7 @@ function hideElem(id){
//to_del //to_del
function unHideElem(id){ function unHideElem(id){
console.log('FUN t.methods:unHideElem')
if(id.split(";").length==1){ if(id.split(";").length==1){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type); //updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
partialGraph._core.graph.nodesIndex[id].hidden=false; partialGraph._core.graph.nodesIndex[id].hidden=false;
...@@ -1496,7 +1519,7 @@ function unHideElem(id){ ...@@ -1496,7 +1519,7 @@ function unHideElem(id){
//to_del //to_del
function changeToMeso(iwannagraph) { function changeToMeso(iwannagraph) {
console.log('FUN t.methods:changeToMeso')
labels=[] labels=[]
iwantograph=iwannagraph;//just a mess iwantograph=iwannagraph;//just a mess
...@@ -1740,6 +1763,7 @@ function changeToMeso(iwannagraph) { ...@@ -1740,6 +1763,7 @@ function changeToMeso(iwannagraph) {
//to_del //to_del
function changeToMacro(iwannagraph) { function changeToMacro(iwannagraph) {
console.log('FUN t.methods:changeToMacro')
labels=[] labels=[]
pr("CHANGING TO Macro-"+iwannagraph); pr("CHANGING TO Macro-"+iwannagraph);
...@@ -1875,6 +1899,7 @@ function changeToMacro(iwannagraph) { ...@@ -1875,6 +1899,7 @@ function changeToMacro(iwannagraph) {
//to_del //to_del
function highlightOpossites (list){/*here*/ function highlightOpossites (list){/*here*/
console.log('FUN t.methods:highlightOpossites')
for(var n in list){ for(var n in list){
if(!isUndef(partialGraph._core.graph.nodesIndex[n])){ if(!isUndef(partialGraph._core.graph.nodesIndex[n])){
partialGraph._core.graph.nodesIndex[n].active=true; partialGraph._core.graph.nodesIndex[n].active=true;
...@@ -1883,7 +1908,7 @@ function highlightOpossites (list){/*here*/ ...@@ -1883,7 +1908,7 @@ function highlightOpossites (list){/*here*/
} }
function saveGraph() { function saveGraph() {
console.log('FUN t.methods:saveGraph')
size = getByID("check_size").checked size = getByID("check_size").checked
color = getByID("check_color").checked color = getByID("check_color").checked
atts = {"size":size,"color":color} atts = {"size":size,"color":color}
...@@ -1900,6 +1925,7 @@ function saveGraph() { ...@@ -1900,6 +1925,7 @@ function saveGraph() {
} }
function saveGEXF(nodes,edges,atts){ function saveGEXF(nodes,edges,atts){
console.log('FUN t.methods:saveGEXF')
gexf = '<?xml version="1.0" encoding="UTF-8"?>\n'; gexf = '<?xml version="1.0" encoding="UTF-8"?>\n';
gexf += '<gexf xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gephi.org/gexf/viz" version="1.1">\n'; gexf += '<gexf xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gephi.org/gexf/viz" version="1.1">\n';
gexf += '<graph defaultedgetype="undirected" type="static">\n'; gexf += '<graph defaultedgetype="undirected" type="static">\n';
...@@ -1945,7 +1971,7 @@ function saveGEXF(nodes,edges,atts){ ...@@ -1945,7 +1971,7 @@ function saveGEXF(nodes,edges,atts){
} }
function saveGraphIMG(){ function saveGraphIMG(){
console.log('FUN t.methods:saveGraphIMG')
var strDownloadMime = "image/octet-stream" var strDownloadMime = "image/octet-stream"
var nodesDiv = partialGraph._core.domElements.nodes; var nodesDiv = partialGraph._core.domElements.nodes;
......
function draw1Circle(ctx , x , y , color) { function draw1Circle(ctx , x , y , color) {
console.log('FUN t.minimap:draw1Circle')
ctx.strokeStyle = '#000'; ctx.strokeStyle = '#000';
ctx.lineWidth = 1; ctx.lineWidth = 1;
ctx.fillStyle = color; ctx.fillStyle = color;
...@@ -14,6 +15,7 @@ function draw1Circle(ctx , x , y , color) { ...@@ -14,6 +15,7 @@ function draw1Circle(ctx , x , y , color) {
function trackMouse() { function trackMouse() {
console.log('FUN t.minimap:trackMouse')
if(!shift_key) { if(!shift_key) {
// $.doTimeout(300,function (){ // $.doTimeout(300,function (){
var ctx = partialGraph._core.domElements.mouse.getContext('2d'); var ctx = partialGraph._core.domElements.mouse.getContext('2d');
...@@ -74,6 +76,7 @@ function trackMouse() { ...@@ -74,6 +76,7 @@ function trackMouse() {
}; };
function changeGraphPosition(evt, echelle) { function changeGraphPosition(evt, echelle) {
console.log('FUN t.minimap:changeGraphPosition')
document.body.style.cursor = "move"; document.body.style.cursor = "move";
var _coord = { var _coord = {
x : evt.pageX, x : evt.pageX,
...@@ -86,7 +89,7 @@ function changeGraphPosition(evt, echelle) { ...@@ -86,7 +89,7 @@ function changeGraphPosition(evt, echelle) {
} }
function onOverviewMove(evt) { function onOverviewMove(evt) {
console.log("onOverViewMove"); console.log('FUN t.minimap:onOverviewMove')
/* /*
pageX: 1247 pageY: 216 pageX: 1247 pageY: 216
screenX: 1188 screenY: 307 screenX: 1188 screenY: 307
...@@ -101,7 +104,7 @@ function onOverviewMove(evt) { ...@@ -101,7 +104,7 @@ function onOverviewMove(evt) {
} }
function startMove(evt){ function startMove(evt){
console.log("startMove"); console.log('FUN t.minimap:startMove')
evt.preventDefault(); evt.preventDefault();
partialGraph.dragOn = true; partialGraph.dragOn = true;
partialGraph.lastMouse = { partialGraph.lastMouse = {
...@@ -112,13 +115,14 @@ function startMove(evt){ ...@@ -112,13 +115,14 @@ function startMove(evt){
} }
function endMove(evt){ function endMove(evt){
console.log("endMove"); console.log('FUN t.minimap:endMove')
document.body.style.cursor = "default"; document.body.style.cursor = "default";
partialGraph.dragOn = false; partialGraph.dragOn = false;
partialGraph.mouseHasMoved = false; partialGraph.mouseHasMoved = false;
} }
function onGraphScroll(evt, delta) { function onGraphScroll(evt, delta) {
console.log('FUN t.minimap:onGraphScroll')
$("#zoomSlider").slider("value",partialGraph.position().ratio); $("#zoomSlider").slider("value",partialGraph.position().ratio);
// partialGraph.totalScroll += delta; // partialGraph.totalScroll += delta;
// if (Math.abs(partialGraph.totalScroll) >= 1) { // if (Math.abs(partialGraph.totalScroll) >= 1) {
...@@ -174,6 +178,7 @@ function onGraphScroll(evt, delta) { ...@@ -174,6 +178,7 @@ function onGraphScroll(evt, delta) {
} }
function initializeMap() { function initializeMap() {
console.log('FUN t.minimap:initializeMap')
clearInterval(partialGraph.timeRefresh); clearInterval(partialGraph.timeRefresh);
partialGraph.oldParams = {}; partialGraph.oldParams = {};
...@@ -191,6 +196,7 @@ function initializeMap() { ...@@ -191,6 +196,7 @@ function initializeMap() {
} }
function updateMap(){ function updateMap(){
console.log('FUN t.minimap:updateMap')
if(minimap){ if(minimap){
partialGraph.imageMini=""; partialGraph.imageMini="";
partialGraph.ctxMini=""; partialGraph.ctxMini="";
...@@ -216,6 +222,7 @@ function updateMap(){ ...@@ -216,6 +222,7 @@ function updateMap(){
} }
function traceMap() { function traceMap() {
console.log('FUN t.minimap:traceMap')
//pr("\ttracingmap"); //pr("\ttracingmap");
partialGraph.echelleGenerale = Math.pow( Math.SQRT2, partialGraph.position().ratio ); partialGraph.echelleGenerale = Math.pow( Math.SQRT2, partialGraph.position().ratio );
partialGraph.ctxMini.putImageData(partialGraph.imageMini, 0, 0); partialGraph.ctxMini.putImageData(partialGraph.imageMini, 0, 0);
...@@ -235,6 +242,7 @@ function traceMap() { ...@@ -235,6 +242,7 @@ function traceMap() {
} }
function startMiniMap(){ function startMiniMap(){
console.log('FUN t.minimap:startMiniMap')
if(minimap){ if(minimap){
partialGraph.ctxMini = document.getElementById('overview').getContext('2d'); partialGraph.ctxMini = document.getElementById('overview').getContext('2d');
partialGraph.ctxMini.clearRect(0, 0, overviewWidth, overviewHeight); partialGraph.ctxMini.clearRect(0, 0, overviewWidth, overviewHeight);
......
...@@ -6,6 +6,7 @@ var first_time=true; ...@@ -6,6 +6,7 @@ var first_time=true;
sigma.forceatlas2 = sigma.forceatlas2 || {}; sigma.forceatlas2 = sigma.forceatlas2 || {};
sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
console.log('FUN t.sigma.forceatlas2:ForceAtlas2')
sigma.classes.Cascade.call(this); sigma.classes.Cascade.call(this);
var self = this; var self = this;
this.graph = graph; this.graph = graph;
...@@ -982,6 +983,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -982,6 +983,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
// The Region class, as used by the Barnes Hut optimization // The Region class, as used by the Barnes Hut optimization
sigma.forceatlas2.Region = function(nodes, depth) { sigma.forceatlas2.Region = function(nodes, depth) {
console.log('FUN t.sigma.forceatlas2:Region')
sigma.classes.Cascade.call(this); sigma.classes.Cascade.call(this);
this.depthLimit = 20; this.depthLimit = 20;
this.size = 0; this.size = 0;
...@@ -999,6 +1001,7 @@ sigma.forceatlas2.Region = function(nodes, depth) { ...@@ -999,6 +1001,7 @@ sigma.forceatlas2.Region = function(nodes, depth) {
} }
sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() { sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() {
console.log('FUN t.sigma.forceatlas2:updateMassAndGeometry')
if (this.nodes.length > 1) { if (this.nodes.length > 1) {
// Compute Mass // Compute Mass
var mass = 0; var mass = 0;
...@@ -1034,6 +1037,7 @@ sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() { ...@@ -1034,6 +1037,7 @@ sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() {
}; };
sigma.forceatlas2.Region.prototype.buildSubRegions = function() { sigma.forceatlas2.Region.prototype.buildSubRegions = function() {
console.log('FUN t.sigma.forceatlas2:buildSubRegions')
if (this.nodes.length > 1) { if (this.nodes.length > 1) {
var leftNodes = []; var leftNodes = [];
var rightNodes = []; var rightNodes = [];
...@@ -1085,6 +1089,7 @@ sigma.forceatlas2.Region.prototype.buildSubRegions = function() { ...@@ -1085,6 +1089,7 @@ sigma.forceatlas2.Region.prototype.buildSubRegions = function() {
}; };
sigma.forceatlas2.Region.prototype.applyForce = function(n, Force, theta) { sigma.forceatlas2.Region.prototype.applyForce = function(n, Force, theta) {
console.log('FUN t.sigma.forceatlas2:applyForce')
if (this.nodes.length < 2) { if (this.nodes.length < 2) {
var regionNode = this.nodes[0]; var regionNode = this.nodes[0];
Force.apply_nn(n, regionNode); Force.apply_nn(n, regionNode);
...@@ -1109,6 +1114,7 @@ sigma.forceatlas2.Region.prototype.applyForce = function(n, Force, theta) { ...@@ -1109,6 +1114,7 @@ sigma.forceatlas2.Region.prototype.applyForce = function(n, Force, theta) {
sigma.publicPrototype.startForceAtlas2 = function() { sigma.publicPrototype.startForceAtlas2 = function() {
console.log('FUN t.sigma.forceatlas2:applyForce')
//if(!this.forceatlas2) { //if(!this.forceatlas2) {
if(fa2enabled) { if(fa2enabled) {
...@@ -1153,6 +1159,7 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1153,6 +1159,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
}; };
sigma.publicPrototype.stopForceAtlas2 = function() { sigma.publicPrototype.stopForceAtlas2 = function() {
console.log('FUN t.sigma.forceatlas2:stopForceAtlas2')
var present = partialGraph.states.slice(-1)[0] var present = partialGraph.states.slice(-1)[0]
if(this.forceatlas2) { if(this.forceatlas2) {
if(this.forceatlas2.count) { if(this.forceatlas2.count) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Level-01 // Level-01
ParseCustom = function ( format , data ) { ParseCustom = function ( format , data ) {
console.log('FUN t.sigma.parseCustom:ParseCustom')
this.data = data; this.data = data;
this.format = format; this.format = format;
this.nbCats = 0; this.nbCats = 0;
...@@ -35,7 +36,7 @@ ParseCustom = function ( format , data ) { ...@@ -35,7 +36,7 @@ ParseCustom = function ( format , data ) {
// Level-02 // Level-02
ParseCustom.prototype.scanFile = function() { ParseCustom.prototype.scanFile = function() {
console.log('FUN t.sigma.parseCustom:scanFile')
switch (this.format) { switch (this.format) {
case "api.json": case "api.json":
pr("scanFile: "+this.format) pr("scanFile: "+this.format)
...@@ -61,7 +62,7 @@ ParseCustom.prototype.scanFile = function() { ...@@ -61,7 +62,7 @@ ParseCustom.prototype.scanFile = function() {
// Level-02 // Level-02
ParseCustom.prototype.makeDicts = function(categories) { ParseCustom.prototype.makeDicts = function(categories) {
console.log('FUN t.sigma.parseCustom:makeDicts')
switch (this.format) { switch (this.format) {
case "api.json": case "api.json":
pr("makeDicts: "+this.format) pr("makeDicts: "+this.format)
...@@ -90,6 +91,7 @@ ParseCustom.prototype.makeDicts = function(categories) { ...@@ -90,6 +91,7 @@ ParseCustom.prototype.makeDicts = function(categories) {
// Level-00 // Level-00
function scanGexf(gexf) { function scanGexf(gexf) {
console.log('FUN t.sigma.parseCustom:scanGexf')
var categoriesDict={}, categories=[]; var categoriesDict={}, categories=[];
nodesNodes = gexf.getElementsByTagName('nodes'); nodesNodes = gexf.getElementsByTagName('nodes');
for(i=0; i<nodesNodes.length; i++){ for(i=0; i<nodesNodes.length; i++){
...@@ -138,7 +140,7 @@ function scanGexf(gexf) { ...@@ -138,7 +140,7 @@ function scanGexf(gexf) {
// Level-00 // Level-00
// for {1,2}partite graphs // for {1,2}partite graphs
function dictfyGexf( gexf , categories ) { function dictfyGexf( gexf , categories ) {
console.log('FUN t.sigma.parseCustom:dictfyGexf')
var catDict = {} var catDict = {}
var catCount = {} var catCount = {}
...@@ -474,7 +476,7 @@ function dictfyGexf( gexf , categories ) { ...@@ -474,7 +476,7 @@ function dictfyGexf( gexf , categories ) {
// Level-00 // Level-00
function scanJSON( data ) { function scanJSON( data ) {
console.log('FUN t.sigma.parseCustom:scanJSON')
var categoriesDict={}, categories=[]; var categoriesDict={}, categories=[];
var nodes = data.nodes; var nodes = data.nodes;
...@@ -516,6 +518,7 @@ function scanJSON( data ) { ...@@ -516,6 +518,7 @@ function scanJSON( data ) {
// Level-00 // Level-00
// for {1,2}partite graphs // for {1,2}partite graphs
function dictfyJSON( data , categories ) { function dictfyJSON( data , categories ) {
console.log('FUN t.sigma.parseCustom:dictfyJSON')
console.clear() console.clear()
console.log("IN DICTIFY JSON") console.log("IN DICTIFY JSON")
var catDict = {} var catDict = {}
...@@ -717,6 +720,7 @@ function dictfyJSON( data , categories ) { ...@@ -717,6 +720,7 @@ function dictfyJSON( data , categories ) {
// to move // to move
function buildInitialState( categories ) { function buildInitialState( categories ) {
console.log('FUN t.sigma.parseCustom:buildInitialState')
var firstState = [] var firstState = []
for(var i=0; i<categories.length ; i++) { for(var i=0; i<categories.length ; i++) {
if(i==0) firstState.push(true) if(i==0) firstState.push(true)
...@@ -727,6 +731,7 @@ function buildInitialState( categories ) { ...@@ -727,6 +731,7 @@ function buildInitialState( categories ) {
//to move //to move
function makeSystemStates (cats) { function makeSystemStates (cats) {
console.log('FUN t.sigma.parseCustom:makeSystemStates')
var systemstates = {} var systemstates = {}
var N=Math.pow(2 , cats.length); var N=Math.pow(2 , cats.length);
...@@ -760,6 +765,7 @@ function makeSystemStates (cats) { ...@@ -760,6 +765,7 @@ function makeSystemStates (cats) {
//to_del //to_del
function parse(gexfPath) { function parse(gexfPath) {
console.log('FUN t.sigma.parseCustom:parse')
var gexfhttp; var gexfhttp;
gexfhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); gexfhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
gexfhttp.open('GET', gexfPath, false); gexfhttp.open('GET', gexfPath, false);
...@@ -769,6 +775,7 @@ function parse(gexfPath) { ...@@ -769,6 +775,7 @@ function parse(gexfPath) {
//to_del //to_del
function scanCategories() { function scanCategories() {
console.log('FUN t.sigma.parseCustom:scanCategories')
nodesNodes = gexf.getElementsByTagName('nodes'); nodesNodes = gexf.getElementsByTagName('nodes');
for(i=0; i<nodesNodes.length; i++){ for(i=0; i<nodesNodes.length; i++){
var nodesNode = nodesNodes[i]; // Each xml node 'nodes' (plural) var nodesNode = nodesNodes[i]; // Each xml node 'nodes' (plural)
...@@ -801,7 +808,7 @@ function scanCategories() { ...@@ -801,7 +808,7 @@ function scanCategories() {
//to_del //to_del
function onepartiteExtract(){ function onepartiteExtract(){
console.log('FUN t.sigma.parseCustom:onepartiteExtract')
var i, j, k; var i, j, k;
// partialGraph.emptyGraph(); // partialGraph.emptyGraph();
// Parse Attributes // Parse Attributes
...@@ -1045,6 +1052,7 @@ function onepartiteExtract(){ ...@@ -1045,6 +1052,7 @@ function onepartiteExtract(){
//to_del //to_del
function fullExtract(){ function fullExtract(){
console.log('FUN t.sigma.parseCustom:fullExtract')
var i, j, k; var i, j, k;
// Parse Attributes // Parse Attributes
// This is confusing, so I'll comment heavily // This is confusing, so I'll comment heavily
...@@ -1373,7 +1381,7 @@ function fullExtract(){ ...@@ -1373,7 +1381,7 @@ function fullExtract(){
//to_del //to_del
function JSONFile( URL ) { function JSONFile( URL ) {
console.log('FUN t.sigma.parseCustom:JSONFile')
return $.ajax({ return $.ajax({
...@@ -1399,7 +1407,7 @@ function JSONFile( URL ) { ...@@ -1399,7 +1407,7 @@ function JSONFile( URL ) {
//to_del //to_del
function parseSimpleJSON( data , seed ) { function parseSimpleJSON( data , seed ) {
console.log('FUN t.sigma.parseCustom:parseSimpleJSON')
var i, j, k; var i, j, k;
rand=new RVUniformC(seed); rand=new RVUniformC(seed);
//partialGraph.emptyGraph(); //partialGraph.emptyGraph();
...@@ -1494,6 +1502,7 @@ function parseSimpleJSON( data , seed ) { ...@@ -1494,6 +1502,7 @@ function parseSimpleJSON( data , seed ) {
//to_del //to_del
// For CommunityExplorer API // For CommunityExplorer API
function extractFromJson(data,seed){ function extractFromJson(data,seed){
console.log('FUN t.sigma.parseCustom:extractFromJson')
var i, j, k; var i, j, k;
rand=new RVUniformC(seed); rand=new RVUniformC(seed);
//partialGraph.emptyGraph(); //partialGraph.emptyGraph();
......
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
SigmaUtils = function () { SigmaUtils = function () {
console.log('FUN t.SigmaUtils:SigmaUtils:new')
this.nbCats = 0; this.nbCats = 0;
// input = GEXFstring // input = GEXFstring
this.FillGraph = function( initialState , catDict , nodes, edges , graph ) { this.FillGraph = function( initialState , catDict , nodes, edges , graph ) {
console.log('FUN t.SigmaUtils:SigmaUtils:FillGraph')
print("Filling the graaaaph:") print("Filling the graaaaph:")
print(catDict) print(catDict)
...@@ -64,6 +66,7 @@ SigmaUtils = function () { ...@@ -64,6 +66,7 @@ SigmaUtils = function () {
//for socialgraph //for socialgraph
function showMeSomeLabels(N){ function showMeSomeLabels(N){
console.log('FUN t.sigmaUtils:showMeSomeLabels')
/*======= Show some labels at the beginning =======*/ /*======= Show some labels at the beginning =======*/
minIn=50, minIn=50,
maxIn=0, maxIn=0,
...@@ -105,28 +108,34 @@ function showMeSomeLabels(N){ ...@@ -105,28 +108,34 @@ function showMeSomeLabels(N){
} }
function getnodes(){ function getnodes(){
console.log('FUN t.sigmaUtils:getnodes')
return partialGraph._core.graph.nodes; return partialGraph._core.graph.nodes;
} }
function getnodesIndex(){ function getnodesIndex(){
console.log('FUN t.sigmaUtils:getnodesIndex')
return partialGraph._core.graph.nodesIndex; return partialGraph._core.graph.nodesIndex;
} }
function getedges(){ function getedges(){
console.log('FUN t.sigmaUtils:getedges')
return partialGraph._core.graph.edges; return partialGraph._core.graph.edges;
} }
function getedgesIndex(){ function getedgesIndex(){
console.log('FUN t.sigmaUtils:getedgesIndex')
return partialGraph._core.graph.edgesIndex; return partialGraph._core.graph.edgesIndex;
} }
function getVisibleEdges() { function getVisibleEdges() {
console.log('FUN t.sigmaUtils:getVisibleEdges')
return partialGraph._core.graph.edges.filter(function(e) { return partialGraph._core.graph.edges.filter(function(e) {
return !e['hidden']; return !e['hidden'];
}); });
} }
function getVisibleNodes() { function getVisibleNodes() {
console.log('FUN t.sigmaUtils:getVisibleNodes')
return partialGraph._core.graph.nodes.filter(function(n) { return partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden']; return !n['hidden'];
}); });
...@@ -134,21 +143,25 @@ function getVisibleNodes() { ...@@ -134,21 +143,25 @@ function getVisibleNodes() {
function getNodesByAtt(att) { function getNodesByAtt(att) {
console.log('FUN t.sigmaUtils:getNodesByAtt')
return partialGraph._core.graph.nodes.filter(function(n) { return partialGraph._core.graph.nodes.filter(function(n) {
return n['type']==att; return n['type']==att;
}); });
} }
function getn(id){ function getn(id){
console.log('FUN t.sigmaUtils:getn')
return partialGraph._core.graph.nodesIndex[id]; return partialGraph._core.graph.nodesIndex[id];
} }
function gete(id){ function gete(id){
console.log('FUN t.sigmaUtils:gete')
return partialGraph._core.graph.edgesIndex[id]; return partialGraph._core.graph.edgesIndex[id];
} }
function find(label){ function find(label){
console.log('FUN t.sigmaUtils:find')
var results=[]; var results=[];
var nds=getnodesIndex(); var nds=getnodesIndex();
label=label.toLowerCase() label=label.toLowerCase()
...@@ -165,6 +178,7 @@ function find(label){ ...@@ -165,6 +178,7 @@ function find(label){
} }
function exactfind(label) { function exactfind(label) {
console.log('FUN t.sigmaUtils:exactfind')
nds=getnodesIndex(); nds=getnodesIndex();
for(var i in nds){ for(var i in nds){
n=nds[i]; n=nds[i];
...@@ -179,6 +193,7 @@ function exactfind(label) { ...@@ -179,6 +193,7 @@ function exactfind(label) {
function getNodeLabels(elems){ function getNodeLabels(elems){
console.log('FUN t.sigmaUtils:getNodeLabels')
var labelss=[] var labelss=[]
for(var i in elems){ for(var i in elems){
var id=(!isUndef(elems[i].key))?elems[i].key:i var id=(!isUndef(elems[i].key))?elems[i].key:i
...@@ -188,11 +203,13 @@ function getNodeLabels(elems){ ...@@ -188,11 +203,13 @@ function getNodeLabels(elems){
} }
function getNodeIDs(elems){ function getNodeIDs(elems){
console.log('FUN t.sigmaUtils:getNodeIDs')
return Object.keys(elems) return Object.keys(elems)
} }
function getSelections(){ function getSelections(){
console.log('FUN t.sigmaUtils:getSelections')
params=[]; params=[];
for(var i in selections){ for(var i in selections){
params.push(Nodes[i].label); params.push(Nodes[i].label);
...@@ -204,6 +221,7 @@ function getSelections(){ ...@@ -204,6 +221,7 @@ function getSelections(){
//This receives an array not a dict! //This receives an array not a dict!
// i added an excpt... why // i added an excpt... why
function getNeighs(sels,arr) { function getNeighs(sels,arr) {
console.log('FUN t.sigmaUtils:getNeighs')
neighDict={}; neighDict={};
for(var i in sels) { for(var i in sels) {
id = sels[i] id = sels[i]
...@@ -222,6 +240,7 @@ function getNeighs(sels,arr) { ...@@ -222,6 +240,7 @@ function getNeighs(sels,arr) {
//Using bipartiteN2D or bipartiteD2N //Using bipartiteN2D or bipartiteD2N
//This receives an array not a dict! //This receives an array not a dict!
function getNeighs2(sels,arr){ function getNeighs2(sels,arr){
console.log('FUN t.sigmaUtils:getNeighs2')
neighDict={}; neighDict={};
for(var i in sels) { for(var i in sels) {
id = sels[i] id = sels[i]
...@@ -238,6 +257,7 @@ function getNeighs2(sels,arr){ ...@@ -238,6 +257,7 @@ function getNeighs2(sels,arr){
//to general utils //to general utils
function getArrSubkeys(arr,id) { function getArrSubkeys(arr,id) {
console.log('FUN t.sigmaUtils:getArrSubkeys')
var result = [] var result = []
for(var i in arr) { for(var i in arr) {
result.push(arr[i][id]) result.push(arr[i][id])
...@@ -246,6 +266,7 @@ function getArrSubkeys(arr,id) { ...@@ -246,6 +266,7 @@ function getArrSubkeys(arr,id) {
} }
function getCountries(){ function getCountries(){
console.log('FUN t.sigmaUtils:getCountries')
var nodes = getVisibleNodes(); var nodes = getVisibleNodes();
var countries = {} var countries = {}
...@@ -264,6 +285,7 @@ function getCountries(){ ...@@ -264,6 +285,7 @@ function getCountries(){
function getAcronyms() { function getAcronyms() {
console.log('FUN t.sigmaUtils:getAcronyms')
var nodes = getVisibleNodes(); var nodes = getVisibleNodes();
var acrs = {} var acrs = {}
pr("in getAcronyms") pr("in getAcronyms")
...@@ -280,7 +302,7 @@ function getAcronyms() { ...@@ -280,7 +302,7 @@ function getAcronyms() {
function clustersBy(daclass , att2change ) { function clustersBy(daclass , att2change ) {
console.log('FUN t.sigmaUtils:clustersBy')
cancelSelection(false); cancelSelection(false);
var v_nodes = getVisibleNodes(); var v_nodes = getVisibleNodes();
...@@ -400,7 +422,7 @@ function clustersBy(daclass , att2change ) { ...@@ -400,7 +422,7 @@ function clustersBy(daclass , att2change ) {
function colorsBy(daclass, att2change ) { function colorsBy(daclass, att2change ) {
console.log('FUN t.sigmaUtils:colorsBy')
pr("") pr("")
pr(" = = = = = = = = = = = = = = = = = ") pr(" = = = = = = = = = = = = = = = = = ")
pr(" = = = = = = = = = = = = = = = = = ") pr(" = = = = = = = = = = = = = = = = = ")
...@@ -449,6 +471,7 @@ function colorsBy(daclass, att2change ) { ...@@ -449,6 +471,7 @@ function colorsBy(daclass, att2change ) {
//just for fun //just for fun
function makeEdgeWeightUndef() { function makeEdgeWeightUndef() {
console.log('FUN t.sigmaUtils:makeEdgeWeightUndef')
for(var e in partialGraph._core.graph.edges) { for(var e in partialGraph._core.graph.edges) {
partialGraph._core.graph.edges[e].weight=1; partialGraph._core.graph.edges[e].weight=1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment