Commit a9d885b7 authored by PkSM3's avatar PkSM3

isolated nodes as circunference

parent 4b809aec
......@@ -101,13 +101,13 @@
</a>
</li>
<!--
<li>
<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>
</li>
-->
</ul>
......
......@@ -52,6 +52,7 @@ var stopcriteria = false;
var iterationsFA2=1000;
var seed=999999999;//defaultseed
var semanticConverged=false;
var isolatedBCauseFilter = 0;
var showLabelsIfZoom=2.0;
......
......@@ -229,7 +229,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}
partialGraph.stopForceAtlas2()
// partialGraph.stopForceAtlas2()
for(var i in finalarray) {
ids = finalarray[i]
if(i>=low && i<=high){
......@@ -267,7 +267,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh()
partialGraph.draw()
fa2enabled=true; partialGraph.startForceAtlas2()
// fa2enabled=true; partialGraph.startForceAtlas2()
// });
}
});//doTimeout
......@@ -362,7 +362,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh()
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() {
if(!shift_key) {
// $.doTimeout(300,function (){
......
......@@ -993,6 +993,15 @@ sigma.publicPrototype.startForceAtlas2 = function() {
//if(!this.forceatlas2) {
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 --
// for (var i in this._core.graph.nodesIndex) {
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
......@@ -1072,47 +1081,78 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
partialGraph.refresh();
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) {
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
}
// calc dimensions of connected subgraphs
minx=1000.0;
maxx=0.0;
miny=1000.0;
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) {
Nodes[i].x = this._core.graph.nodesIndex[i].x;
Nodes[i].y = this._core.graph.nodesIndex[i].y;
}
// var ybuffer = miny;
// for (var i in this._core.graph.nodesIndex) {
if(this._core.graph.nodesIndex[i].degree==0) {
// this._core.graph.nodesIndex[i].color = "#000000"
// // if (swMacro && this._core.graph.nodesIndex[i].degree>0) {
// // Nodes[i].x = this._core.graph.nodesIndex[i].x;
// // Nodes[i].y = this._core.graph.nodesIndex[i].y;
// // }
this._core.graph.nodesIndex[i].x = minx-10
this._core.graph.nodesIndex[i].y = ybuffer
this._core.graph.nodesIndex[i].displayX = minx-10
this._core.graph.nodesIndex[i].displayY = ybuffer
// this._core.graph.nodesIndex[i].hidden = true;
// this._core.graph.nodesIndex[i].fixed = true;
ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// pr(ybuffer)
}
// this._core.graph.nodesIndex[i].hidden = true;
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
}
// -- / UPDATING THE DEGREE --
// if(this._core.graph.nodesIndex[i].degree==0) {
// pr(this._core.graph.nodesIndex[i].label);
// this._core.graph.nodesIndex[i].x = minx-10
// this._core.graph.nodesIndex[i].y = ybuffer
// ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// }
// }
// pr("minx: "+minx)
// pr("maxx: "+maxx)
// pr("miny: "+miny)
// pr("maxy: "+maxy)
// pr("")
// pr("minx: "+minx)
// pr("maxx: "+maxx)
// pr("miny: "+miny)
// pr("maxy: "+maxy)
// pr("")
Ox = (minx+maxx)/2;
Oy = (miny+maxy)/2;
Ax = minx;
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