Commit 7a520bf1 authored by PkSM3's avatar PkSM3

cleaning the dead code

parent b38dc494
...@@ -380,6 +380,8 @@ ...@@ -380,6 +380,8 @@
<script src="libs/bootstrap/js/bootstrap-hover-dropdown.min.js" type="text/javascript"></script> <script src="libs/bootstrap/js/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<!--<script src="libs/bootstrap-select.min.js" type="text/javascript"></script>--> <!--<script src="libs/bootstrap-select.min.js" type="text/javascript"></script>-->
<script src="tinawebJS/js/globalUtils.js" type="text/javascript"></script>
<script src="geomap2/js/raphael/raphael-min.js" charset="utf-8" ></script> <script src="geomap2/js/raphael/raphael-min.js" charset="utf-8" ></script>
<script src="geomap2/js/jquery.mapael.js" charset="utf-8" ></script> <script src="geomap2/js/jquery.mapael.js" charset="utf-8" ></script>
......
...@@ -51,9 +51,6 @@ function changeType() { ...@@ -51,9 +51,6 @@ function changeType() {
if(swclickActual=="sociosemantic") { if(swclickActual=="sociosemantic") {
pr("click en changeType y estoy en SocioSemantic, swMacro:"+swMacro+"|selections:");
pr(selections)
if(swMacro) { if(swMacro) {
changeToMacro("sociosemantic"); changeToMacro("sociosemantic");
pushSWClick("sociosemantic"); pushSWClick("sociosemantic");
...@@ -66,18 +63,15 @@ function changeType() { ...@@ -66,18 +63,15 @@ function changeType() {
RefreshState(PAST.toUpperCase()) RefreshState(PAST.toUpperCase())
} else { } else {
//there is an active selection //there is an active selection
//identify type of the current-selection //identify type of the current-selection
var countTypes = {}; var countTypes = {};
pr("identify type of the current-selection")
for(var i in selections) { for(var i in selections) {
if( isUndef(countTypes[Nodes[i].type]) ) if( isUndef(countTypes[Nodes[i].type]) )
countTypes[Nodes[i].type]=1; countTypes[Nodes[i].type]=1;
else else
countTypes[Nodes[i].type]++; countTypes[Nodes[i].type]++;
} }
pr("bigraph #selectionsTypes: ")
pr("#selectionsTypes: ")
pr(countTypes) pr(countTypes)
...@@ -85,7 +79,6 @@ function changeType() { ...@@ -85,7 +79,6 @@ function changeType() {
if(cpCountTypes.length==1) { if(cpCountTypes.length==1) {
if(cpCountTypes[0]==catSoc) { if(cpCountTypes[0]==catSoc) {
pr("FROM MESO-SOCIOSEMANTIC TO MESO-SOCIAL")
pushSWClick("social"); pushSWClick("social");
changeToMeso("social"); changeToMeso("social");
RefreshState("a"); RefreshState("a");
...@@ -97,9 +90,8 @@ function changeType() { ...@@ -97,9 +90,8 @@ function changeType() {
} }
} else { } else {
//there is a selection of both kind of nodes //there is a selection with both kind of nodes
// //Manually changing the selection, not using MultipleSelection
var ndsids = []; var ndsids = [];
for(var i in selections) { for(var i in selections) {
if( Nodes[i].type == catSoc ) if( Nodes[i].type == catSoc )
...@@ -109,34 +101,16 @@ function changeType() { ...@@ -109,34 +101,16 @@ function changeType() {
for(var i in ndsids){ for(var i in ndsids){
nodeid = ndsids[i] nodeid = ndsids[i]
getOpossitesNodes(nodeid,false); //false -> just nodeid getOpossitesNodes(nodeid,false); //false -> just nodeid
// markAsSelected(nodeid,true);
} }
pushSWClick("social"); pushSWClick("social");
changeToMeso("social"); changeToMeso("social");
RefreshState("a"); RefreshState("a");
} }
// pushSWClick(swclickPrev);
// changeToMeso(swclickActual);
// RefreshState(PAST)
} }
} }
// if(swMacro) {
// changeToMacro("semantic");
// pushSWClick("semantic");
// RefreshState("B")
// $("#category-A").hide();
// $("#category-B").show();
// } else {
// changeToMeso("sociosemantic");
// pushSWClick("sociosemantic");
// RefreshState("AaBb")
// $("#category-A").show();
// $("#category-B").show();
// }
return; return;
} }
} }
...@@ -145,8 +119,7 @@ function changeLevel() { ...@@ -145,8 +119,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();
// ANALIZING CURRENT STATE:
if(swMacro){ if(swMacro){
// Macro Level -- swMacro:true // Macro Level -- swMacro:true
if(swclickActual=="social") { if(swclickActual=="social") {
...@@ -174,39 +147,8 @@ function changeLevel() { ...@@ -174,39 +147,8 @@ function changeLevel() {
return; return;
} }
// changeToMeso("social")
// changeToMeso("semantic")
// changeToMacro("social")
// changeToMacro("semantic")
} }
//obsolete
function neweffectshow(){
if(!is_empty(selections)){
$("#labelchange").show();
$("#availableView").show();
}
}
//obsolete
function neweffecthide(){
$.doTimeout(300,function (){
if($("#labelchange")[0].hidden==false){
}
else {
$("#labelchange").hide();
$("#availableView").hide();
}
});
}
//obsolete
function justhide(){
$("#labelchange").hide();
$("#availableView").hide();
}
//============================= </ NEW BUTTONS > =============================// //============================= </ NEW BUTTONS > =============================//
...@@ -218,6 +160,8 @@ function justhide(){ ...@@ -218,6 +160,8 @@ function justhide(){
//=========================== < FILTERS-SLIDERS > ===========================// //=========================== < FILTERS-SLIDERS > ===========================//
// Execution modes:
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight"); // EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); // EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
...@@ -238,12 +182,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -238,12 +182,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// type_attrb = "type" // type_attrb = "type"
// criteria = "size" // criteria = "size"
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if(partialGraph._core.graph.edges.length==0) { if(partialGraph._core.graph.edges.length==0) {
$(sliderDivID).freshslider({ $(sliderDivID).freshslider({
...@@ -291,8 +229,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -291,8 +229,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
if(i>=low && i<=high){ if(i>=low && i<=high){
for(var id in ids) { for(var id in ids) {
ID = ids[id] ID = ids[id]
// partialGraph._core.graph.edgesIndex[ID].lock=false;
// partialGraph._core.graph.edgesIndex[ID].hidden=false;
Edges[ID].lock = false; Edges[ID].lock = false;
for (var n in partialGraph._core.graph.nodesIndex) { for (var n in partialGraph._core.graph.nodesIndex) {
sid = Edges[ID].sourceID sid = Edges[ID].sourceID
...@@ -308,8 +244,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -308,8 +244,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
} else { } else {
for(var id in ids) { for(var id in ids) {
ID = ids[id] ID = ids[id]
// partialGraph._core.graph.edgesIndex[ID].lock=true;
// partialGraph._core.graph.edgesIndex[ID].hidden=true;
partialGraph.dropEdge(ID) partialGraph.dropEdge(ID)
Edges[ID].lock = true; Edges[ID].lock = true;
} }
...@@ -330,12 +264,15 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -330,12 +264,15 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
} }
});//doTimeout });// [/doTimeout]
} }
}); });
} }
// Execution modes:
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size") // NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size") // NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
...@@ -345,7 +282,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -345,7 +282,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return; return;
} }
// sliderDivID = "#sliderAEdgeWeight" // sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1" // type = "nodes1"
// type_attrb = "label" // type_attrb = "label"
...@@ -356,11 +292,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -356,11 +292,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// type_attrb = "type" // type_attrb = "type"
// criteria = "size" // criteria = "size"
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if(partialGraph._core.graph.nodes.length==0) { if(partialGraph._core.graph.nodes.length==0) {
$(sliderDivID).freshslider({ $(sliderDivID).freshslider({
...@@ -435,7 +366,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -435,7 +366,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}); });
} }
// Execution modes:
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight") // AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight") // AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
...@@ -525,12 +456,6 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) { ...@@ -525,12 +456,6 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
//============================= < SEARCH > =============================// //============================= < SEARCH > =============================//
function updateSearchLabels(id,name,type){ function updateSearchLabels(id,name,type){
labels.push({ labels.push({
......
//to general utils
function pr(msg) {
console.log(msg);
}
//to general utils
function isUndef(variable){
if(typeof(variable)==="undefined") return true;
else return false;
}
//to general utils
$.fn.toggleClick = function(){
methods = arguments, // store the passed arguments for future reference
count = methods.length; // cache the number of methods
//use return this to maintain jQuery chainability
return this.each(function(i, item){
// for each element you bind to
index = 0; // create a local counter for that element
$(item).click(function(){ // bind a click handler to that element
return methods[index++ % count].apply(this,arguments); // that when called will apply the 'index'th method to that element
// the index % count means that we constrain our iterator between 0 and (count-1)
});
});
};
//to general utils
getUrlParam = (function () {
var get = {
push:function (key,value){
var cur = this[key];
if (cur.isArray){
this[key].push(value);
}else {
this[key] = [];
this[key].push(cur);
this[key].push(value);
}
}
},
search = document.location.search,
decode = function (s,boo) {
var a = decodeURIComponent(s.split("+").join(" "));
return boo? a.replace(/\s+/g,''):a;
};
search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function (a,b,c) {
if (get[decode(b,true)]){
get.push(decode(b,true),decode(c));
}else {
get[decode(b,true)] = decode(c);
}
});
return get;
})();
//to general utils
function ArraySortByValue(array, sortFunc){
var tmp = [];
oposMAX=0;
for (var k in array) {
if (array.hasOwnProperty(k)) {
tmp.push({
key: k,
value: array[k]
});
if((array[k]) > oposMAX) oposMAX= array[k];
}
}
tmp.sort(function(o1, o2) {
return sortFunc(o1.value, o2.value);
});
return tmp;
}
//to general utils
function ArraySortByKey(array, sortFunc){
var tmp = [];
for (var k in array) {
if (array.hasOwnProperty(k)) {
tmp.push({
key: k,
value: array[k]
});
}
}
tmp.sort(function(o1, o2) {
return sortFunc(o1.key, o2.key);
});
return tmp;
}
//to general utils
function is_empty(obj) {
// Assume if it has a length property with a non-zero value
// that that property is correct.
if (obj.length && obj.length > 0) return false;
if (obj.length && obj.length === 0) return true;
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) return false;
}
return true;
}
//obsolete
function returnBaseUrl() {
origin = window.location.origin;
nameOfHtml=window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1);
pathname = window.location.pathname.replace(nameOfHtml,"");
return origin+pathname+twjs;
}
function cancelSelection (fromTagCloud) { function cancelSelection (fromTagCloud) {
pr("\t***in cancelSelection"); pr("\t***in cancelSelection");
...@@ -287,10 +171,8 @@ function pushSWClick(arg){ ...@@ -287,10 +171,8 @@ function pushSWClick(arg){
swclickActual = arg; swclickActual = arg;
} }
// it receives entire node // it receives entire node
function selection(currentNode){ function selection(currentNode){
// pr("\t***in selection()");
if(checkBox==false && cursor_size==0) { if(checkBox==false && cursor_size==0) {
highlightSelectedNodes(false); highlightSelectedNodes(false);
opossites = []; opossites = [];
...@@ -425,7 +307,6 @@ function selection(currentNode){ ...@@ -425,7 +307,6 @@ function selection(currentNode){
} }
function getOpossitesNodes(node_id, entireNode) { function getOpossitesNodes(node_id, entireNode) {
// pr("\tin getOpossitesNodes");
node=""; node="";
if(entireNode==true) node=node_id; if(entireNode==true) node=node_id;
else node = partialGraph._core.graph.nodesIndex[node_id]; else node = partialGraph._core.graph.nodesIndex[node_id];
...@@ -436,8 +317,7 @@ function getOpossitesNodes(node_id, entireNode) { ...@@ -436,8 +317,7 @@ function getOpossitesNodes(node_id, entireNode) {
} }
if (!node) return null; if (!node) return null;
//selection(node); //selection(node);
if(categoriesIndex.length==1) selectionUni(node); if(categoriesIndex.length==1) selectionUni(node);
if(categoriesIndex.length==2) selection(node); if(categoriesIndex.length==2) selection(node);
...@@ -446,22 +326,6 @@ function getOpossitesNodes(node_id, entireNode) { ...@@ -446,22 +326,6 @@ function getOpossitesNodes(node_id, entireNode) {
}); });
} }
//to sigma utils!
function getNodeLabels(elems){
var labelss=[]
for(var i in elems){
var id=(!isUndef(elems[i].key))?elems[i].key:i
labelss.push(Nodes[id].label)
}
return labelss
}
//to sigma utils!
function getNodeIDs(elems){
return Object.keys(elems)
}
// tag cloud div // tag cloud div
//missing: the graphNGrams javascript //missing: the graphNGrams javascript
function htmlfied_alternodes(elems) { function htmlfied_alternodes(elems) {
...@@ -575,6 +439,7 @@ function LevelButtonDisable( TF ){ ...@@ -575,6 +439,7 @@ function LevelButtonDisable( TF ){
$('#changelevel').prop('disabled', TF); $('#changelevel').prop('disabled', TF);
} }
//tofix!
function graphTagCloudElem(node_id){ function graphTagCloudElem(node_id){
pr("\tin graphTagCloudElem");/**/ pr("\tin graphTagCloudElem");/**/
console.log("in graphTagCloudElem, nodae_id: "+node_id); console.log("in graphTagCloudElem, nodae_id: "+node_id);
...@@ -593,12 +458,8 @@ function updateDownNodeEvent(selectionRadius){ ...@@ -593,12 +458,8 @@ function updateDownNodeEvent(selectionRadius){
hoverNodeEffectWhileFA2(selectionRadius); hoverNodeEffectWhileFA2(selectionRadius);
} }
function greyEverything(){ function greyEverything(){
// pr("\t\t\tin grey everything");
// for(var i in deselections){
// partialGraph._core.graph.nodesIndex[i].forceLabel=false;
// }
// deselections={};
nds = partialGraph._core.graph.nodes.filter(function(n) { nds = partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden']; return !n['hidden'];
...@@ -606,10 +467,8 @@ function greyEverything(){ ...@@ -606,10 +467,8 @@ function greyEverything(){
for(var i in nds){ for(var i in nds){
if(!nds[i].attr['grey']){ if(!nds[i].attr['grey']){
nds[i].attr['true_color'] = nds[i].color; nds[i].attr['true_color'] = nds[i].color;
// pr(nds[i].color)
alphacol = "rgba("+hex2rga(nds[i].color)+",0.5)"; alphacol = "rgba("+hex2rga(nds[i].color)+",0.5)";
nds[i].color = alphacol; nds[i].color = alphacol;
// nds[i].color = "rgba("+hex2rga(nds[i].color)+",0.5)"
} }
nds[i].attr['grey'] = 1; nds[i].attr['grey'] = 1;
} }
...@@ -638,6 +497,9 @@ function greyEverything(){ ...@@ -638,6 +497,9 @@ function greyEverything(){
} }
} }
//it is a mess but it works.
// TODO: refactor this
function markAsSelected(n_id,sel) { function markAsSelected(n_id,sel) {
if(!isUndef(n_id.id)) nodeSel=n_id; if(!isUndef(n_id.id)) nodeSel=n_id;
else nodeSel = partialGraph._core.graph.nodesIndex[n_id]; else nodeSel = partialGraph._core.graph.nodesIndex[n_id];
...@@ -1133,14 +995,10 @@ function MultipleSelection(nodes){ ...@@ -1133,14 +995,10 @@ function MultipleSelection(nodes){
for(var i in ndsids){ for(var i in ndsids){
nodeid = ndsids[i] nodeid = ndsids[i]
getOpossitesNodes(nodeid,false); //false -> just nodeid getOpossitesNodes(nodeid,false); //false -> just nodeid
// markAsSelected(nodeid,true);
} }
for( var i in selections){ for( var i in selections){
markAsSelected(i,true); markAsSelected(i,true);
} }
// pr("selections content AFTER: ")
// pr(selections)
// pr("=============")
} }
overNodes=true; overNodes=true;
...@@ -1411,6 +1269,8 @@ function add1Edge(ID) { ...@@ -1411,6 +1269,8 @@ function add1Edge(ID) {
} }
} }
//obsolete au non
function hideElem(id){ function hideElem(id){
if(id.split(";").length==1){ if(id.split(";").length==1){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type); //updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
...@@ -1422,6 +1282,7 @@ function hideElem(id){ ...@@ -1422,6 +1282,7 @@ function hideElem(id){
} }
} }
//obsolete au non
function unHideElem(id){ function unHideElem(id){
if(id.split(";").length==1){ if(id.split(";").length==1){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type); //updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
...@@ -1751,16 +1612,11 @@ function highlightOpossites (list){/*here*/ ...@@ -1751,16 +1612,11 @@ function highlightOpossites (list){/*here*/
} }
} }
function getByID(elem) {
return document.getElementById(elem);
}
function saveGraph() { function saveGraph() {
size = getByID("check_size").checked size = getByID("check_size").checked
color = getByID("check_color").checked color = getByID("check_color").checked
atts = {"size":size,"color":color} atts = {"size":size,"color":color}
pr(atts)
if(getByID("fullgraph").checked) { if(getByID("fullgraph").checked) {
saveGEXF ( getnodes() , getedges() , atts); saveGEXF ( getnodes() , getedges() , atts);
...@@ -1842,54 +1698,3 @@ function saveGraphIMG(){ ...@@ -1842,54 +1698,3 @@ function saveGraphIMG(){
var strData = edgesDiv.toDataURL("image/png"); var strData = edgesDiv.toDataURL("image/png");
document.location.href = strData.replace("image/png", strDownloadMime) document.location.href = strData.replace("image/png", strDownloadMime)
} }
//obsolete
function setComponentButton(comp_name){
document.getElementById(comp_name);
}
//obsolete
function changeSwitchImage(source, target){
pr("**** changeSwitchImage() does NOTHING ****")
// if(target=="social") {
// setComponentButton("social",true);
// setComponentButton("semantic",false);
// setComponentButton("sociosemantic",false);
// }
// if(target=="semantic") {
// setComponentButton("social",false);
// setComponentButton("semantic",true);
// setComponentButton("sociosemantic",false);
// }
// if(target=="sociosemantic") {
// setComponentButton("social",false);
// setComponentButton("semantic",false);
// setComponentButton("sociosemantic",true);
// }
// fullurl = returnBaseUrl()+"img/trans/";
// if(source=="fromHtml"){
// if(document.getElementById("switchbutton").src==fullurl+"showKeywords.png"){
// document.getElementById("switchbutton").src=fullurl+"showScholars.png";
// }
// else {
// document.getElementById("switchbutton").src=fullurl+"showKeywords.png";
// }
// }
// else {
// if(target=="social") document.getElementById("switchbutton").src=fullurl+"showKeywords.png";
// if(target=="semantic") document.getElementById("switchbutton").src=fullurl+"showScholars.png";
// }
//pr($("#names").text());
}
//obsolete
function switchSelection(){
if(swclickActual=="social"){
//If we are seeing the Social Graph, this implies that the left panel
//is showing Keywords, so we have to invert names and opossites
}
if(swclickActual=="semantic"){
//If we are seeing the Semantic Graph, this implies that the left panel
//is showing Scholars, so we have to invert names and opossites
}
}
...@@ -1111,68 +1111,6 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1111,68 +1111,6 @@ sigma.publicPrototype.startForceAtlas2 = function() {
//if(!this.forceatlas2) { //if(!this.forceatlas2) {
if(fa2enabled) { if(fa2enabled) {
// // -- UPDATING THE DEGREE --
// for (var i in this._core.graph.nodesIndex) {
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
// }
// for (var i in this._core.graph.nodes) {
// if(!this._core.graph.nodes[i].hidden) {
// this._core.graph.nodes[i].degree = 0;
// this._core.graph.nodesIndex[this._core.graph.nodes[i].id].degree = 0;
// }
// }
// for (var e in this._core.graph.edges) {
// edge = this._core.graph.edges[e];
// if(!edge.hidden) {
// nodeIDS = edge.source.id;
// nodeIDT = edge.target.id;
// this._core.graph.nodesIndex[nodeIDS].degree++;
// this._core.graph.nodesIndex[nodeIDT].degree++;
// }
// }
// 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(this._core.graph.nodesIndex[i].degree==0) {
// // this._core.graph.nodesIndex[i].color = "#000000"
// 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 --
// pr("minx: "+minx)
// pr("maxx: "+maxx)
// pr("miny: "+miny)
// pr("maxy: "+maxy)
// pr("")
var V = 10; var V = 10;
var E = 100; var E = 100;
...@@ -1203,7 +1141,7 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1203,7 +1141,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
// fixing anomaly in forceatlas2 // fixing anomaly in forceatlas2
$.doTimeout(250,function (){ $.doTimeout(250,function (){
if( partialGraph.forceatlas2.active && partialGraph.forceatlas2.count==0 ) { if( partialGraph.forceatlas2.active && partialGraph.forceatlas2.count==0 ) {
pr("SUPER TECHNIQUE!!") pr("SUPER JUTSU!!")
partialGraph.startForceAtlas2(); partialGraph.startForceAtlas2();
return; return;
} }
...@@ -1222,84 +1160,4 @@ sigma.publicPrototype.stopForceAtlas2 = function() { ...@@ -1222,84 +1160,4 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
partialGraph.refresh(); partialGraph.refresh();
if(minimap) $("#overviewzone").show(); if(minimap) $("#overviewzone").show();
/*
// 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;
// // }
// 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("")
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++;
}
}
*/
}; };
...@@ -703,7 +703,6 @@ function extractFromJson(data,seed){ ...@@ -703,7 +703,6 @@ function extractFromJson(data,seed){
Edges[indice] = edge; Edges[indice] = edge;
if(edge.label=="nodes1"){ if(edge.label=="nodes1"){
// edge.hidden=false;
if(isUndef(nodes1[source])) { if(isUndef(nodes1[source])) {
nodes1[source] = { nodes1[source] = {
...@@ -721,7 +720,7 @@ function extractFromJson(data,seed){ ...@@ -721,7 +720,7 @@ function extractFromJson(data,seed){
nodes1[target].neighbours.push(source); nodes1[target].neighbours.push(source);
// social edges = 1 // social edges = 1
Edges[indice].bweight = edgesNodes[i].w;//realweight as in bigraph-weight Edges[indice].bweight = edgesNodes[i].w;//realweight just in bigraph-weight
edge.weight = 1; edge.weight = 1;
partialGraph.addEdge(indice,source,target,edge); partialGraph.addEdge(indice,source,target,edge);
...@@ -729,7 +728,6 @@ function extractFromJson(data,seed){ ...@@ -729,7 +728,6 @@ function extractFromJson(data,seed){
if(edge.label=="nodes2"){ if(edge.label=="nodes2"){
// edge.hidden=true;
if(isUndef(nodes2[source])) { if(isUndef(nodes2[source])) {
nodes2[source] = { nodes2[source] = {
...@@ -751,10 +749,8 @@ function extractFromJson(data,seed){ ...@@ -751,10 +749,8 @@ function extractFromJson(data,seed){
if(edge.label=="bipartite"){ if(edge.label=="bipartite"){
// edge.hidden=true;
s = edge.sourceID s = edge.sourceID
// // Source is Document // // Source is Document
if(Nodes[s].type == catSoc) { if(Nodes[s].type == catSoc) {
...@@ -794,6 +790,5 @@ function extractFromJson(data,seed){ ...@@ -794,6 +790,5 @@ function extractFromJson(data,seed){
} }
} }
//edge.hidden=false/**///should be commented
} }
} }
...@@ -114,18 +114,22 @@ function exactfind(label) { ...@@ -114,18 +114,22 @@ function exactfind(label) {
return null; return null;
} }
//to general utils (not used btw)
function cloneObject(source) { function getNodeLabels(elems){
for (i in source) { var labelss=[]
if (typeof source[i] == 'source') { for(var i in elems){
this[i] = new cloneObject(source[i]); var id=(!isUndef(elems[i].key))?elems[i].key:i
} labelss.push(Nodes[id].label)
else{
this[i] = source[i];
}
} }
return labelss
} }
function getNodeIDs(elems){
return Object.keys(elems)
}
function getSelections(){ function getSelections(){
params=[]; params=[];
for(var i in selections){ for(var i in selections){
...@@ -287,44 +291,6 @@ function clustersBy(daclass) { ...@@ -287,44 +291,6 @@ function clustersBy(daclass) {
partialGraph.draw(); partialGraph.draw();
} }
function hex2rga(sent_hex) {
result = []
hex = ( sent_hex.charAt(0) === "#" ? sent_hex.substr(1) : sent_hex );
// check if 6 letters are provided
if (hex.length === 6) {
result = calculateFull(hex);
return result;
}
else if (hex.length === 3) {
result = calculatePartial(hex);
return result;
}
}
function calculateFull(hex) {
var r = parseInt(hex.substring(0, 2), 16);
var g = parseInt(hex.substring(2, 4), 16);
var b = parseInt(hex.substring(4, 6), 16);
return [r,g,b];
}
// function for calculating 3 letters hex value
function calculatePartial(hex) {
var r = parseInt(hex.substring(0, 1) + hex.substring(0, 1), 16);
var g = parseInt(hex.substring(1, 2) + hex.substring(1, 2), 16);
var b = parseInt(hex.substring(2, 3) + hex.substring(2, 3), 16);
return [r,g,b];
}
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
function rgbToHex(r, g, b) {
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
//just for fun //just for fun
function makeEdgeWeightUndef() { function makeEdgeWeightUndef() {
......
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