Commit a9d885b7 authored by PkSM3's avatar PkSM3

isolated nodes as circunference

parent 4b809aec
...@@ -101,13 +101,13 @@ ...@@ -101,13 +101,13 @@
</a> </a>
</li> </li>
<!--
<li> <li>
<a> <a>
<button type="button" onclick="makeEdgeWeightUndef();" class="btn btn-sm">wu</button> <button type="button" onclick="partialGraph.stopForceAtlas2();" class="btn btn-sm">wu</button>
</a> </a>
</li> </li>
-->
</ul> </ul>
......
...@@ -52,6 +52,7 @@ var stopcriteria = false; ...@@ -52,6 +52,7 @@ var stopcriteria = false;
var iterationsFA2=1000; var iterationsFA2=1000;
var seed=999999999;//defaultseed var seed=999999999;//defaultseed
var semanticConverged=false; var semanticConverged=false;
var isolatedBCauseFilter = 0;
var showLabelsIfZoom=2.0; var showLabelsIfZoom=2.0;
......
...@@ -229,7 +229,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -229,7 +229,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
} }
partialGraph.stopForceAtlas2() // partialGraph.stopForceAtlas2()
for(var i in finalarray) { for(var i in finalarray) {
ids = finalarray[i] ids = finalarray[i]
if(i>=low && i<=high){ if(i>=low && i<=high){
...@@ -267,7 +267,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -267,7 +267,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh() partialGraph.refresh()
partialGraph.draw() partialGraph.draw()
fa2enabled=true; partialGraph.startForceAtlas2() // fa2enabled=true; partialGraph.startForceAtlas2()
// }); // });
} }
});//doTimeout });//doTimeout
...@@ -362,7 +362,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -362,7 +362,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh() partialGraph.refresh()
partialGraph.draw() partialGraph.draw()
fa2enabled=true; partialGraph.startForceAtlas2() // fa2enabled=true; partialGraph.startForceAtlas2()
} }
} }
......
function draw1Circle(ctx , x , y , color) {
ctx.strokeStyle = '#000';
ctx.lineWidth = 1;
ctx.fillStyle = color;
ctx.globalAlpha = 0.5;
ctx.beginPath();
ctx.arc(x, y, 10, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
ctx.stroke();
}
function trackMouse() { function trackMouse() {
if(!shift_key) { if(!shift_key) {
// $.doTimeout(300,function (){ // $.doTimeout(300,function (){
......
...@@ -993,6 +993,15 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -993,6 +993,15 @@ sigma.publicPrototype.startForceAtlas2 = function() {
//if(!this.forceatlas2) { //if(!this.forceatlas2) {
if(fa2enabled) { if(fa2enabled) {
isolatedBCauseFilter = 0;
for (var i in this._core.graph.nodesIndex) {
if(this._core.graph.nodesIndex[i].degree==0) {
this._core.graph.nodesIndex[i].hidden=true;
isolatedBCauseFilter++;
}
}
// // -- UPDATING THE DEGREE -- // // -- UPDATING THE DEGREE --
// for (var i in this._core.graph.nodesIndex) { // for (var i in this._core.graph.nodesIndex) {
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree) // pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
...@@ -1072,47 +1081,78 @@ sigma.publicPrototype.stopForceAtlas2 = function() { ...@@ -1072,47 +1081,78 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
partialGraph.refresh(); partialGraph.refresh();
if(minimap) $("#overviewzone").show(); if(minimap) $("#overviewzone").show();
for (var i in this._core.graph.nodes) {
if(!this._core.graph.nodes[i].hidden && this._core.graph.nodes[i].degree>0) { // calc dimensions of connected subgraphs
if(this._core.graph.nodes[i].x < minx) minx = this._core.graph.nodes[i].x minx=1000.0;
if(this._core.graph.nodes[i].x > maxx) maxx = this._core.graph.nodes[i].x maxx=0.0;
if(this._core.graph.nodes[i].y < miny) miny = this._core.graph.nodes[i].y miny=1000.0;
if(this._core.graph.nodes[i].y > maxy) maxy = this._core.graph.nodes[i].y maxy=0.0;
} for (var i in this._core.graph.nodes) {
if(!this._core.graph.nodes[i].hidden && this._core.graph.nodes[i].degree>0) {
if(this._core.graph.nodes[i].x < minx) minx = this._core.graph.nodes[i].x
if(this._core.graph.nodes[i].x > maxx) maxx = this._core.graph.nodes[i].x
if(this._core.graph.nodes[i].y < miny) miny = this._core.graph.nodes[i].y
if(this._core.graph.nodes[i].y > maxy) maxy = this._core.graph.nodes[i].y
} }
}
var ybuffer = miny;
for (var i in this._core.graph.nodesIndex) {
if (swMacro && this._core.graph.nodesIndex[i].degree>0) { // var ybuffer = miny;
Nodes[i].x = this._core.graph.nodesIndex[i].x; // for (var i in this._core.graph.nodesIndex) {
Nodes[i].y = this._core.graph.nodesIndex[i].y;
}
if(this._core.graph.nodesIndex[i].degree==0) { // // if (swMacro && this._core.graph.nodesIndex[i].degree>0) {
// this._core.graph.nodesIndex[i].color = "#000000" // // Nodes[i].x = this._core.graph.nodesIndex[i].x;
// // Nodes[i].y = this._core.graph.nodesIndex[i].y;
// // }
// if(this._core.graph.nodesIndex[i].degree==0) {
this._core.graph.nodesIndex[i].x = minx-10 // pr(this._core.graph.nodesIndex[i].label);
this._core.graph.nodesIndex[i].y = ybuffer // this._core.graph.nodesIndex[i].x = minx-10
this._core.graph.nodesIndex[i].displayX = minx-10 // this._core.graph.nodesIndex[i].y = ybuffer
this._core.graph.nodesIndex[i].displayY = ybuffer
// this._core.graph.nodesIndex[i].hidden = true; // ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// this._core.graph.nodesIndex[i].fixed = true; // }
// }
ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// pr(ybuffer) // pr("minx: "+minx)
} // pr("maxx: "+maxx)
// this._core.graph.nodesIndex[i].hidden = true; // pr("miny: "+miny)
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree) // pr("maxy: "+maxy)
} // pr("")
// -- / UPDATING THE DEGREE --
// pr("minx: "+minx) Ox = (minx+maxx)/2;
// pr("maxx: "+maxx) Oy = (miny+maxy)/2;
// pr("miny: "+miny)
// pr("maxy: "+maxy) Ax = minx;
// pr("") Ay = miny;
// var ctx = partialGraph._core.domElements.mouse.getContext('2d');
// ctx.globalCompositeOperation = "source-over";
// ctx.clearRect(0, 0, partialGraph._core.domElements.nodes.width, partialGraph._core.domElements.nodes.height);
// draw1Circle(ctx,minx,miny,"aqua") // point A
// draw1Circle(ctx,maxx,miny,"blue") // point B
// draw1Circle(ctx,minx,maxy,"coral") //point C
// draw1Circle(ctx,maxx,maxy,"darkorange") // point D
// draw1Circle(ctx, Ox , Oy ,"red") // Center
var R = Math.sqrt( Math.pow((Ox-Ax), 2) + Math.pow((Oy-Ay), 2) );
R = R * 1.2;
stepDeg = 2/parseFloat(isolatedBCauseFilter);
var mult = 1;
for (var i in this._core.graph.nodes) {
if(this._core.graph.nodes[i].degree==0) {
this._core.graph.nodes[i].hidden=false;
this._core.graph.nodes[i].x = Ox + R*Math.cos(Math.PI*stepDeg*mult);
this._core.graph.nodes[i].y = Oy + R*Math.sin(Math.PI*stepDeg*mult);
mult++;
}
}
}; };
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