Commit 4a2a92f3 authored by PkSM3's avatar PkSM3

backup before restruct

parent 8ba35897
...@@ -60,7 +60,7 @@ var ForceAtlas2 = function(graph) { ...@@ -60,7 +60,7 @@ var ForceAtlas2 = function(graph) {
switch (self.state.step) { switch (self.state.step) {
case 0: // Pass init case 0: // Pass init
// Initialise layout data // Initialise layout data
// pr("caso 0") // pr("caso 0")
nodes.forEach(function(n) { nodes.forEach(function(n) {
if(n.fa2) { if(n.fa2) {
n.fa2.mass = 1 + n.degree; n.fa2.mass = 1 + n.degree;
...@@ -99,7 +99,7 @@ var ForceAtlas2 = function(graph) { ...@@ -99,7 +99,7 @@ var ForceAtlas2 = function(graph) {
break; break;
case 1: // Repulsion case 1: // Repulsion
// pr("caso 1") // pr("caso 1")
var Repulsion = self.ForceFactory.buildRepulsion( var Repulsion = self.ForceFactory.buildRepulsion(
self.p.adjustSizes, self.p.adjustSizes,
self.p.scalingRatio self.p.scalingRatio
...@@ -144,7 +144,7 @@ var ForceAtlas2 = function(graph) { ...@@ -144,7 +144,7 @@ var ForceAtlas2 = function(graph) {
break; break;
case 2: // Gravity case 2: // Gravity
// pr("caso 2") // pr("caso 2")
var Gravity = (self.p.strongGravityMode) ? var Gravity = (self.p.strongGravityMode) ?
(self.ForceFactory.getStrongGravity( (self.ForceFactory.getStrongGravity(
self.p.scalingRatio self.p.scalingRatio
...@@ -174,7 +174,7 @@ var ForceAtlas2 = function(graph) { ...@@ -174,7 +174,7 @@ var ForceAtlas2 = function(graph) {
break; break;
case 3: // Attraction case 3: // Attraction
// pr("caso 3") // pr("caso 3")
var Attraction = self.ForceFactory.buildAttraction( var Attraction = self.ForceFactory.buildAttraction(
self.p.linLogMode, self.p.linLogMode,
self.p.outboundAttractionDistribution, self.p.outboundAttractionDistribution,
...@@ -216,7 +216,7 @@ var ForceAtlas2 = function(graph) { ...@@ -216,7 +216,7 @@ var ForceAtlas2 = function(graph) {
break; break;
case 4: // Auto adjust speed case 4: // Auto adjust speed
// pr("caso 4") // pr("caso 4")
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;
...@@ -278,7 +278,7 @@ var ForceAtlas2 = function(graph) { ...@@ -278,7 +278,7 @@ var ForceAtlas2 = function(graph) {
break; break;
case 5: // Apply forces case 5: // Apply forces
// pr("caso 5") // pr("caso 5")
var i = self.state.index; var i = self.state.index;
if (self.p.adjustSizes) { if (self.p.adjustSizes) {
var speed = self.p.speed; var speed = self.p.speed;
...@@ -964,6 +964,20 @@ var startForceAtlas2 = function(graph,limit_it) { ...@@ -964,6 +964,20 @@ var startForceAtlas2 = function(graph,limit_it) {
// pr(graph.nodes[0].x) // pr(graph.nodes[0].x)
// pr(graph.nodes[0].y) // pr(graph.nodes[0].y)
// pr("--------") // pr("--------")
// nodes = graph.nodes;
// for(var n in nodes) {
// if(!nodes[n].hidden)
// nodes[n].degree = 0;
// }
// edges = graph.edges;
// for(var e in edges) {
// if(!edges[e].hidden) {
// }
// }
forceatlas2 = new ForceAtlas2(graph); forceatlas2 = new ForceAtlas2(graph);
forceatlas2.setAutoSettings(); forceatlas2.setAutoSettings();
forceatlas2.init(); forceatlas2.init();
......
...@@ -172,6 +172,7 @@ function changeType() { ...@@ -172,6 +172,7 @@ function changeType() {
} }
return; return;
} }
if(swclickActual=="semantic") { if(swclickActual=="semantic") {
if(swMacro) { if(swMacro) {
changeToMacro("social"); changeToMacro("social");
...@@ -184,6 +185,7 @@ function changeType() { ...@@ -184,6 +185,7 @@ function changeType() {
} }
return; return;
} }
if(swclickActual=="sociosemantic") { if(swclickActual=="sociosemantic") {
if(swMacro) { if(swMacro) {
......
...@@ -228,6 +228,40 @@ function bringTheNoise(pathfile,type){ ...@@ -228,6 +228,40 @@ function bringTheNoise(pathfile,type){
var netname = pathfile.replace(/\_/g, ' ').toUpperCase(); var netname = pathfile.replace(/\_/g, ' ').toUpperCase();
$("#network").html(netname); $("#network").html(netname);
// < === ASYNCHRONOUS FA2.JS === > // < === ASYNCHRONOUS FA2.JS === >
// var vis_nds = getVisibleNodes();
// pr("before_change... visible nodes:")
// for(var i in vis_nds)
// pr(vis_nds[i].id+" : "+vis_nds[i].degree)
// var vis_ndsIndex = {}
// for(var n in vis_nds) {
// id = vis_nds[n].id
// vis_ndsIndex[id] = vis_nds[n]
// vis_ndsIndex[id].degree = 0;
// }
// var vis_edgs = getVisibleEdges();
// for(var e in vis_edgs) {
// e1 = vis_edgs[e]
// n1 = e1.source.id
// n2 = e1.target.id
// vis_ndsIndex[n1]["degree"]++;
// vis_ndsIndex[n2]["degree"]++;
// }
// pr("after_change... visible nodes:")
// for(var i in vis_ndsIndex)
// pr(vis_ndsIndex[i].id+" : "+vis_ndsIndex[i].degree)
pr(getClientTime()+" : Ini FA2"); pr(getClientTime()+" : Ini FA2");
var ForceAtlas2 = new Worker("FA2.js"); var ForceAtlas2 = new Worker("FA2.js");
ForceAtlas2.postMessage({ ForceAtlas2.postMessage({
...@@ -628,7 +662,7 @@ function theListeners(){ ...@@ -628,7 +662,7 @@ function theListeners(){
}); });
//NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size") // NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); // EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
......
...@@ -643,7 +643,8 @@ function extractFromJson(data,seed){ ...@@ -643,7 +643,8 @@ function extractFromJson(data,seed){
nodeK = Nodes[i]; nodeK = Nodes[i];
nodeK.hidden=true;/**///should be uncommented nodeK.hidden=true;/**///should be uncommented
partialGraph.addNode(i,nodeK); partialGraph.addNode(i,nodeK);
} else { }
else {
partialGraph.addNode(i,Nodes[i]); partialGraph.addNode(i,Nodes[i]);
unHide(i); unHide(i);
} }
......
...@@ -55,11 +55,17 @@ function getedgesIndex(){ ...@@ -55,11 +55,17 @@ function getedgesIndex(){
} }
function getVisibleEdges() { function getVisibleEdges() {
partialGraph._core.graph.edges.filter(function(e) { return partialGraph._core.graph.edges.filter(function(e) {
return !e['hidden']; return !e['hidden'];
}); });
} }
function getVisibleNodes() {
return partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden'];
});
}
function getn(id){ function getn(id){
return partialGraph._core.graph.nodesIndex[id]; return partialGraph._core.graph.nodesIndex[id];
} }
......
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