Commit ddf70c01 authored by PkSM3's avatar PkSM3

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

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