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
Hide 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 = {}
...
@@ -44,7 +44,7 @@ var TW = {}
// *and* subdirectory to import if true
// *and* subdirectory to import if true
// see also ProcessDivsFlags()
// see also ProcessDivsFlags()
TW
.
DivsFlags
[
"histogramModule"
]
=
false
;
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
// TODO more generic module integrating the variants cf. experiments/histogramModule_STUB_GENERIQUE
TW
.
DivsFlags
[
"crowdsourcingModule"
]
=
true
;
TW
.
DivsFlags
[
"crowdsourcingModule"
]
=
true
;
...
@@ -107,11 +107,12 @@ TW.filterSliders = false
...
@@ -107,11 +107,12 @@ TW.filterSliders = false
TW
.
histogramStartThreshold
=
10
;
TW
.
histogramStartThreshold
=
10
;
TW
.
defaultNodeColor
=
"rgb(40,40,40)"
TW
.
edgeDefaultOpacity
=
0.5
// opacity when true_color
TW
.
edgeDefaultOpacity
=
0.5
// opacity when true_color
TW
.
edgeGreyColor
=
"rgba(150, 150, 150, 0.2)"
;
TW
.
edgeGreyColor
=
"rgba(150, 150, 150, 0.2)"
;
TW
.
nodesGreyBorderColor
=
"rgba(100, 100, 100, 0.5)"
;
TW
.
nodesGreyBorderColor
=
"rgba(100, 100, 100, 0.5)"
;
TW
.
selectedColor
=
"node"
// "node" for a background like the node's color,
TW
.
selectedColor
=
"node"
// "node" for a background like the node's color,
// "default" for note-like yellow
// "default" for note-like yellow
TW
.
overSampling
=
true
// costly hi-def rendering (true => pixelRatio x 2)
TW
.
overSampling
=
true
// costly hi-def rendering (true => pixelRatio x 2)
...
...
tinawebJS/Tinaweb.js
View file @
d8d77bf7
...
@@ -8,26 +8,19 @@ function SelectionEngine() {
...
@@ -8,26 +8,19 @@ function SelectionEngine() {
// console.log("addvalue, prevsels, currsels",addvalue, prevsels, currsels)
// console.log("addvalue, prevsels, currsels",addvalue, prevsels, currsels)
var
targeted
=
[]
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 = bunch of nodes from a click in the map
currsels
=
currsels
.
map
(
Number
).
sort
(
this
.
sortNumber
);
if
(
addvalue
)
{
if
(
addvalue
)
{
// FOR SIMPLE ADD WITHOUT COMPLEMENT
targeted
=
currsels
.
concat
(
buffer
.
filter
(
function
(
item
)
{
targeted
=
currsels
.
concat
(
buffer
.
filter
(
function
(
item
)
{
return
currsels
.
indexOf
(
item
)
<
0
;
return
currsels
.
indexOf
(
item
)
<
0
;
}));
}));
}
else
targeted
=
currsels
;
}
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
[];
if
(
targeted
.
length
==
0
)
return
[];
targeted
=
targeted
.
sort
();
// ------------ FOR SETWISE COMPLEMENT ---------------------->8---------
// if(buffer.length>0) {
// if(buffer.length>0) {
// if(JSON.stringify(buffer)==JSON.stringify(targeted)) {
// if(JSON.stringify(buffer)==JSON.stringify(targeted)) {
// // this is just effective for Add[ ] ...
// // this is just effective for Add[ ] ...
...
@@ -51,16 +44,17 @@ function SelectionEngine() {
...
@@ -51,16 +44,17 @@ function SelectionEngine() {
// whitelist[n] = true;
// 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)
// } else {// inter = 0 ==> click in other portion of the graph (!= current selection)
// // Union!
// // Union!
// if(addvalue) {
// if(addvalue) {
// targeted =
targeted
.concat(buffer.filter(function (item) {
// targeted =
currsels
.concat(buffer.filter(function (item) {
// return
targeted
.indexOf(item) < 0;
// return
currsels
.indexOf(item) < 0;
// }));
// }));
// }
// }
// }
// }
// }
// }
// ---------------------------------------------------------->8---------
return
targeted
;
return
targeted
;
}).
index
();
}).
index
();
...
@@ -125,6 +119,8 @@ function SelectionEngine() {
...
@@ -125,6 +119,8 @@ function SelectionEngine() {
//Util
//Util
this
.
intersect_safe
=
function
(
a
,
b
)
{
this
.
intersect_safe
=
function
(
a
,
b
)
{
a
.
sort
()
b
.
sort
()
var
ai
=
0
,
bi
=
0
;
var
ai
=
0
,
bi
=
0
;
var
result
=
new
Array
();
var
result
=
new
Array
();
...
@@ -181,10 +177,13 @@ function SelectionEngine() {
...
@@ -181,10 +177,13 @@ function SelectionEngine() {
selections
=
{}
selections
=
{}
// targeted arg 'nodes' can be nid array or single nid
var
ndsids
=
[]
var
ndsids
=
[]
if
(
nodes
)
{
if
(
nodes
)
{
if
(
!
$
.
isArray
(
nodes
))
ndsids
.
push
(
nodes
);
if
(
!
$
.
isArray
(
nodes
))
ndsids
.
push
(
nodes
);
else
ndsids
=
nodes
;
else
ndsids
=
nodes
;
for
(
var
i
in
ndsids
)
{
for
(
var
i
in
ndsids
)
{
var
s
=
ndsids
[
i
];
var
s
=
ndsids
[
i
];
...
@@ -261,7 +260,7 @@ function SelectionEngine() {
...
@@ -261,7 +260,7 @@ function SelectionEngine() {
// show the button to remove selection
// show the button to remove selection
$
(
"#unselectbutton"
).
show
()
;
$
(
"#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
].
selections
=
the_new_sels
;
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
setState
(
{
sels
:
the_new_sels
}
)
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
setState
(
{
sels
:
the_new_sels
}
)
...
@@ -279,11 +278,12 @@ function SelectionEngine() {
...
@@ -279,11 +278,12 @@ function SelectionEngine() {
});
});
// console.log("Event [gotNodeSet] sent from Tinaweb MultipleSelection2")
// 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"
])
{
if
(
TW
.
Relations
[
"1|1"
])
{
for
(
var
s
in
the_new_sels
)
{
for
(
var
s
in
the_new_sels
)
{
var
bipaNeighs
=
TW
.
Relations
[
"1|1"
][
the_new_sels
[
s
]];
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"
)
if
(
typeof
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
==
"undefined"
)
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
=
0
;
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
=
0
;
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
++
;
oppositeSideNeighbors
[
bipaNeighs
[
n
]]
++
;
...
@@ -308,9 +308,9 @@ function SelectionEngine() {
...
@@ -308,9 +308,9 @@ function SelectionEngine() {
return
b
-
a
return
b
-
a
});
});
// console.debug('oppos', oppo
s)
console
.
debug
(
'selections'
,
selection
s
)
// console.debug('same', same
)
console
.
debug
(
'oppos'
,
oppos
)
//
console
.
debug
(
'same'
,
same
)
overNodes
=
true
;
overNodes
=
true
;
...
...
tinawebJS/methods.js
View file @
d8d77bf7
...
@@ -687,7 +687,7 @@ function prepareNodesRenderingProperties(nodesDict) {
...
@@ -687,7 +687,7 @@ function prepareNodesRenderingProperties(nodesDict) {
}
}
}
}
// hex color ex "#eee or #AA00AA"
// 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
)
rgba
=
hex2rgba
(
n
.
color
)
rgbStr
=
rgba
.
splice
(
0
,
3
).
join
(
','
);
rgbStr
=
rgba
.
splice
(
0
,
3
).
join
(
','
);
}
}
...
@@ -695,12 +695,23 @@ function prepareNodesRenderingProperties(nodesDict) {
...
@@ -695,12 +695,23 @@ function prepareNodesRenderingProperties(nodesDict) {
invalidFormat
=
true
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
=
{
n
.
customAttrs
=
{
grey
:
false
,
grey
:
false
,
highlight
:
false
,
highlight
:
false
,
true_color
:
n
.
color
,
true_color
:
n
.
color
,
defgrey_color
:
"rgba("
+
rgbStr
+
",.
4
)"
defgrey_color
:
"rgba("
+
rgbStr
+
",.
5
)"
}
}
// POSS n.type: distinguish rendtype and twtype
// POSS n.type: distinguish rendtype and twtype
...
...
tinawebJS/sigma.parseCustom.js
View file @
d8d77bf7
...
@@ -899,7 +899,8 @@ function dictfyJSON( data , categories ) {
...
@@ -899,7 +899,8 @@ function dictfyJSON( data , categories ) {
node
.
y
=
(
n
.
y
)?
n
.
y
:
Math
.
random
();
node
.
y
=
(
n
.
y
)?
n
.
y
:
Math
.
random
();
node
.
color
=
(
n
.
color
)?
n
.
color
:
"#FFFFFF"
;
node
.
color
=
(
n
.
color
)?
n
.
color
:
"#FFFFFF"
;
if
(
n
.
shape
)
node
.
shape
=
n
.
shape
;
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
.
type
=
(
n
.
type
)?
n
.
type
:
categories
[
0
]
;
// node.shape = "square";
// node.shape = "square";
...
...
tinawebJS/sigmaUtils.js
View file @
d8d77bf7
...
@@ -553,8 +553,8 @@ SigmaUtils = function () {
...
@@ -553,8 +553,8 @@ SigmaUtils = function () {
// (TODO REFA make them inside TW.- ns)
// (TODO REFA make them inside TW.- ns)
//
not often necessary + costly in mem because is a clone
//
getnodes => preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
//
=> preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
//
(not often necessary + costly in mem because is a clone)
function
getnodes
(){
function
getnodes
(){
// new sigma.js
// new sigma.js
return
TW
.
partialGraph
.
graph
.
nodes
();
return
TW
.
partialGraph
.
graph
.
nodes
();
...
@@ -610,10 +610,9 @@ function find(lquery){
...
@@ -610,10 +610,9 @@ function find(lquery){
}
}
function
exactfind
(
label
)
{
function
exactfind
(
label
)
{
nds
=
getnodes
();
if
(
typeof
lquery
==
'string'
&&
lquery
.
length
>
0
)
{
if
(
typeof
lquery
==
'string'
&&
lquery
.
length
>
0
)
{
for
(
var
i
in
n
ds
){
for
(
var
i
in
TW
.
nodeI
ds
){
n
=
nds
[
i
]
;
n
=
TW
.
partialGraph
.
graph
.
nodes
(
TW
.
nodeIds
[
i
])
;
if
(
!
n
.
hidden
){
if
(
!
n
.
hidden
){
if
(
n
.
label
==
label
)
{
if
(
n
.
label
==
label
)
{
return
n
;
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