Commit 2d6ac920 authored by Romain Loth's avatar Romain Loth

various small fixes on my recent changes

fixed 'cluster_index' and 'clust_default' duplication, also fixed some remaining direct FA2 calls + minor others
parent e401a1e4
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<li><a href="http://iscpif.fr" target="_blank" <li><a href="http://iscpif.fr" target="_blank"
class="navbar-higher" class="navbar-higher"
title="ISC-PIF"> title="ISC-PIF">
<img src="libs/img2/logo_ISCPIF_small.svg"height="23"></a></li> <img src="libs/img2/logo_ISCPIF_small.svg" height="23"></a></li>
</ul> </ul>
...@@ -196,14 +196,6 @@ ...@@ -196,14 +196,6 @@
</ul> </ul>
</a></li> </a></li>
<!--
<li>
<a>
<button type="button" onclick="partialGraph.stopForceAtlas2();" class="btn btn-sm">wu</button>
</a>
</li>
-->
<li class="weight-selectors category0"> <li class="weight-selectors category0">
<!-- Create a subgraph over nodes from TW.categories[0] (docs or def nodes)--> <!-- Create a subgraph over nodes from TW.categories[0] (docs or def nodes)-->
<table> <table>
...@@ -617,6 +609,7 @@ ...@@ -617,6 +609,7 @@
<!-- new sigma 1.2 imports --> <!-- new sigma 1.2 imports -->
<!-- <script src="tinawebJS/sigma_v1.2/sigma.min.js" type="text/javascript" language="javascript"></script> --> <!-- <script src="tinawebJS/sigma_v1.2/sigma.min.js" type="text/javascript" language="javascript"></script> -->
<script src="tinawebJS/sigma_v1.2/sigma.noIndexes.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/sigma_v1.2/sigma.noIndexes.js" type="text/javascript" language="javascript"></script>
<!-- <script src="tinawebJS/sigma_v1.5/sigma.js" type="text/javascript" language="javascript"></script> -->
<!-- <!--
NB: our sigma.noIndexes.js has exactly the same functions & varnames as NB: our sigma.noIndexes.js has exactly the same functions & varnames as
the v1.2 stock sigma.(min).js but with a much lighter RAM footprint! the v1.2 stock sigma.(min).js but with a much lighter RAM footprint!
......
...@@ -654,6 +654,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -654,6 +654,7 @@ TinaWebJS = function ( sigmacanvas ) {
document.getElementById('edges-switch').checked = TW.customSettings.drawEdges document.getElementById('edges-switch').checked = TW.customSettings.drawEdges
// £TODO test if still needed
$("#semLoader").hide(); $("#semLoader").hide();
$("#closeloader").click(); $("#closeloader").click();
...@@ -674,7 +675,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -674,7 +675,8 @@ TinaWebJS = function ( sigmacanvas ) {
$("#changetype").click(function(){ $("#changetype").click(function(){
console.log("") console.log("")
console.log(" ############ changeTYPE click"); console.log(" ############ changeTYPE click");
partialGraph.stopForceAtlas2(); if (TW.partialGraph.isForceAtlas2Running())
sigma_utils.ourStopFA2();
changeType(); changeType();
setTimeout(function(){ setTimeout(function(){
......
...@@ -569,7 +569,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) { ...@@ -569,7 +569,7 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
// [ Stopping FA2 ] // [ Stopping FA2 ]
if (TW.partialGraph.isForceAtlas2Running()) if (TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.stopForceAtlas2(); sigma_utils.ourStopFA2();
// [ / Stopping FA2 ] // [ / Stopping FA2 ]
var t0 = lastvalue.split("-") var t0 = lastvalue.split("-")
...@@ -774,7 +774,8 @@ function NodeWeightFilter( sliderDivID , tgtNodeType , criteria) { ...@@ -774,7 +774,8 @@ function NodeWeightFilter( sliderDivID , tgtNodeType , criteria) {
} }
// [ Stopping FA2 ] // [ Stopping FA2 ]
TW.partialGraph.stopForceAtlas2(); if (TW.partialGraph.isForceAtlas2Running())
sigma_utils.ourStopFA2();
// [ / Stopping FA2 ] // [ / Stopping FA2 ]
......
...@@ -476,46 +476,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -476,46 +476,7 @@ function dictfyGexf( gexf , categories ){
// sorting out properties in n.attributes ==> £TODO shared function createClusterIndex() up to classvalues_fin // sorting out properties in n.attributes ==> £TODO shared function createClusterIndex() up to classvalues_fin
// -------------------------------------- // --------------------------------------
if(gotClusters) { // all scanned attributes get an inverted index
// 1) default cluster properties "cluster_index" [, "cluster_label"]
for (var t_type in tmpVals) {
var t_clusname
// all distinct values to create labels
var t_cnumbers = []
var allTicks = []
if (TW.nodeClusAtt != undefined && tmpVals[t_type][TW.nodeClusAtt]) {
t_clusname = TW.nodeClusAtt
}
else if (tmpVals[t_type]["cluster_index"]) {
t_clusname = "cluster_index"
}
if (t_clusname) {
// values (we assume they are cluster numbers)
t_cnumbers = Object.keys(tmpVals[t_type][t_clusname].map)
// add label names (TODO use cluster_label if present
// £POSS, use maxsize node label if absent)
for (var l in t_cnumbers) {
var t_cnumber = t_cnumbers[l]
var newTick = {
'labl': `${t_type}||${t_clusname}||${t_cnumber}`,
'val': t_cnumber,
// val2ids: [nid5,nid27..]
'nids': tmpVals[t_type][TW.nodeClusAtt].map[t_cnumber]
}
allTicks.push(newTick)
}
TW.Clusters[t_type] = {}
TW.Clusters[t_type]["clust_default"] = allTicks
}
}
}
// 2) all scanned
for (var cat in tmpVals) { for (var cat in tmpVals) {
if (!TW.Clusters[cat]) TW.Clusters[cat] = {} if (!TW.Clusters[cat]) TW.Clusters[cat] = {}
...@@ -637,8 +598,18 @@ function dictfyGexf( gexf , categories ){ ...@@ -637,8 +598,18 @@ function dictfyGexf( gexf , categories ){
} }
} }
} }
// 'clust_default' is an alias to the user-defined default clustering
if (TW.nodeClusAtt != undefined
&& TW.Clusters[cat][TW.nodeClusAtt] // <= if found in data
&& !TW.Clusters[cat]['clust_default'] // <= and if an attr named 'clust_default' was not already in data
) {
TW.Clusters[cat]['clust_default'] = TW.Clusters[cat][TW.nodeClusAtt]
}
} }
if (TW.debugFlags.logFacets) { if (TW.debugFlags.logFacets) {
var classvalues_fin = performance.now() var classvalues_fin = performance.now()
console.log('end TW.Clusters, own time:', classvalues_fin-classvalues_deb) console.log('end TW.Clusters, own time:', classvalues_fin-classvalues_deb)
......
...@@ -500,9 +500,13 @@ SigmaUtils = function () { ...@@ -500,9 +500,13 @@ SigmaUtils = function () {
this.ourStopFA2 = function() { this.ourStopFA2 = function() {
document.getElementById('layoutwait').remove()
TW.partialGraph.stopForceAtlas2(); TW.partialGraph.stopForceAtlas2();
try {
document.getElementById('layoutwait').remove()
}
catch(e) {}
// restore edges if needed // restore edges if needed
if (document.getElementById('edges-switch').checked) { if (document.getElementById('edges-switch').checked) {
this.toggleEdges(true) this.toggleEdges(true)
...@@ -698,10 +702,12 @@ function exactfind(label) { ...@@ -698,10 +702,12 @@ function exactfind(label) {
function getNodeLabels(elems){ function getNodeLabels(elems){
console.log(elems)
var labelss=[] var labelss=[]
for(var i in elems){ for(var i in elems){
console.log(elems[i])
console.debug(i, elems[i])
var id=(!isUndef(elems[i].id))?elems[i].id:i var id=(!isUndef(elems[i].id))?elems[i].id:i
labelss.push(TW.Nodes[id].label) labelss.push(TW.Nodes[id].label)
} }
......
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