Commit 57b15e95 authored by PkSM3's avatar PkSM3

filter bugs-fix

parent 2bdcb035
......@@ -166,10 +166,10 @@ function justhide(){
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// if ($(sliderDivID).html()!="") {
// pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
// return;
// }
if ($(sliderDivID).html()!="") {
pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
return;
}
// sliderDivID = "#sliderAEdgeWeight"
......@@ -182,6 +182,8 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// type_attrb = "type"
// 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")
......@@ -233,8 +235,17 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
ID = ids[id]
// partialGraph._core.graph.edgesIndex[ID].lock=false;
// partialGraph._core.graph.edgesIndex[ID].hidden=false;
add1Edge(ID)
// Edges[ID].lock = false;
Edges[ID].lock = false;
for (var n in partialGraph._core.graph.nodesIndex) {
sid = Edges[ID].sourceID
tid = Edges[ID].targetID
if (sid==n || tid==n) {
if(isUndef(getn(sid))) unHide(sid)
if(isUndef(getn(tid))) unHide(tid)
add1Edge(ID)
}
}
}
} else {
for(var id in ids) {
......@@ -242,7 +253,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// partialGraph._core.graph.edgesIndex[ID].lock=true;
// partialGraph._core.graph.edgesIndex[ID].hidden=true;
partialGraph.dropEdge(ID)
// Edges[ID].lock = true;
Edges[ID].lock = true;
}
}
}
......@@ -254,7 +265,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh()
partialGraph.draw()
// fa2enabled=true; partialGraph.startForceAtlas2()
fa2enabled=true; partialGraph.startForceAtlas2()
// });
}
......@@ -266,10 +277,10 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// if ($(sliderDivID).html()!="") {
// pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
// return;
// }
if ($(sliderDivID).html()!="") {
pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
return;
}
// sliderDivID = "#sliderAEdgeWeight"
......@@ -324,17 +335,19 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return false
}
// $.doTimeout(300,function (){
// pr(finalarray)
for(var i in finalarray) {
ids = finalarray[i]
if(i>=low && i<=high){
for(var id in ids) {
ID = ids[id]
Nodes[ID].lock = false;
partialGraph._core.graph.nodesIndex[ID].hidden = false;
}
} else {
for(var id in ids) {
ID = ids[id]
Nodes[ID].lock = true;
partialGraph._core.graph.nodesIndex[ID].hidden = true;
}
}
......@@ -346,7 +359,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph.refresh()
partialGraph.draw()
// });
fa2enabled=true; partialGraph.startForceAtlas2()
}
}
......
......@@ -713,10 +713,10 @@ function SigmaLayouting( URL, DATA, NAME) {
if( NOW=="B" ) {
changeToMacro("semantic");
partialGraph.draw();
$("#sliderBEdgeWeight").html("");
$("#sliderBNodeWeight").html("");
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
// $("#sliderBEdgeWeight").html("");
// $("#sliderBNodeWeight").html("");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size");
$("#colorGraph").hide();
}
......
......@@ -109,7 +109,7 @@ function is_empty(obj) {
}
//obsolete
function returnBaseUrl(){
function returnBaseUrl() {
origin = window.location.origin;
nameOfHtml=window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1);
pathname = window.location.pathname.replace(nameOfHtml,"");
......@@ -205,17 +205,17 @@ function RefreshState(newNOW){
if (newNOW!="") {
PAST = NOW;
NOW = newNOW;
$("#category-A").hide();
$("#category-B").hide();
if(NOW=="a" || NOW=="A" || NOW=="AaBb") {
$("#category-A").show();
}
if(NOW=="b" || NOW=="B" || NOW=="AaBb") {
$("#category-B").show();
}
// if(NOW=="a" || NOW=="A" || NOW=="AaBb") {
// $("#category-A").show();
// }
// if(NOW=="b" || NOW=="B" || NOW=="AaBb") {
// $("#category-B").show();
// }
}
$("#category-A").hide();
$("#category-B").hide();
// i=0; for(var s in selections) { i++; break;}
// if(is_empty(selections) || i==0) LevelButtonDisable(true);
// else LevelButtonDisable(false);
......@@ -242,7 +242,7 @@ function RefreshState(newNOW){
}
$("#semLoader").hide();
$("#category-A").show();
$("#colorGraph").show();
}
......@@ -261,11 +261,21 @@ function RefreshState(newNOW){
if(NOW=="b") {
LevelButtonDisable(false);
}
if ( semanticConverged ) $("#semLoader").hide();
else $("#semLoader").show();
if ( semanticConverged ) {
$("#semLoader").hide();
$("#category-B").show();
$.doTimeout(30,function (){
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size");
});
} else $("#semLoader").show();
}
if(NOW=="AaBb"){
LevelButtonDisable(true);
$("#category-A").show();
$("#category-B").show();
}
partialGraph.draw();
......@@ -1338,9 +1348,9 @@ function hideEverything(){
}
function unHide(id){
// i've received a NODE
if(id.split(";").length==1) {
// i've received a NODE
if(Nodes[id]) {
var anode = ({
id:id,
......@@ -1348,13 +1358,16 @@ function unHide(id){
size: Nodes[id].size,
x: Nodes[id].x,
y: Nodes[id].y,
hidden: (Nodes[id].lock)?true:false,
type: Nodes[id].type,
color: Nodes[id].color,
shape: Nodes[id].shape
}); // The graph node
updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
nodeslength++;
if(!Nodes[id].lock) {
updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
nodeslength++;
}
partialGraph.addNode(id,anode);
return;
......@@ -1362,8 +1375,7 @@ function unHide(id){
}
else {// It's an edge!
//visibleEdges.push(id);
if(Edges[id]){
if(Edges[id] && !Edges[id].lock){
var anedge = {
id: id,
......@@ -1396,15 +1408,19 @@ function add1Edge(ID) {
weight: Edges[ID].weight,
hidden : false
};
partialGraph.addEdge(ID,s,t,edge);
if(!isUndef(getn(s))) {
partialGraph._core.graph.nodesIndex[s].x = Nodes[s].x
partialGraph._core.graph.nodesIndex[s].y = Nodes[s].y
}
if(!isUndef(getn(t))) {
partialGraph._core.graph.nodesIndex[t].x = Nodes[t].x
partialGraph._core.graph.nodesIndex[t].y = Nodes[t].y
if(getn(s) && getn(t)) {
partialGraph.addEdge(ID,s,t,edge);
if(!isUndef(getn(s))) {
partialGraph._core.graph.nodesIndex[s].x = Nodes[s].x
partialGraph._core.graph.nodesIndex[s].y = Nodes[s].y
}
if(!isUndef(getn(t))) {
partialGraph._core.graph.nodesIndex[t].x = Nodes[t].x
partialGraph._core.graph.nodesIndex[t].y = Nodes[t].y
}
}
}
......@@ -1523,7 +1539,7 @@ function changeToMeso(iwannagraph) {
}
}
EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
$("#colorGraph").show();
}
......@@ -1618,13 +1634,15 @@ function changeToMeso(iwannagraph) {
}
}
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide();
}
MultipleSelection(Object.keys(selections));
fa2enabled=true; partialGraph.startForceAtlas2();
$('.gradient').css({"background-size":"90px 90px"});
}
......@@ -1646,9 +1664,8 @@ function changeToMacro(iwannagraph) {
if ( iwannagraph=="semantic" && !semanticConverged ) {
partialGraph.draw();
// partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
partialGraph.refresh();
// partialGraph.startForceAtlas2();
$("#semLoader").show();
return;
......@@ -1714,22 +1731,22 @@ function changeToMacro(iwannagraph) {
$.doTimeout(30,function (){
if(iwannagraph=="social") {
EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
$("#colorGraph").show();
}
if(iwannagraph=="semantic") {
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide();
}
if(iwannagraph=="sociosemantic") {
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
$("#colorGraph").hide();
}
});
......
......@@ -1091,15 +1091,7 @@ sigma.classes.Cascade = function() {
tmp = b.replace("rgba(","").replace(")","").split(",")
b = rgbToHex( parseFloat( tmp[0] ) , parseFloat( tmp[1] ) , parseFloat( tmp[2] ) );
}
pr(source+" : "+a+"\t|\t"+target+" : "+b)
// '#'+sigma.tools.rgbToHex(parseFloat(colorNode.getAttribute('r')),
// parseFloat(colorNode.getAttribute('g')),
// parseFloat(colorNode.getAttribute('b')));
// pr(source+" : "+a+"\t|\t"+target+" : "+b)
a = hex2rga(a);
b = hex2rga(b);
var r = (a[0] + b[0]) >> 1;
......
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