Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
5be215b5
Commit
5be215b5
authored
Jun 29, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'de07de2' (faster sliders) into with_tina_1.2
parents
86562d73
d5ebd7ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
67 deletions
+62
-67
Tinaweb.js
twmain/Tinaweb.js
+1
-3
enviroment.js
twmain/enviroment.js
+53
-59
methods.js
twmain/methods.js
+5
-4
sigmaUtils.js
twmain/sigmaUtils.js
+3
-1
No files found.
twmain/Tinaweb.js
View file @
5be215b5
...
...
@@ -751,7 +751,6 @@ var TinaWebJS = function ( sigmacanvas ) {
this
.
style
.
cursor
=
'wait'
// and waiting icon
this
.
insertBefore
(
createWaitIcon
(
'noverlapwait'
),
this
.
children
[
0
])
var
listener
=
TW
.
partialGraph
.
startNoverlap
();
var
noverButton
=
this
listener
.
bind
(
'stop'
,
function
(
event
)
{
...
...
@@ -1080,8 +1079,7 @@ var TinaWebJS = function ( sigmacanvas ) {
// for context: family/type prop value,
// for values: the property to filter
NodeWeightFilter
(
`#slidercat
${
activeId
}
nodesweight`
,
TW
.
categories
[
activeId
]
,
"size"
TW
.
categories
[
activeId
]
);
// ex: #slidercat1edgesweight
...
...
twmain/enviroment.js
View file @
5be215b5
...
...
@@ -599,28 +599,29 @@ function changeLevel() {
//=========================== < FILTERS-SLIDERS > ===========================//
// census of edges by
type and by siz
e
// census of edges by
property criterion (eg 'weight'), for a given typ
e
// (replaces deprecated AlgorithmForSliders, but without the sqrt transform)
function
edgeSizesLookup
()
{
function
edgeSizesLookup
(
eTypeStrs
,
criterion
)
{
var
edgeweis
=
{}
for
(
let
i
in
TW
.
edgeIds
)
{
let
e
=
TW
.
partialGraph
.
graph
.
edges
(
TW
.
edgeIds
[
i
])
if
(
e
)
{
for
(
var
etype_i
in
eTypeStrs
)
{
let
eTypeStr
=
eTypeStrs
[
etype_i
]
if
(
e
&&
e
.
categ
&&
e
.
categ
==
eTypeStr
)
{
if
(
!
edgeweis
[
e
.
categ
])
edgeweis
[
e
.
categ
]
=
{}
if
(
!
edgeweis
[
e
.
categ
][
e
.
weight
])
edgeweis
[
e
.
categ
][
e
.
weight
]
=
[]
if
(
!
edgeweis
[
e
.
categ
][
e
[
criterion
]])
edgeweis
[
e
.
categ
][
e
[
criterion
]
]
=
[]
edgeweis
[
e
.
categ
][
e
.
weight
].
push
(
e
.
id
)
edgeweis
[
e
.
categ
][
e
[
criterion
]].
push
(
e
.
id
)
}
}
}
return
edgeweis
}
function
edgeSizesSteps
(
eTypeStr
)
{
let
esizesCensus
=
edgeSizesLookup
()
function
edgeSizesSteps
(
eTypeStr
,
esizesCensus
)
{
var
stepToIdsArray
=
[]
if
(
esizesCensus
[
eTypeStr
])
{
var
sortedSizes
=
Object
.
keys
(
esizesCensus
[
eTypeStr
]
...
...
@@ -631,7 +632,7 @@ function edgeSizesSteps(eTypeStr) {
}
}
// console.warn (
"edgeSizesSteps:", eTypeStr
, stepToIdsArray)
// console.warn (
`edgeSizesSteps: for etype ${eTypeStr}`
, stepToIdsArray)
return
stepToIdsArray
}
...
...
@@ -653,8 +654,11 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
return
;
}
// building the index
var
stepToIdsArr
=
edgeSizesSteps
(
typestr
)
// building the index with the generic indexing function
var
esizesCensus
=
edgeSizesLookup
([
typestr
],
criteria
)
// sorting it for the type we need
var
stepToIdsArr
=
edgeSizesSteps
(
typestr
,
esizesCensus
)
var
steps
=
stepToIdsArr
.
length
if
(
steps
<
2
)
{
...
...
@@ -725,10 +729,6 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
var
filtervalue
=
low
+
"-"
+
high
var
lastvalue
=
TW
.
gui
.
lastFilters
[
`
${
sliderDivID
}
/
${
typestr
}
`
]
// sliderDivID+"_"+filtervalue
console
.
debug
(
"
\n
previous value "
+
lastvalue
+
" | current value "
+
filtervalue
)
if
(
filtervalue
!=
lastvalue
)
{
// [ Stopping FA2 ]
...
...
@@ -746,11 +746,11 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
if
(
mint0
!=
mint1
)
{
if
(
mint0
<
mint1
)
{
delflag
=
true
;
console
.
log
(
"cotainferior --||>--------|| a la derecha"
)
//
console.log("cotainferior --||>--------|| a la derecha")
}
if
(
mint0
>
mint1
)
{
addflag
=
true
;
console
.
log
(
"cotainferior --<||--------|| a la izquierda"
)
//
console.log("cotainferior --<||--------|| a la izquierda")
}
iterarr
=
calc_range
(
mint0
,
mint1
).
sort
(
compareNumbers
);
}
...
...
@@ -758,11 +758,11 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
if
(
maxt0
!=
maxt1
)
{
if
(
maxt0
<
maxt1
)
{
addflag
=
true
;
console
.
log
(
"cotasuperior ||--------||>-- a la derecha"
)
//
console.log("cotasuperior ||--------||>-- a la derecha")
}
if
(
maxt0
>
maxt1
)
{
delflag
=
true
;
console
.
log
(
"cotasuperior ||--------<||-- a la izquierda"
)
//
console.log("cotasuperior ||--------<||-- a la izquierda")
}
iterarr
=
calc_range
(
maxt0
,
maxt1
).
sort
(
compareNumbers
);
}
...
...
@@ -786,23 +786,14 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
else
console
.
warn
(
"skipped missing eid"
,
eid
)
// global level case
if
(
present
.
level
)
{
console
.
log
(
"
\
tADD "
+
eid
)
// n = eid.split(";")
// if(n.length>1)
// console.log("\t\tsource:("+TW.Nodes[n[0]].x+","+TW.Nodes[n[0]].y+") ||| target:("+TW.Nodes[n[1]].x+","+TW.Nodes[n[1]].y+")")
add1Elem
(
eid
)
}
// local level case
// stepToIdsArr is full of edges that don't really exist at this point
else
{
// we need to distinguish between absent edges => keep them absent because of local
// and edges with hidden nodes => effect of a node slider => make them appear
if
(
!
present
.
level
)
{
// NB we assume the sigma convention eid = "nid1;nid2"
let
nidkeys
=
eid
.
split
(
';'
)
console
.
log
(
nidkeys
)
if
(
nidkeys
.
length
!=
2
)
{
console
.
error
(
"invalid edge id:"
+
eid
)
...
...
@@ -816,31 +807,39 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
&&
TW
.
partialGraph
.
graph
.
nodes
(
tid
))
{
if
(
TW
.
partialGraph
.
graph
.
nodes
(
sid
).
hidden
)
unHide
(
sid
)
if
(
TW
.
partialGraph
.
graph
.
nodes
(
tid
).
hidden
)
unHide
(
tid
)
if
(
!
TW
.
partialGraph
.
graph
.
edges
(
eid
))
{
add1Elem
(
eid
)
}
TW
.
partialGraph
.
graph
.
edges
(
eid
).
hidden
=
false
TW
.
Edges
[
eid
].
lock
=
false
;
}
}
}
// in any case we show the edge
// global level case
if
(
!
TW
.
partialGraph
.
graph
.
edges
(
eid
))
{
// legacy fallback shouldn't be necessary
add1Elem
(
eid
)
}
TW
.
partialGraph
.
graph
.
edges
(
eid
).
hidden
=
false
TW
.
Edges
[
eid
].
lock
=
false
;
}
}
}
else
{
if
(
delflag
)
{
console
.
log
(
"deleting "
+
eids
.
join
())
for
(
var
i
in
eids
)
{
ID
=
eids
[
i
]
if
(
!
isUndef
(
TW
.
partialGraph
.
graph
.
edges
(
ID
)))
{
let
eid
=
eids
[
i
]
if
(
!
isUndef
(
TW
.
partialGraph
.
graph
.
edges
(
eid
)))
{
var
t0
=
performance
.
now
()
TW
.
partialGraph
.
graph
.
dropEdge
(
ID
)
if
(
TW
.
partialGraph
.
graph
.
edges
(
eid
))
{
TW
.
partialGraph
.
graph
.
edges
(
eid
).
hidden
=
true
TW
.
Edges
[
eid
].
lock
=
true
;
}
var
t1
=
performance
.
now
()
TW
.
Edges
[
ID
].
lock
=
true
;
// usually very long b/c sigma has to update indexes
// <=> shift same arrays many times
totalDeletingTime
+=
(
t1
-
t0
)
// POSS ideally: use .hidden
console
.
log
(
"
\
tDEL "
+
ID
)
// console.log("\thiding "+eid
)
// n = ID.split(";")
// if(n.length>1)
...
...
@@ -851,11 +850,11 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
}
}
if
(
delflag
)
if
(
delflag
)
{
console
.
info
(
'totalDeletingTime'
,
totalDeletingTime
)
// NB: performance with hiding: more or less 8x faster than with dropEdge on large graphs
}
// console.log("\t\tedgesfilter:")
// console.log("\t\t[ Starting FA2 ]")
// [ Starting FA2 ]
setTimeout
(
function
()
{
sigma_utils
.
smartForceAtlas
({
'duration'
:
2000
})
// shorter FA2 sufficient
...
...
@@ -866,31 +865,26 @@ function EdgeWeightFilter(sliderDivID , typestr , criteria) {
TW
.
gui
.
lastFilters
[
`
${
sliderDivID
}
/
${
typestr
}
`
]
=
filtervalue
}
else
{
// console.log('edges:::same position')
}
// in any case
setTimeout
(
function
()
{
TW
.
partialGraph
.
refresh
()
TW
.
gui
.
elHtml
.
classList
.
remove
(
'waiting'
)
},
2
0
)
},
4
0
)
},
1
5
00
)
// large-ish debounce timeout
},
1
0
00
)
// large-ish debounce timeout
},
40
)
// wait cursor timeout
}
});
}
// Execution modes:
// NodeWeightFilter ( "#sliderANodeWeight" , "Document"
, "size"
)
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram"
, "size"
)
function
NodeWeightFilter
(
sliderDivID
,
tgtNodeType
,
criteria
)
{
// NodeWeightFilter ( "#sliderANodeWeight" , "Document")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram")
function
NodeWeightFilter
(
sliderDivID
,
tgtNodeType
)
{
if
(
typeof
tgtNodeType
==
"undefined"
)
{
throw
'no nodetype'
...
...
twmain/methods.js
View file @
5be215b5
...
...
@@ -52,7 +52,7 @@ TW.pushState = function( args ) {
$
(
".for-nodecategory-0"
).
show
()
$
(
".for-nodecategory-1"
).
hide
();
NodeWeightFilter
(
"#slidercat0nodesweight"
,
TW
.
categories
[
0
]
,
"size"
);
NodeWeightFilter
(
"#slidercat0nodesweight"
,
TW
.
categories
[
0
]);
EdgeWeightFilter
(
"#slidercat0edgesweight"
,
typesKey
,
"weight"
);
}
...
...
@@ -61,7 +61,7 @@ TW.pushState = function( args ) {
$
(
".for-nodecategory-0"
).
hide
()
$
(
".for-nodecategory-1"
).
show
();
NodeWeightFilter
(
"#slidercat1nodesweight"
,
TW
.
categories
[
1
]
,
"size"
);
NodeWeightFilter
(
"#slidercat1nodesweight"
,
TW
.
categories
[
1
]);
EdgeWeightFilter
(
"#slidercat1edgesweight"
,
typesKey
,
"weight"
);
}
...
...
@@ -69,10 +69,11 @@ TW.pushState = function( args ) {
if
(
typesKey
==
"1|1"
)
{
$
(
".for-nodecategory-0"
).
show
()
$
(
".for-nodecategory-1"
).
show
();
NodeWeightFilter
(
"#slidercat0nodesweight"
,
TW
.
categories
[
0
]
,
"size"
);
NodeWeightFilter
(
"#slidercat1nodesweight"
,
TW
.
categories
[
1
]
,
"size"
);
NodeWeightFilter
(
"#slidercat0nodesweight"
,
TW
.
categories
[
0
]);
NodeWeightFilter
(
"#slidercat1nodesweight"
,
TW
.
categories
[
1
]);
// only truly bipartite edges => only one GUI slider
showDisabledSlider
(
"#slidercat0edgesweight"
)
EdgeWeightFilter
(
"#slidercat1edgesweight"
,
"1|1"
,
"weight"
);
}
}
...
...
twmain/sigmaUtils.js
View file @
5be215b5
...
...
@@ -570,7 +570,9 @@ var SigmaUtils = function () {
this
.
toggleEdges
(
false
)
}
try
{
TW
.
partialGraph
.
startForceAtlas2
();
}
catch
(
e
)
{
return
}
var
icon
=
createWaitIcon
(
'layoutwait'
)
var
btn
=
document
.
querySelector
(
'#layoutButton'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment