Commit ddf70c01 authored by PkSM3's avatar PkSM3

anomaly in startfa2 count=0|active=true: RESOLVED

parent 90f88358
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
function changeType() { function changeType() {
pr("***swclickActual:"+swclickActual+" , swMacro:"+swMacro) pr("***swclickActual:"+swclickActual+" , swMacro:"+swMacro)
partialGraph.stopForceAtlas2(); // partialGraph.stopForceAtlas2();
if(swclickActual=="social") { if(swclickActual=="social") {
if(swMacro) { if(swMacro) {
...@@ -89,7 +89,7 @@ function changeLevel() { ...@@ -89,7 +89,7 @@ function changeLevel() {
bf=swclickActual bf=swclickActual
pushSWClick(swclickActual); pushSWClick(swclickActual);
pr("swMacro: "+swMacro+" - [swclickPrev: "+bf+"] - [swclickActual: "+swclickActual+"]") pr("swMacro: "+swMacro+" - [swclickPrev: "+bf+"] - [swclickActual: "+swclickActual+"]")
partialGraph.stopForceAtlas2(); // partialGraph.stopForceAtlas2();
// ANALIZING CURRENT STATE: // ANALIZING CURRENT STATE:
if(swMacro){ if(swMacro){
// Macro Level -- swMacro:true // Macro Level -- swMacro:true
...@@ -341,10 +341,8 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -341,10 +341,8 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
pushFilterValue( sliderDivID , filtervalue ) pushFilterValue( sliderDivID , filtervalue )
return false return false
} }
// $.doTimeout(300,function (){
// pr(finalarray)
partialGraph.stopForceAtlas2(); // partialGraph.stopForceAtlas2();
for(var i in finalarray) { for(var i in finalarray) {
ids = finalarray[i] ids = finalarray[i]
...@@ -370,9 +368,9 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -370,9 +368,9 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh() partialGraph.refresh()
partialGraph.draw() partialGraph.draw()
$.doTimeout(300,function(){ // $.doTimeout(300,function(){
fa2enabled=true; partialGraph.startForceAtlas2(); // fa2enabled=true; partialGraph.startForceAtlas2();
}); // });
// fa2enabled=true; partialGraph.startForceAtlas2() // fa2enabled=true; partialGraph.startForceAtlas2()
} }
......
...@@ -262,7 +262,6 @@ function theListeners(){ ...@@ -262,7 +262,6 @@ function 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
// startForceAtlas2(partialGraph._core.graph);r(
cancelSelection(false); cancelSelection(false);
$("#tips").html(getTips()); $("#tips").html(getTips());
...@@ -373,7 +372,7 @@ function theListeners(){ ...@@ -373,7 +372,7 @@ function theListeners(){
partialGraph.position(0,0,1); partialGraph.position(0,0,1);
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8); partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
partialGraph.refresh(); partialGraph.refresh();
partialGraph.startForceAtlas2(); // partialGraph.startForceAtlas2();
}); });
$('#sigma-example').dblclick(function(event) { $('#sigma-example').dblclick(function(event) {
...@@ -513,12 +512,26 @@ function theListeners(){ ...@@ -513,12 +512,26 @@ function theListeners(){
}); });
$("#edgesButton").click(function () { $("#edgesButton").click(function () {
if(!fa2enabled){
fa2enabled=true; pr("click en #edgesButton")
partialGraph.startForceAtlas2(); pr(partialGraph.forceatlas2)
fa2enabled=true;
if(!isUndef(partialGraph.forceatlas2)) {
if(partialGraph.forceatlas2.active) {
partialGraph.stopForceAtlas2();
partialGraph.draw();
return;
} else {
partialGraph.startForceAtlas2();
return;
}
} else { } else {
partialGraph.stopForceAtlas2(); partialGraph.startForceAtlas2();
return;
} }
}); });
......
...@@ -1370,7 +1370,6 @@ function unHide(id){ ...@@ -1370,7 +1370,6 @@ function unHide(id){
} }
partialGraph.addNode(id,anode); partialGraph.addNode(id,anode);
pr(partialGraph._core.graph.nodesIndex[id].displayX)
return; return;
} }
} }
...@@ -1449,8 +1448,12 @@ function unHideElem(id){ ...@@ -1449,8 +1448,12 @@ function unHideElem(id){
function changeToMeso(iwannagraph) { function changeToMeso(iwannagraph) {
labels=[] labels=[]
partialGraph.stopForceAtlas2();
// partialGraph.stopForceAtlas2();
partialGraph.emptyGraph(); partialGraph.emptyGraph();
if(partialGraph.forceatlas2)
pr("t=2: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
pr("changing to Meso-"+iwannagraph); pr("changing to Meso-"+iwannagraph);
if(iwannagraph=="social") { if(iwannagraph=="social") {
if(!is_empty(selections)){ if(!is_empty(selections)){
...@@ -1546,7 +1549,12 @@ function changeToMeso(iwannagraph) { ...@@ -1546,7 +1549,12 @@ function changeToMeso(iwannagraph) {
} }
if(iwannagraph=="sociosemantic") { if(iwannagraph=="sociosemantic") {
if(partialGraph.forceatlas2)
pr("t=3: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
if(!is_empty(selections) && !is_empty(opossites)){ if(!is_empty(selections) && !is_empty(opossites)){
pr("ESTOY DENTRO DE SOCIOSEMANTIC!!!")
// hideEverything(); // hideEverything();
for(var i in selections) { for(var i in selections) {
unHide(i); unHide(i);
...@@ -1556,7 +1564,13 @@ function changeToMeso(iwannagraph) { ...@@ -1556,7 +1564,13 @@ function changeToMeso(iwannagraph) {
unHide(i); unHide(i);
} }
if(partialGraph.forceatlas2)
pr("t=4: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
createEdgesForExistingNodes(iwannagraph); createEdgesForExistingNodes(iwannagraph);
if(partialGraph.forceatlas2)
pr("t=5: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
socsemFlag=true; socsemFlag=true;
} }
...@@ -1564,6 +1578,10 @@ function changeToMeso(iwannagraph) { ...@@ -1564,6 +1578,10 @@ function changeToMeso(iwannagraph) {
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size") // NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight"); // EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
$("#colorGraph").hide(); $("#colorGraph").hide();
if(partialGraph.forceatlas2)
pr("t=6: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
} }
if(iwannagraph=="semantic") { if(iwannagraph=="semantic") {
...@@ -1641,9 +1659,13 @@ function changeToMeso(iwannagraph) { ...@@ -1641,9 +1659,13 @@ function changeToMeso(iwannagraph) {
$("#colorGraph").hide(); $("#colorGraph").hide();
} }
MultipleSelection(Object.keys(selections)); if(partialGraph.forceatlas2)
pr("t=7: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
fa2enabled=true; partialGraph.startForceAtlas2(); fa2enabled=true; partialGraph.startForceAtlas2();
MultipleSelection(Object.keys(selections));
$('.gradient').css({"background-size":"90px 90px"}); $('.gradient').css({"background-size":"90px 90px"});
} }
...@@ -1651,17 +1673,8 @@ function changeToMeso(iwannagraph) { ...@@ -1651,17 +1673,8 @@ function changeToMeso(iwannagraph) {
function changeToMacro(iwannagraph) { function changeToMacro(iwannagraph) {
labels=[] labels=[]
pr("CHANGING TO Macro-"+iwannagraph); pr("CHANGING TO Macro-"+iwannagraph);
// pr("BEFORE cancelSelection()")
// for(var i in partialGraph._core.graph.nodesIndex) {
// pr(partialGraph._core.graph.nodesIndex[i].id+" : "+partialGraph._core.graph.nodesIndex[i].color+" <=> "+Nodes[i].id+" : "+Nodes[i].color)
// pr(partialGraph._core.graph.nodesIndex[i])
// pr("")
// }
// pr("--------------------------------------------------------------------------------")
partialGraph.stopForceAtlas2(); // partialGraph.stopForceAtlas2();
partialGraph.emptyGraph(); partialGraph.emptyGraph();
if ( iwannagraph=="semantic" && !semanticConverged ) { if ( iwannagraph=="semantic" && !semanticConverged ) {
...@@ -1686,29 +1699,16 @@ function changeToMacro(iwannagraph) { ...@@ -1686,29 +1699,16 @@ function changeToMacro(iwannagraph) {
unHide(n); unHide(n);
} }
} // and semantic edges } // and semantic edges
pr("im here")
createEdgesForExistingNodes(iwannagraph);
pr("im also here")
pr("nodes:") createEdgesForExistingNodes(iwannagraph);
pr(partialGraph._core.graph.nodesIndex)
pr("edges:")
pr(partialGraph._core.graph.edgesIndex)
if(iwannagraph=="social") showMeSomeLabels(6); if(iwannagraph=="social") showMeSomeLabels(6);
swMacro=true; swMacro=true;
pr("im now here")
if (!is_empty(selections)) if (!is_empty(selections))
$.doTimeout(10,function (){ $.doTimeout(10,function (){
chosenones=(PAST=="a"||PAST=="b")?selections:opossites; chosenones=(PAST=="a"||PAST=="b")?selections:opossites;
pr("the chosen ones")
pr(chosenones)
MultipleSelection(Object.keys(chosenones)) MultipleSelection(Object.keys(chosenones))
pr("im now right here")
}); });
} else { } else {
...@@ -1767,13 +1767,9 @@ function changeToMacro(iwannagraph) { ...@@ -1767,13 +1767,9 @@ function changeToMacro(iwannagraph) {
$("#colorGraph").hide(); $("#colorGraph").hide();
} }
}); });
// highlightSelectedNodes(true);
// // partialGraph.stopForceAtlas2(); // fa2enabled=true; partialGraph.startForceAtlas2();
// partialGraph.draw();
// // partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
// partialGraph.refresh();
fa2enabled=true; partialGraph.startForceAtlas2();
$('.gradient').css({"background-size":"40px 40px"}); $('.gradient').css({"background-size":"40px 40px"});
} }
......
...@@ -9,6 +9,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -9,6 +9,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var self = this; var self = this;
this.graph = graph; this.graph = graph;
this.count=0; this.count=0;
this.active = false;
this.isolated=0; this.isolated=0;
this.stepDeg = 0; this.stepDeg = 0;
...@@ -108,6 +109,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -108,6 +109,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
switch (self.state.step) { switch (self.state.step) {
case 0: // Pass init case 0: // Pass init
// pr("case0 - "+"the self.count: "+self.count)
// Initialise layout data // Initialise layout data
self.count++; self.count++;
...@@ -182,6 +184,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -182,6 +184,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break; break;
case 1: // Repulsion case 1: // Repulsion
// pr("case1 - "+"the self.count: "+self.count)
var Repulsion = self.ForceFactory.buildRepulsion( var Repulsion = self.ForceFactory.buildRepulsion(
self.p.adjustSizes, self.p.adjustSizes,
self.p.scalingRatio self.p.scalingRatio
...@@ -226,6 +229,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -226,6 +229,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break; break;
case 2: // Gravity case 2: // Gravity
// pr("case2 - "+"the self.count: "+self.count)
var Gravity = (self.p.strongGravityMode) ? var Gravity = (self.p.strongGravityMode) ?
(self.ForceFactory.getStrongGravity( (self.ForceFactory.getStrongGravity(
self.p.scalingRatio self.p.scalingRatio
...@@ -255,6 +259,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -255,6 +259,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break; break;
case 3: // Attraction case 3: // Attraction
// pr("case3 - "+"the self.count: "+self.count)
var Attraction = self.ForceFactory.buildAttraction( var Attraction = self.ForceFactory.buildAttraction(
self.p.linLogMode, self.p.linLogMode,
self.p.outboundAttractionDistribution, self.p.outboundAttractionDistribution,
...@@ -302,6 +307,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -302,6 +307,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break; break;
case 4: // Auto adjust speed case 4: // Auto adjust speed
// pr("case4 - "+"the self.count: "+self.count)
var totalSwinging = 0; // How much irregular movement var totalSwinging = 0; // How much irregular movement
var totalEffectiveTraction = 0; // Hom much useful movement var totalEffectiveTraction = 0; // Hom much useful movement
var swingingSum=0; var swingingSum=0;
...@@ -366,9 +372,9 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -366,9 +372,9 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
break; break;
case 5: // Apply forces case 5: // Apply forces
// pr("case5 - "+"the self.count: "+self.count)
var i = self.state.index; var i = self.state.index;
if (self.p.adjustSizes) { if (self.p.adjustSizes) {
pr("en este caso");
var speed = self.p.speed; var speed = self.p.speed;
// If nodes overlap prevention is active, // If nodes overlap prevention is active,
// it's not possible to trust the swinging mesure. // it's not possible to trust the swinging mesure.
...@@ -397,7 +403,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -397,7 +403,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
if(self.count%50 == 0) { if(self.isolated>0 && self.count%50 == 0) {
nodes.forEach(function(n) { nodes.forEach(function(n) {
if(n.degree>0) { if(n.degree>0) {
if(n.x < self.minx) self.minx = n.x if(n.x < self.minx) self.minx = n.x
...@@ -422,10 +428,6 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -422,10 +428,6 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
}); });
} }
} else { } else {
var speed = self.p.speed; var speed = self.p.speed;
while (i < nodes.length && i < self.state.index + sInt) { while (i < nodes.length && i < self.state.index + sInt) {
...@@ -448,7 +450,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -448,7 +450,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
if(self.count%50 == 0) { if(self.isolated>0 && self.count%50 == 0) {
nodes.forEach(function(n) { nodes.forEach(function(n) {
if(n.degree>0) { if(n.degree>0) {
if(n.x < self.minx) self.minx = n.x if(n.x < self.minx) self.minx = n.x
...@@ -475,14 +477,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -475,14 +477,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
// pr("\t in case 5, i="+i+" | nbnodes="+nodes.length)
// pr("\tstate index: "+self.state.index)
// pr("\tthe self.count: "+self.count)
if (i == nodes.length) { if (i == nodes.length) {
self.state.step = 0; self.state.step = 0;
self.state.index = 0; self.state.index = 0;
// pr("\t\tafter the thing")
return false; return false;
} else { } else {
self.state.index = i; self.state.index = i;
// pr("else state index: "+self.state.index)
return true; return true;
} }
break; break;
default: default:
...@@ -495,8 +504,6 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -495,8 +504,6 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
this.graph.nodes.forEach(function(n) { this.graph.nodes.forEach(function(n) {
n.fa2 = null; n.fa2 = null;
}); });
pr("#nodes: "+V);
pr("#edges: "+E);
} }
// Auto Settings // Auto Settings
...@@ -1111,30 +1118,6 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1111,30 +1118,6 @@ sigma.publicPrototype.startForceAtlas2 = function() {
if(fa2enabled) { if(fa2enabled) {
pr("\t\t\t\t\tFA2 Started")
var ene = this._core.graph.nodes.length;
var isolatedBCauseFilter = 0;
for (var i in this._core.graph.nodesIndex) {
if(this._core.graph.nodesIndex[i].degree==0) isolatedBCauseFilter++;
}
pr("|||||||||| probando una cosa super loca")
pr("|||||||||| isolatedBCauseFilter "+isolatedBCauseFilter)
pr("|||||||||| ene "+ene)
pr("isolatedBCauseFilter==ene = "+(isolatedBCauseFilter==ene))
if(isolatedBCauseFilter==ene) {
partialGraph.stopForceAtlas2();
return;
}
// // -- UPDATING THE DEGREE -- // // -- UPDATING THE DEGREE --
...@@ -1199,21 +1182,67 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1199,21 +1182,67 @@ sigma.publicPrototype.startForceAtlas2 = function() {
var V = 10; var V = 10;
var E = 100; var E = 100;
if(partialGraph.forceatlas2)
pr("t=8: in startfa2 : forceatlas2.active = "+partialGraph.forceatlas2.active)
this.forceatlas2 = new sigma.forceatlas2.ForceAtlas2(this._core.graph , V, E); this.forceatlas2 = new sigma.forceatlas2.ForceAtlas2(this._core.graph , V, E);
this.forceatlas2.setAutoSettings(); this.forceatlas2.setAutoSettings();
this.forceatlas2.init(); this.forceatlas2.init();
if(partialGraph.forceatlas2)
pr("t=9: in startfa2 : forceatlas2.active = "+partialGraph.forceatlas2.active)
this.forceatlas2.active=true;
pr("\t\t\t\t\tFA2 Started")
var ene = this._core.graph.nodes.length;
var isolatedBCauseFilter = 0;
for (var i in this._core.graph.nodesIndex) {
if(this._core.graph.nodesIndex[i].degree==0) isolatedBCauseFilter++;
}
if(partialGraph.forceatlas2)
pr("t=10: in startfa2 : forceatlas2.active = "+partialGraph.forceatlas2.active)
pr("|||||||||| isolatedBCauseFilter "+isolatedBCauseFilter)
pr("|||||||||| ene "+ene)
pr("isolatedBCauseFilter==ene = "+(isolatedBCauseFilter==ene))
if(isolatedBCauseFilter==ene) {
partialGraph.stopForceAtlas2();
return;
}
$("#overviewzone").hide(); $("#overviewzone").hide();
this.addGenerator('forceatlas2', this.forceatlas2.atomicGo, function(){ this.addGenerator('forceatlas2', this.forceatlas2.atomicGo, function(){
return true; return true;
}); });
pr(getClientTime()+"\tjust before addGenerator | fa2.active:"+partialGraph.forceatlas2.active+" | fa2.count: "+partialGraph.forceatlas2.count);
$.doTimeout(250,function (){
pr(getClientTime()+"\tjust after addGenerator | fa2.active:"+partialGraph.forceatlas2.active+" | fa2.count: "+partialGraph.forceatlas2.count);
if( partialGraph.forceatlas2.active && partialGraph.forceatlas2.count==0 ) {
pr("SUPER TECHNIQUE")
partialGraph.startForceAtlas2();
return;
}
});
} }
}; };
sigma.publicPrototype.stopForceAtlas2 = function() { sigma.publicPrototype.stopForceAtlas2 = function() {
pr("\t\t\t\t\tFA2 Stopped") pr("\t\t\t\t\tFA2 Stopped")
fa2enabled=false;
this.removeGenerator('forceatlas2'); this.removeGenerator('forceatlas2');
this.forceatlas2.active=false;
this.forceatlas2.count=0;
updateMap(); updateMap();
partialGraph.refresh(); partialGraph.refresh();
if(minimap) $("#overviewzone").show(); if(minimap) $("#overviewzone").show();
......
...@@ -1274,6 +1274,13 @@ sigma.classes.Cascade = function() { ...@@ -1274,6 +1274,13 @@ sigma.classes.Cascade = function() {
*/ */
function empty() { function empty() {
if(partialGraph) {
if(partialGraph.forceatlas2) {
pr("t=0: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
partialGraph.stopForceAtlas2();
pr("t=1: in empty graph : forceatlas2.active = "+partialGraph.forceatlas2.active)
}
}
self.nodes = []; self.nodes = [];
if(self.nodes.length>0) { if(self.nodes.length>0) {
......
...@@ -31,7 +31,7 @@ function test2 { ...@@ -31,7 +31,7 @@ function test2 {
for f in $iter for f in $iter
do do
filename=`echo $f | sed s/"\.\/"//g` filename=`echo $f | sed s/"\.\/"//g`
variable=`cat $filename | grep "pushFilterValue"` variable=`cat $filename | grep "fa2enabled"`
if [[ "$variable" != "" ]] if [[ "$variable" != "" ]]
then then
echo $filename echo $filename
......
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