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
d8d77bf7
Commit
d8d77bf7
authored
May 12, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rm unnecessary number casting and other minor fixes
parent
aebf89e8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
29 deletions
+41
-29
settings_explorerjs.js
settings_explorerjs.js
+3
-2
Tinaweb.js
tinawebJS/Tinaweb.js
+19
-19
methods.js
tinawebJS/methods.js
+13
-2
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+2
-1
sigmaUtils.js
tinawebJS/sigmaUtils.js
+4
-5
No files found.
settings_explorerjs.js
View file @
d8d77bf7
...
...
@@ -44,7 +44,7 @@ var TW = {}
// *and* subdirectory to import if true
// see also ProcessDivsFlags()
TW
.
DivsFlags
[
"histogramModule"
]
=
false
;
TW
.
DivsFlags
[
"histogramDailyVariantModule"
]
=
tru
e
;
TW
.
DivsFlags
[
"histogramDailyVariantModule"
]
=
fals
e
;
// TODO more generic module integrating the variants cf. experiments/histogramModule_STUB_GENERIQUE
TW
.
DivsFlags
[
"crowdsourcingModule"
]
=
true
;
...
...
@@ -107,6 +107,7 @@ TW.filterSliders = false
TW
.
histogramStartThreshold
=
10
;
TW
.
defaultNodeColor
=
"rgb(40,40,40)"
TW
.
edgeDefaultOpacity
=
0.5
// opacity when true_color
TW
.
edgeGreyColor
=
"rgba(150, 150, 150, 0.2)"
;
TW
.
nodesGreyBorderColor
=
"rgba(100, 100, 100, 0.5)"
;
...
...
tinawebJS/Tinaweb.js
View file @
d8d77bf7
...
...
@@ -8,26 +8,19 @@ function SelectionEngine() {
// console.log("addvalue, prevsels, currsels",addvalue, prevsels, currsels)
var
targeted
=
[]
var
buffer
=
Object
.
keys
(
prevsels
)
.
map
(
Number
).
sort
(
this
.
sortNumber
)
;
var
buffer
=
Object
.
keys
(
prevsels
);
// currsels = bunch of nodes from a click in the map
currsels
=
currsels
.
map
(
Number
).
sort
(
this
.
sortNumber
);
if
(
addvalue
)
{
// FOR SIMPLE ADD WITHOUT COMPLEMENT
targeted
=
currsels
.
concat
(
buffer
.
filter
(
function
(
item
)
{
return
currsels
.
indexOf
(
item
)
<
0
;
}));
}
else
targeted
=
currsels
;
targeted
=
targeted
.
map
(
Number
)
// debug
// console.log("targeted::", targeted)
// NB new sigma: my REFA deprecated clicktype=="double"
if
(
targeted
.
length
==
0
)
return
[];
targeted
=
targeted
.
sort
();
// ------------ FOR SETWISE COMPLEMENT ---------------------->8---------
// if(buffer.length>0) {
// if(JSON.stringify(buffer)==JSON.stringify(targeted)) {
// // this is just effective for Add[ ] ...
...
...
@@ -51,16 +44,17 @@ function SelectionEngine() {
// whitelist[n] = true;
// }
// }
// targeted = Object.keys(whitelist)
.map(Number)
;
// targeted = Object.keys(whitelist);
// } else {// inter = 0 ==> click in other portion of the graph (!= current selection)
// // Union!
// if(addvalue) {
// targeted =
targeted
.concat(buffer.filter(function (item) {
// return
targeted
.indexOf(item) < 0;
// targeted =
currsels
.concat(buffer.filter(function (item) {
// return
currsels
.indexOf(item) < 0;
// }));
// }
// }
// }
// ---------------------------------------------------------->8---------
return
targeted
;
}).
index
();
...
...
@@ -125,6 +119,8 @@ function SelectionEngine() {
//Util
this
.
intersect_safe
=
function
(
a
,
b
)
{
a
.
sort
()
b
.
sort
()
var
ai
=
0
,
bi
=
0
;
var
result
=
new
Array
();
...
...
@@ -181,10 +177,13 @@ function SelectionEngine() {
selections
=
{}
// targeted arg 'nodes' can be nid array or single nid
var
ndsids
=
[]
if
(
nodes
)
{
if
(
!
$
.
isArray
(
nodes
))
ndsids
.
push
(
nodes
);
else
ndsids
=
nodes
;
for
(
var
i
in
ndsids
)
{
var
s
=
ndsids
[
i
];
...
...
@@ -261,7 +260,7 @@ function SelectionEngine() {
// show the button to remove selection
$
(
"#unselectbutton"
).
show
()
;
var
the_new_sels
=
Object
.
keys
(
selections
)
.
map
(
Number
)
var
the_new_sels
=
Object
.
keys
(
selections
)
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
selections
=
the_new_sels
;
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
setState
(
{
sels
:
the_new_sels
}
)
...
...
@@ -279,11 +278,12 @@ function SelectionEngine() {
});
// console.log("Event [gotNodeSet] sent from Tinaweb MultipleSelection2")
// TODO REFA this used for bipartite case but needs testing with correct typestring case
// £TODO REFA this used for bipartite case but needs testing with correct typestring case
//
if
(
TW
.
Relations
[
"1|1"
])
{
for
(
var
s
in
the_new_sels
)
{
var
bipaNeighs
=
TW
.
Relations
[
"1|1"
][
the_new_sels
[
s
]];
for
(
var
n
in
n
eighs
)
{
for
(
var
n
in
bipaN
eighs
)
{
if
(
typeof
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
==
"undefined"
)
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
=
0
;
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
++
;
...
...
@@ -308,9 +308,9 @@ function SelectionEngine() {
return
b
-
a
});
// console.debug('oppos', oppo
s)
// console.debug('same', same
)
//
console
.
debug
(
'selections'
,
selection
s
)
console
.
debug
(
'oppos'
,
oppos
)
console
.
debug
(
'same'
,
same
)
overNodes
=
true
;
...
...
tinawebJS/methods.js
View file @
d8d77bf7
...
...
@@ -687,7 +687,7 @@ function prepareNodesRenderingProperties(nodesDict) {
}
}
// hex color ex "#eee or #AA00AA"
else
if
(
/^#
[
A-Fa-f0-
1
]{3,6}
$/
.
test
(
n
.
color
))
{
else
if
(
/^#
[
A-Fa-f0-
9
]{3,6}
$/
.
test
(
n
.
color
))
{
rgba
=
hex2rgba
(
n
.
color
)
rgbStr
=
rgba
.
splice
(
0
,
3
).
join
(
','
);
}
...
...
@@ -695,12 +695,23 @@ function prepareNodesRenderingProperties(nodesDict) {
invalidFormat
=
true
}
}
else
{
invalidFormat
=
true
}
if
(
!
invalidFormat
)
{
n
.
color
=
`rgb(
${
rgbStr
}
)`
}
else
{
n
.
color
=
TW
.
defaultNodeColor
rgbStr
=
TW
.
defaultNodeColor
.
split
(
','
).
splice
(
0
,
3
).
join
(
','
);
}
n
.
customAttrs
=
{
grey
:
false
,
highlight
:
false
,
true_color
:
n
.
color
,
defgrey_color
:
"rgba("
+
rgbStr
+
",.
4
)"
defgrey_color
:
"rgba("
+
rgbStr
+
",.
5
)"
}
// POSS n.type: distinguish rendtype and twtype
...
...
tinawebJS/sigma.parseCustom.js
View file @
d8d77bf7
...
...
@@ -899,7 +899,8 @@ function dictfyJSON( data , categories ) {
node
.
y
=
(
n
.
y
)?
n
.
y
:
Math
.
random
();
node
.
color
=
(
n
.
color
)?
n
.
color
:
"#FFFFFF"
;
if
(
n
.
shape
)
node
.
shape
=
n
.
shape
;
if
(
n
.
attributes
)
node
.
attributes
=
n
.
attributes
;
if
(
n
.
attributes
)
node
.
attributes
=
n
.
attributes
else
node
.
attributes
=
{}
node
.
type
=
(
n
.
type
)?
n
.
type
:
categories
[
0
]
;
// node.shape = "square";
...
...
tinawebJS/sigmaUtils.js
View file @
d8d77bf7
...
...
@@ -553,8 +553,8 @@ SigmaUtils = function () {
// (TODO REFA make them inside TW.- ns)
//
not often necessary + costly in mem because is a clone
//
=> preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
//
getnodes => preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
//
(not often necessary + costly in mem because is a clone)
function
getnodes
(){
// new sigma.js
return
TW
.
partialGraph
.
graph
.
nodes
();
...
...
@@ -610,10 +610,9 @@ function find(lquery){
}
function
exactfind
(
label
)
{
nds
=
getnodes
();
if
(
typeof
lquery
==
'string'
&&
lquery
.
length
>
0
)
{
for
(
var
i
in
n
ds
){
n
=
nds
[
i
]
;
for
(
var
i
in
TW
.
nodeI
ds
){
n
=
TW
.
partialGraph
.
graph
.
nodes
(
TW
.
nodeIds
[
i
])
;
if
(
!
n
.
hidden
){
if
(
n
.
label
==
label
)
{
return
n
;
...
...
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