Commit ccc08006 authored by Romain Loth's avatar Romain Loth

pr to console.log for trace clarity

parent fc3bc4ee
......@@ -86,7 +86,7 @@ function ChangeGraphAppearanceByAtt( manualflag ) {
if(att_s == "age") the_method = "colorsRelByBins"
div_info += '<li><a href="#" onclick=\''+the_method+'("'+att_s+'")\'>By '+att_s+'('+att_c+')'+'</a></li>'
pr('<li><a href="#" onclick=\''+the_method+'("'+att_s+'")\'>By '+att_s+'('+att_c+')'+'</a></li>')
console.log('<li><a href="#" onclick=\''+the_method+'("'+att_s+'")\'>By '+att_s+'('+att_c+')'+'</a></li>')
}
div_info += ' </ul>'
div_info += ' </li>'
......@@ -151,7 +151,7 @@ function SomeEffect( ClusterCode ) {
n.forceLabel = false;
var node = TW.Nodes[n.id]
if ( node.type==Type && !isUndef(node.attributes[Cluster]) && node.attributes[Cluster]==clstID ) {
// pr( n.id + " | " + Cluster + " : " + node.attributes[Cluster] )
// console.log( n.id + " | " + Cluster + " : " + node.attributes[Cluster] )
nodes_2_colour[n.id] = n.degree;
}
}
......@@ -185,7 +185,7 @@ function SomeEffect( ClusterCode ) {
for(var i in edges_2_colour) {
an_edge = TW.partialGraph._core.graph.edgesIndex[i]
if(!isUndef(an_edge) && !an_edge.hidden){
// pr(an_edge)
// console.log(an_edge)
an_edge.color = an_edge.attr['true_color'];
an_edge.attr['grey'] = 0;
}
......@@ -289,11 +289,11 @@ function getTopPapers(type){
//contentType: "application/json",
//dataType: 'json',
success : function(data){
pr(TW.APINAME+'info_div.php?'+"type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file]);
console.log(TW.APINAME+'info_div.php?'+"type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file]);
$("#topPapers").html(data);
},
error: function(){
pr('Page Not found: getTopPapers');
console.log('Page Not found: getTopPapers');
}
});
}
......@@ -302,7 +302,7 @@ function getTopPapers(type){
//FOR UNI-PARTITE
function selectionUni(currentNode){
pr("\tin selectionUni:"+currentNode.id);
console.log("\tin selectionUni:"+currentNode.id);
if(checkBox==false && cursor_size==0) {
highlightSelectedNodes(false);
opossites = [];
......
......@@ -64,7 +64,7 @@ var ForceAtlas2 = function(graph) {
switch (self.state.step) {
case 0: // Pass init
// Initialise layout data
// pr("caso 0")
// console.log("caso 0")
nodes.forEach(function(n) {
if(n.fa2) {
n.fa2.mass = 1 + n.degree;
......@@ -103,7 +103,7 @@ var ForceAtlas2 = function(graph) {
break;
case 1: // Repulsion
// pr("caso 1")
// console.log("caso 1")
var Repulsion = self.ForceFactory.buildRepulsion(
self.p.adjustSizes,
self.p.scalingRatio
......@@ -148,7 +148,7 @@ var ForceAtlas2 = function(graph) {
break;
case 2: // Gravity
// pr("caso 2")
// console.log("caso 2")
var Gravity = (self.p.strongGravityMode) ?
(self.ForceFactory.getStrongGravity(
self.p.scalingRatio
......@@ -178,7 +178,7 @@ var ForceAtlas2 = function(graph) {
break;
case 3: // Attraction
// pr("caso 3")
// console.log("caso 3")
var Attraction = self.ForceFactory.buildAttraction(
self.p.linLogMode,
self.p.outboundAttractionDistribution,
......@@ -220,7 +220,7 @@ var ForceAtlas2 = function(graph) {
break;
case 4: // Auto adjust speed
// pr("caso 4")
// console.log("caso 4")
var totalSwinging = 0; // How much irregular movement
var totalEffectiveTraction = 0; // Hom much useful movement
var swingingSum=0;
......@@ -282,7 +282,7 @@ var ForceAtlas2 = function(graph) {
break;
case 5: // Apply forces
// pr("caso 5")
// console.log("caso 5")
var i = self.state.index;
if (self.p.adjustSizes) {
var speed = self.p.speed;
......@@ -964,12 +964,12 @@ var applyForce = function(n, Force, theta) {
// 01. Return the values to MainContext when spatialization is finished
var startForceAtlas2 = function(graph,limit_it) {
// pr("inside FA2")
// console.log("inside FA2")
//// if(!this.forceatlas2) {
// pr(graph);
// pr(graph.nodes[0].x)
// pr(graph.nodes[0].y)
// pr("--------")
// console.log(graph);
// console.log(graph.nodes[0].x)
// console.log(graph.nodes[0].y)
// console.log("--------")
// nodes = graph.nodes;
// for(var n in nodes) {
......@@ -1001,8 +1001,8 @@ var applyForce = function(n, Force, theta) {
count++;
if(flag||count>limit_it) break;
}
// pr(forceatlas2.graph.nodes[0].x)
// pr(forceatlas2.graph.nodes[0].y)
// console.log(forceatlas2.graph.nodes[0].x)
// console.log(forceatlas2.graph.nodes[0].y)
// console.log("\titerations: "+count)
result={
"nodes":forceatlas2.graph.nodes,
......
This diff is collapsed.
function cancelSelection (fromTagCloud) {
pr("\t***in cancelSelection");
console.log("\t***in cancelSelection");
highlightSelectedNodes(false); //Unselect the selected ones :D
opossites = [];
selections = [];
......@@ -13,8 +13,9 @@ function cancelSelection (fromTagCloud) {
//Nodes colors go back to normal
overNodes=false;
e = TW.partialGraph._core.graph.edges;
e = TW.partialGraph.graph.edges();
for(i=0;i<e.length;i++){
console.log(e)
e[i].color = e[i].attr['grey'] ? e[i].attr['true_color'] : e[i].color;
e[i].attr['grey'] = 0;
}
......@@ -58,7 +59,7 @@ function cancelSelection (fromTagCloud) {
}
function highlightSelectedNodes(flag){
pr("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections))
console.log("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections))
if(!is_empty(selections)){
for(var i in selections) {
if(TW.Nodes[i].type==TW.catSoc && swclickActual=="social"){
......@@ -93,7 +94,7 @@ function alertCheckBox(eventCheck){
// AaBb: Socio-Semantic
function RefreshState(newNOW){
pr("\t\t\tin RefreshState newNOW:_"+newNOW+"_.")
console.log("\t\t\tin RefreshState newNOW:_"+newNOW+"_.")
if (newNOW!="") {
PAST = NOW;
......@@ -122,7 +123,7 @@ function RefreshState(newNOW){
var N=( Object.keys(TW.Nodes).filter(function(n){return TW.Nodes[n].type==TW.catSoc}) ).length
var k=Object.keys(getNeighs(Object.keys(selections),nodes1)).length
var s=Object.keys(selections).length
pr("in social N: "+N+" - k: "+k+" - s: "+s)
console.log("in social N: "+N+" - k: "+k+" - s: "+s)
if(NOW=="A"){
if( (s==0 || k>=(N-1)) ) {
LevelButtonDisable(true);
......@@ -143,7 +144,7 @@ function RefreshState(newNOW){
var N=( Object.keys(TW.Nodes).filter(function(n){return TW.Nodes[n].type==TW.catSem}) ).length
var k=Object.keys(getNeighs(Object.keys(selections),nodes2)).length
var s=Object.keys(selections).length
pr("in semantic N: "+N+" - k: "+k+" - s: "+s)
console.log("in semantic N: "+N+" - k: "+k+" - s: "+s)
if(NOW=="B") {
if( (s==0 || k>=(N-1)) ) {
LevelButtonDisable(true);
......@@ -210,7 +211,7 @@ function htmlfied_alternodes(elems) {
}
function manualForceLabel(nodeid,active) {
// pr("manual|"+nodeid+"|"+active)
// console.log("manual|"+nodeid+"|"+active)
TW.partialGraph._core.graph.nodesIndex[nodeid].active=active;
TW.partialGraph.draw();
}
......@@ -317,7 +318,7 @@ function htmlfied_tagcloud(elems , limit) {
//missing: getTopPapers for both node types
//considering complete graphs case! <= maybe i should mv it
function updateLeftPanel_fix( sels , oppos ) {
pr("updateLeftPanel() corrected version** ")
console.log("updateLeftPanel() corrected version** ")
var namesDIV=''
var alterNodesDIV=''
var informationDIV=''
......@@ -377,15 +378,15 @@ function updateLeftPanel_fix( sels , oppos ) {
}
function printStates() {
pr("\t\t\t\t---------"+getClientTime()+"---------")
pr("\t\t\t\tswMacro: "+swMacro)
pr("\t\t\t\tswActual: "+swclickActual+" | swPrev: "+swclickPrev)
pr("\t\t\t\tNOW: "+NOW+" | PAST: "+PAST)
pr("\t\t\t\tselections: ")
pr(Object.keys(selections))
pr("\t\t\t\topposites: ")
pr(Object.keys(opossites))
pr("\t\t\t\t------------------------------------")
console.log("\t\t\t\t---------"+getClientTime()+"---------")
console.log("\t\t\t\tswMacro: "+swMacro)
console.log("\t\t\t\tswActual: "+swclickActual+" | swPrev: "+swclickPrev)
console.log("\t\t\t\tNOW: "+NOW+" | PAST: "+PAST)
console.log("\t\t\t\tselections: ")
console.log(Object.keys(selections))
console.log("\t\t\t\topposites: ")
console.log(Object.keys(opossites))
console.log("\t\t\t\t------------------------------------")
}
// just css
......@@ -397,7 +398,7 @@ function LevelButtonDisable( TF ){
//Fixed! apres: refactor!
function graphTagCloudElem(nodes) {
pr("in graphTagCloudElem, nodae_id: "+nodes);
console.log("in graphTagCloudElem, nodae_id: "+nodes);
cancelSelection();
TW.partialGraph.emptyGraph();
......@@ -550,7 +551,7 @@ function graphResetColor(){
}
function hideEverything(){
pr("\thiding all");
console.log("\thiding all");
nodeslength=0;
for(var n in TW.partialGraph._core.graph.nodesIndex){
TW.partialGraph._core.graph.nodesIndex[n].hidden=true;
......@@ -559,7 +560,7 @@ function hideEverything(){
TW.partialGraph._core.graph.edgesIndex[e].hidden=true;
}
overNodes=false;//magic line!
pr("\tall hidded");
console.log("\tall hidded");
//Remember that this function is the analogy of EmptyGraph
//"Saving node positions" should be applied in this function, too.
}
......
......@@ -110,7 +110,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
switch (self.state.step) {
case 0: // Pass init
// pr("case0 - "+"the self.count: "+self.count)
// console.log("case0 - "+"the self.count: "+self.count)
// Initialise layout data
self.count++;
......@@ -185,7 +185,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break;
case 1: // Repulsion
// pr("case1 - "+"the self.count: "+self.count)
// console.log("case1 - "+"the self.count: "+self.count)
var Repulsion = self.ForceFactory.buildRepulsion(
self.p.adjustSizes,
self.p.scalingRatio
......@@ -230,7 +230,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break;
case 2: // Gravity
// pr("case2 - "+"the self.count: "+self.count)
// console.log("case2 - "+"the self.count: "+self.count)
var Gravity = (self.p.strongGravityMode) ?
(self.ForceFactory.getStrongGravity(
self.p.scalingRatio
......@@ -260,7 +260,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break;
case 3: // Attraction
// pr("case3 - "+"the self.count: "+self.count)
// console.log("case3 - "+"the self.count: "+self.count)
var Attraction = self.ForceFactory.buildAttraction(
self.p.linLogMode,
self.p.outboundAttractionDistribution,
......@@ -308,7 +308,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break;
case 4: // Auto adjust speed
// pr("case4 - "+"the self.count: "+self.count)
// console.log("case4 - "+"the self.count: "+self.count)
var totalSwinging = 0; // How much irregular movement
var totalEffectiveTraction = 0; // Hom much useful movement
var swingingSum=0;
......@@ -340,7 +340,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var convg= ((Math.pow(nodes.length,2))/promdxdy); /**/
var swingingVSnodes_length = swingingSum/nodes.length; /**/
if(stopcriteria && (convg > swingingVSnodes_length)){
pr("i've applied the stopcriteria: "+self.count)
console.log("i've applied the stopcriteria: "+self.count)
TW.partialGraph.stopForceAtlas2();
}
......@@ -373,7 +373,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break;
case 5: // Apply forces
// pr("case5 - "+"the self.count: "+self.count)
// console.log("case5 - "+"the self.count: "+self.count)
var i = self.state.index;
if (self.p.adjustSizes) {
var speed = self.p.speed;
......@@ -1120,7 +1120,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
this.forceatlas2.init();
this.forceatlas2.active=true;
// pr("\t\t\t\t\tFA2 Started")
// console.log("\t\t\t\t\tFA2 Started")
var ene = this._core.graph.nodes.length;
var isolatedBCauseFilter = 0;
for (var i in this._core.graph.nodesIndex) {
......@@ -1143,7 +1143,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
// fixing anomaly in forceatlas2
$.doTimeout(250,function (){
if( !present.level && TW.partialGraph.forceatlas2.active && TW.partialGraph.forceatlas2.count==0) {
pr("SUPER JUTSU!!")
console.log("SUPER JUTSU!!")
TW.partialGraph.startForceAtlas2();
return;
}
......@@ -1156,7 +1156,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
var present = TW.partialGraph.states.slice(-1)[0]
if(this.forceatlas2) {
if(this.forceatlas2.count) {
pr("\t\t\t\t\tFA2 Stopped: "+this.forceatlas2.count)
console.log("\t\t\t\t\tFA2 Stopped: "+this.forceatlas2.count)
if(present.level && this.forceatlas2.count>2) {
// not-save-positions if an edge-filter is ON
first_state = present.type;
......@@ -1186,7 +1186,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
if(first_time) {
$.doTimeout(100,function (){
pr("\t\t\t\t\tFirst time FA2 Stopped")
console.log("\t\t\t\t\tFirst time FA2 Stopped")
for(var i in TW.partialGraph._core.graph.nodesIndex){
TW.Nodes[i].x = TW.partialGraph._core.graph.nodesIndex[i].x;
TW.Nodes[i].y = TW.partialGraph._core.graph.nodesIndex[i].y;
......
......@@ -38,23 +38,23 @@ ParseCustom.prototype.scanFile = function() {
switch (this.format) {
case "api.json":
pr("scanFile: "+this.format)
console.log("scanFile: "+this.format)
break;
case "db.json":
pr("scanFile: "+this.format)
console.log("scanFile: "+this.format)
break;
case "json":
pr("scanFile: "+this.format)
console.log("scanFile: "+this.format)
categories = this.getJSONCategories( this.data );
return categories;
break;
case "gexf":
pr("scanFile: "+this.format)
console.log("scanFile: "+this.format)
categories = this.getGEXFCategories( this.data );
return categories;
break;
default:
pr("scanFile jsaispas: "+this.format)
console.log("scanFile jsaispas: "+this.format)
break;
}
};
......@@ -64,23 +64,23 @@ ParseCustom.prototype.makeDicts = function(categories) {
switch (this.format) {
case "api.json":
pr("makeDicts: "+this.format)
console.log("makeDicts: "+this.format)
break;
case "db.json":
pr("makeDicts: "+this.format)
console.log("makeDicts: "+this.format)
break;
case "json":
pr("makeDicts: "+this.format)
console.log("makeDicts: "+this.format)
dictionaries = this.parseJSON( categories );
return dictionaries;
break;
case "gexf":
pr("makeDicts: "+this.format)
console.log("makeDicts: "+this.format)
dictionaries = this.parseGEXF( categories );
return dictionaries;
break;
default:
pr("makeDicts jsaispas: "+this.format)
console.log("makeDicts jsaispas: "+this.format)
break;
}
};
......@@ -240,7 +240,7 @@ function dictfyGexf( gexf , categories ){
var color;
if(colorNodes.length>0){
colorNode = colorNodes[0];
color = '#'+sigma.tools.rgbToHex(parseFloat(colorNode.getAttribute('r')),
color = '#'+sigmaTools.rgbToHex(parseFloat(colorNode.getAttribute('r')),
parseFloat(colorNode.getAttribute('g')),
parseFloat(colorNode.getAttribute('b')));
}// [ / get Colour ]
......
......@@ -460,8 +460,8 @@ sigma.classes.Cascade = function() {
// Interaction listeners:
this.mousecaptor.bind('drag interpolate', function(e) {
//pr("drag stuff");
//pr("click dragging");
//console.log("drag stuff");
//console.log("click dragging");
self.draw(
self.p.auto ? 2 : self.p.drawNodes,
self.p.auto ? 0 : self.p.drawEdges,
......@@ -477,7 +477,7 @@ sigma.classes.Cascade = function() {
);
}).bind('move', function() {
//Detects any movement of the cursor
//pr("move");
//console.log("move");
self.domElements.hover.getContext('2d').clearRect(
0,
0,
......@@ -489,7 +489,7 @@ sigma.classes.Cascade = function() {
drawActive();
// if(cursor_size>0){
// pr("moving with mouse-circle ON");
// console.log("moving with mouse-circle ON");
// }
});
......@@ -1090,7 +1090,7 @@ sigma.classes.Cascade = function() {
tmp = b.replace("rgba(","").replace(")","").split(",")
b = rgbToHex( parseFloat( tmp[0] ) , parseFloat( tmp[1] ) , parseFloat( tmp[2] ) );
}
// pr(source+" : "+a+"\t|\t"+target+" : "+b)
// console.log(source+" : "+a+"\t|\t"+target+" : "+b)
a = hex2rga(a);
b = hex2rga(b);
var r = (a[0] + b[0]) >> 1;
......@@ -1099,7 +1099,7 @@ sigma.classes.Cascade = function() {
// var color = '#'+sigma.tools.rgbToHex(parseFloat(r),parseFloat(g),parseFloat(b))
var color = "rgba( "+r+", "+g+" , "+b+" ,0.5)";
//pr(params.label);
//console.log(params.label);
// if(params.label=="nodes1") {
// color = "#cedc75";
// }
......@@ -1281,31 +1281,31 @@ sigma.classes.Cascade = function() {
self.nodes = [];
if(self.nodes.length>0) {
pr("splicing nodes")
console.log("splicing nodes")
self.nodes.splice(0, self.nodes.length);
}
self.nodesIndex = {};
if(self.nodesIndex.length>0) {
pr("splicing nodesIndex")
console.log("splicing nodesIndex")
self.nodesIndex.splice(0, self.nodesIndex.length);
}
self.edges = [];
if(self.edges.length>0) {
pr("splicing edges")
console.log("splicing edges")
self.edges.splice(0, self.edges.length);
}
self.edgesIndex = {};
if(self.edgesIndex.length>0) {
pr("splicing edgesIndex")
console.log("splicing edgesIndex")
self.edgesIndex.splice(0, self.edgesIndex.length);
}
labels = [];
if(labels.length>0) {
pr("splicing labels")
console.log("splicing labels")
labels.splice(0, labels.length);
}
......
......@@ -13,20 +13,22 @@ SigmaUtils = function () {
var n = nodes[i];
if(initialState[catDict[n.type]]) {
var node = ({
var node = {
id : n.id,
label : n.label,
size : n.size,
color : n.color,
type : n.type,
x : n.x,
y : n.y
})
y : n.y,
type : n.type
}
if(n.shape) node.shape = n.shape;
// console.log(node)
if(Number(n.id)==287) console.log("coordinates of node 287: ( "+n.x+" , "+n.y+" ) ")
graph.addNode( n.id , node);
// REFA new way => no separate id
graph.nodes.push( node);
// fill the "labels" global variable
updateSearchLabels( n.id , n.label , n.type);
......@@ -42,15 +44,23 @@ SigmaUtils = function () {
e = TW.Edges[s+";"+t]
if(e) {
if(e.source != e.target) {
var edge = ({
var edge = {
// sigma mandatory properties
id : e.id,
// REFA was: sourceID, targetID
source : e.source,
target : e.target,
weight : e.weight,
// size : e.weight, // REFA s/weight/size/ ?
hidden : false,
sourceID : e.source,
targetID : e.target,
type : e.type,
weight : e.weight
})
graph.addEdge( e.id , e.source , e.target , edge);
// twjs additional properties
type : e.type
}
// REFA new way
graph.edges.push( edge);
}
}
}
......@@ -309,7 +319,7 @@ function clustersBy(daclass) {
var newval_size = Math.round( ( Min_size+(NodeID_Val[i]["round"]-real_min)*((Max_size-Min_size)/(real_max-real_min)) ) );
TW.partialGraph._core.graph.nodesIndex[i].size = newval_size;
// pr("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
// console.log("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
TW.partialGraph._core.graph.nodesIndex[i].label = "("+NodeID_Val[i]["real"].toFixed(min_pow)+") "+TW.Nodes[i].label
}
......@@ -448,13 +458,13 @@ function colorsRelByBins(daclass) {
function colorsBy(daclass) {
pr("")
pr(" = = = = = = = = = = = = = = = = = ")
pr(" = = = = = = = = = = = = = = = = = ")
pr("colorsBy ( "+daclass+" )")
pr(" = = = = = = = = = = = = = = = = = ")
pr(" = = = = = = = = = = = = = = = = = ")
pr("")
console.log("")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log("colorsBy ( "+daclass+" )")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log("")
if(daclass=="clust_louvain") {
if(!TW.partialGraph.states.slice(-1)[0].LouvainFait) {
......
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