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
7a520bf1
Commit
7a520bf1
authored
Oct 22, 2014
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning the dead code
parent
b38dc494
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
487 deletions
+38
-487
explorerjs.html
explorerjs.html
+2
-0
enviroment.js
tinawebJS/js/enviroment.js
+12
-87
methods.js
tinawebJS/js/methods.js
+9
-204
sigma.forceatlas2.js
tinawebJS/js/sigma.forceatlas2.js
+1
-143
sigma.parseCustom.js
tinawebJS/js/sigma.parseCustom.js
+1
-6
sigmaUtils.js
tinawebJS/js/sigmaUtils.js
+13
-47
No files found.
explorerjs.html
View file @
7a520bf1
...
...
@@ -380,6 +380,8 @@
<script
src=
"libs/bootstrap/js/bootstrap-hover-dropdown.min.js"
type=
"text/javascript"
></script>
<!--<script src="libs/bootstrap-select.min.js" type="text/javascript"></script>-->
<script
src=
"tinawebJS/js/globalUtils.js"
type=
"text/javascript"
></script>
<script
src=
"geomap2/js/raphael/raphael-min.js"
charset=
"utf-8"
></script>
<script
src=
"geomap2/js/jquery.mapael.js"
charset=
"utf-8"
></script>
...
...
tinawebJS/js/enviroment.js
View file @
7a520bf1
...
...
@@ -51,9 +51,6 @@ function changeType() {
if
(
swclickActual
==
"sociosemantic"
)
{
pr
(
"click en changeType y estoy en SocioSemantic, swMacro:"
+
swMacro
+
"|selections:"
);
pr
(
selections
)
if
(
swMacro
)
{
changeToMacro
(
"sociosemantic"
);
pushSWClick
(
"sociosemantic"
);
...
...
@@ -66,18 +63,15 @@ function changeType() {
RefreshState
(
PAST
.
toUpperCase
())
}
else
{
//there is an active selection
//identify type of the current-selection
var
countTypes
=
{};
pr
(
"identify type of the current-selection"
)
for
(
var
i
in
selections
)
{
if
(
isUndef
(
countTypes
[
Nodes
[
i
].
type
])
)
countTypes
[
Nodes
[
i
].
type
]
=
1
;
else
countTypes
[
Nodes
[
i
].
type
]
++
;
}
pr
(
"#selectionsTypes: "
)
pr
(
"bigraph #selectionsTypes: "
)
pr
(
countTypes
)
...
...
@@ -85,7 +79,6 @@ function changeType() {
if
(
cpCountTypes
.
length
==
1
)
{
if
(
cpCountTypes
[
0
]
==
catSoc
)
{
pr
(
"FROM MESO-SOCIOSEMANTIC TO MESO-SOCIAL"
)
pushSWClick
(
"social"
);
changeToMeso
(
"social"
);
RefreshState
(
"a"
);
...
...
@@ -97,9 +90,8 @@ function changeType() {
}
}
else
{
//there is a selection of both kind of nodes
//
//there is a selection with both kind of nodes
//Manually changing the selection, not using MultipleSelection
var
ndsids
=
[];
for
(
var
i
in
selections
)
{
if
(
Nodes
[
i
].
type
==
catSoc
)
...
...
@@ -109,34 +101,16 @@ function changeType() {
for
(
var
i
in
ndsids
){
nodeid
=
ndsids
[
i
]
getOpossitesNodes
(
nodeid
,
false
);
//false -> just nodeid
// markAsSelected(nodeid,true);
}
pushSWClick
(
"social"
);
changeToMeso
(
"social"
);
RefreshState
(
"a"
);
}
// pushSWClick(swclickPrev);
// changeToMeso(swclickActual);
// RefreshState(PAST)
}
}
// if(swMacro) {
// changeToMacro("semantic");
// pushSWClick("semantic");
// RefreshState("B")
// $("#category-A").hide();
// $("#category-B").show();
// } else {
// changeToMeso("sociosemantic");
// pushSWClick("sociosemantic");
// RefreshState("AaBb")
// $("#category-A").show();
// $("#category-B").show();
// }
return
;
}
}
...
...
@@ -145,8 +119,7 @@ function changeLevel() {
bf
=
swclickActual
pushSWClick
(
swclickActual
);
pr
(
"swMacro: "
+
swMacro
+
" - [swclickPrev: "
+
bf
+
"] - [swclickActual: "
+
swclickActual
+
"]"
)
// partialGraph.stopForceAtlas2();
// ANALIZING CURRENT STATE:
if
(
swMacro
){
// Macro Level -- swMacro:true
if
(
swclickActual
==
"social"
)
{
...
...
@@ -174,39 +147,8 @@ function changeLevel() {
return
;
}
// changeToMeso("social")
// changeToMeso("semantic")
// changeToMacro("social")
// changeToMacro("semantic")
}
//obsolete
function
neweffectshow
(){
if
(
!
is_empty
(
selections
)){
$
(
"#labelchange"
).
show
();
$
(
"#availableView"
).
show
();
}
}
//obsolete
function
neweffecthide
(){
$
.
doTimeout
(
300
,
function
(){
if
(
$
(
"#labelchange"
)[
0
].
hidden
==
false
){
}
else
{
$
(
"#labelchange"
).
hide
();
$
(
"#availableView"
).
hide
();
}
});
}
//obsolete
function
justhide
(){
$
(
"#labelchange"
).
hide
();
$
(
"#availableView"
).
hide
();
}
//============================= </ NEW BUTTONS > =============================//
...
...
@@ -218,6 +160,8 @@ function justhide(){
//=========================== < FILTERS-SLIDERS > ===========================//
// Execution modes:
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
function
EdgeWeightFilter
(
sliderDivID
,
type_attrb
,
type
,
criteria
)
{
...
...
@@ -238,12 +182,6 @@ 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")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if
(
partialGraph
.
_core
.
graph
.
edges
.
length
==
0
)
{
$
(
sliderDivID
).
freshslider
({
...
...
@@ -291,8 +229,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
if
(
i
>=
low
&&
i
<=
high
){
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
// partialGraph._core.graph.edgesIndex[ID].lock=false;
// partialGraph._core.graph.edgesIndex[ID].hidden=false;
Edges
[
ID
].
lock
=
false
;
for
(
var
n
in
partialGraph
.
_core
.
graph
.
nodesIndex
)
{
sid
=
Edges
[
ID
].
sourceID
...
...
@@ -308,8 +244,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}
else
{
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
// partialGraph._core.graph.edgesIndex[ID].lock=true;
// partialGraph._core.graph.edgesIndex[ID].hidden=true;
partialGraph
.
dropEdge
(
ID
)
Edges
[
ID
].
lock
=
true
;
}
...
...
@@ -330,12 +264,15 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}
});
//
doTimeout
});
//
[/doTimeout]
}
});
}
// Execution modes:
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function
NodeWeightFilter
(
sliderDivID
,
type_attrb
,
type
,
criteria
)
{
...
...
@@ -345,7 +282,6 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return
;
}
// sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1"
// type_attrb = "label"
...
...
@@ -356,11 +292,6 @@ function NodeWeightFilter(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")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
if
(
partialGraph
.
_core
.
graph
.
nodes
.
length
==
0
)
{
$
(
sliderDivID
).
freshslider
({
...
...
@@ -435,7 +366,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
});
}
// Execution modes:
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
...
...
@@ -525,12 +456,6 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
//============================= < SEARCH > =============================//
function
updateSearchLabels
(
id
,
name
,
type
){
labels
.
push
({
...
...
tinawebJS/js/methods.js
View file @
7a520bf1
//to general utils
function
pr
(
msg
)
{
console
.
log
(
msg
);
}
//to general utils
function
isUndef
(
variable
){
if
(
typeof
(
variable
)
===
"undefined"
)
return
true
;
else
return
false
;
}
//to general utils
$
.
fn
.
toggleClick
=
function
(){
methods
=
arguments
,
// store the passed arguments for future reference
count
=
methods
.
length
;
// cache the number of methods
//use return this to maintain jQuery chainability
return
this
.
each
(
function
(
i
,
item
){
// for each element you bind to
index
=
0
;
// create a local counter for that element
$
(
item
).
click
(
function
(){
// bind a click handler to that element
return
methods
[
index
++
%
count
].
apply
(
this
,
arguments
);
// that when called will apply the 'index'th method to that element
// the index % count means that we constrain our iterator between 0 and (count-1)
});
});
};
//to general utils
getUrlParam
=
(
function
()
{
var
get
=
{
push
:
function
(
key
,
value
){
var
cur
=
this
[
key
];
if
(
cur
.
isArray
){
this
[
key
].
push
(
value
);
}
else
{
this
[
key
]
=
[];
this
[
key
].
push
(
cur
);
this
[
key
].
push
(
value
);
}
}
},
search
=
document
.
location
.
search
,
decode
=
function
(
s
,
boo
)
{
var
a
=
decodeURIComponent
(
s
.
split
(
"+"
).
join
(
" "
));
return
boo
?
a
.
replace
(
/
\s
+/g
,
''
):
a
;
};
search
.
replace
(
/
\??(?:([^
=
]
+
)
=
([^
&
]
*
)
&
?)
/g
,
function
(
a
,
b
,
c
)
{
if
(
get
[
decode
(
b
,
true
)]){
get
.
push
(
decode
(
b
,
true
),
decode
(
c
));
}
else
{
get
[
decode
(
b
,
true
)]
=
decode
(
c
);
}
});
return
get
;
})();
//to general utils
function
ArraySortByValue
(
array
,
sortFunc
){
var
tmp
=
[];
oposMAX
=
0
;
for
(
var
k
in
array
)
{
if
(
array
.
hasOwnProperty
(
k
))
{
tmp
.
push
({
key
:
k
,
value
:
array
[
k
]
});
if
((
array
[
k
])
>
oposMAX
)
oposMAX
=
array
[
k
];
}
}
tmp
.
sort
(
function
(
o1
,
o2
)
{
return
sortFunc
(
o1
.
value
,
o2
.
value
);
});
return
tmp
;
}
//to general utils
function
ArraySortByKey
(
array
,
sortFunc
){
var
tmp
=
[];
for
(
var
k
in
array
)
{
if
(
array
.
hasOwnProperty
(
k
))
{
tmp
.
push
({
key
:
k
,
value
:
array
[
k
]
});
}
}
tmp
.
sort
(
function
(
o1
,
o2
)
{
return
sortFunc
(
o1
.
key
,
o2
.
key
);
});
return
tmp
;
}
//to general utils
function
is_empty
(
obj
)
{
// Assume if it has a length property with a non-zero value
// that that property is correct.
if
(
obj
.
length
&&
obj
.
length
>
0
)
return
false
;
if
(
obj
.
length
&&
obj
.
length
===
0
)
return
true
;
for
(
var
key
in
obj
)
{
if
(
hasOwnProperty
.
call
(
obj
,
key
))
return
false
;
}
return
true
;
}
//obsolete
function
returnBaseUrl
()
{
origin
=
window
.
location
.
origin
;
nameOfHtml
=
window
.
location
.
pathname
.
substring
(
window
.
location
.
pathname
.
lastIndexOf
(
'/'
)
+
1
);
pathname
=
window
.
location
.
pathname
.
replace
(
nameOfHtml
,
""
);
return
origin
+
pathname
+
twjs
;
}
function
cancelSelection
(
fromTagCloud
)
{
pr
(
"
\
t***in cancelSelection"
);
...
...
@@ -287,10 +171,8 @@ function pushSWClick(arg){
swclickActual
=
arg
;
}
// it receives entire node
function
selection
(
currentNode
){
// pr("\t***in selection()");
if
(
checkBox
==
false
&&
cursor_size
==
0
)
{
highlightSelectedNodes
(
false
);
opossites
=
[];
...
...
@@ -425,7 +307,6 @@ function selection(currentNode){
}
function
getOpossitesNodes
(
node_id
,
entireNode
)
{
// pr("\tin getOpossitesNodes");
node
=
""
;
if
(
entireNode
==
true
)
node
=
node_id
;
else
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
node_id
];
...
...
@@ -436,8 +317,7 @@ function getOpossitesNodes(node_id, entireNode) {
}
if
(
!
node
)
return
null
;
//selection(node);
//selection(node);
if
(
categoriesIndex
.
length
==
1
)
selectionUni
(
node
);
if
(
categoriesIndex
.
length
==
2
)
selection
(
node
);
...
...
@@ -446,22 +326,6 @@ function getOpossitesNodes(node_id, entireNode) {
});
}
//to sigma utils!
function
getNodeLabels
(
elems
){
var
labelss
=
[]
for
(
var
i
in
elems
){
var
id
=
(
!
isUndef
(
elems
[
i
].
key
))?
elems
[
i
].
key
:
i
labelss
.
push
(
Nodes
[
id
].
label
)
}
return
labelss
}
//to sigma utils!
function
getNodeIDs
(
elems
){
return
Object
.
keys
(
elems
)
}
// tag cloud div
//missing: the graphNGrams javascript
function
htmlfied_alternodes
(
elems
)
{
...
...
@@ -575,6 +439,7 @@ function LevelButtonDisable( TF ){
$
(
'#changelevel'
).
prop
(
'disabled'
,
TF
);
}
//tofix!
function
graphTagCloudElem
(
node_id
){
pr
(
"
\
tin graphTagCloudElem"
);
/**/
console
.
log
(
"in graphTagCloudElem, nodae_id: "
+
node_id
);
...
...
@@ -593,12 +458,8 @@ function updateDownNodeEvent(selectionRadius){
hoverNodeEffectWhileFA2
(
selectionRadius
);
}
function
greyEverything
(){
// pr("\t\t\tin grey everything");
// for(var i in deselections){
// partialGraph._core.graph.nodesIndex[i].forceLabel=false;
// }
// deselections={};
nds
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!
n
[
'hidden'
];
...
...
@@ -606,10 +467,8 @@ function greyEverything(){
for
(
var
i
in
nds
){
if
(
!
nds
[
i
].
attr
[
'grey'
]){
nds
[
i
].
attr
[
'true_color'
]
=
nds
[
i
].
color
;
// pr(nds[i].color)
alphacol
=
"rgba("
+
hex2rga
(
nds
[
i
].
color
)
+
",0.5)"
;
nds
[
i
].
color
=
alphacol
;
// nds[i].color = "rgba("+hex2rga(nds[i].color)+",0.5)"
}
nds
[
i
].
attr
[
'grey'
]
=
1
;
}
...
...
@@ -638,6 +497,9 @@ function greyEverything(){
}
}
//it is a mess but it works.
// TODO: refactor this
function
markAsSelected
(
n_id
,
sel
)
{
if
(
!
isUndef
(
n_id
.
id
))
nodeSel
=
n_id
;
else
nodeSel
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
n_id
];
...
...
@@ -1133,14 +995,10 @@ function MultipleSelection(nodes){
for
(
var
i
in
ndsids
){
nodeid
=
ndsids
[
i
]
getOpossitesNodes
(
nodeid
,
false
);
//false -> just nodeid
// markAsSelected(nodeid,true);
}
for
(
var
i
in
selections
){
markAsSelected
(
i
,
true
);
}
// pr("selections content AFTER: ")
// pr(selections)
// pr("=============")
}
overNodes
=
true
;
...
...
@@ -1411,6 +1269,8 @@ function add1Edge(ID) {
}
}
//obsolete au non
function
hideElem
(
id
){
if
(
id
.
split
(
";"
).
length
==
1
){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
...
...
@@ -1422,6 +1282,7 @@ function hideElem(id){
}
}
//obsolete au non
function
unHideElem
(
id
){
if
(
id
.
split
(
";"
).
length
==
1
){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
...
...
@@ -1751,16 +1612,11 @@ function highlightOpossites (list){/*here*/
}
}
function
getByID
(
elem
)
{
return
document
.
getElementById
(
elem
);
}
function
saveGraph
()
{
size
=
getByID
(
"check_size"
).
checked
color
=
getByID
(
"check_color"
).
checked
atts
=
{
"size"
:
size
,
"color"
:
color
}
pr
(
atts
)
if
(
getByID
(
"fullgraph"
).
checked
)
{
saveGEXF
(
getnodes
()
,
getedges
()
,
atts
);
...
...
@@ -1842,54 +1698,3 @@ function saveGraphIMG(){
var
strData
=
edgesDiv
.
toDataURL
(
"image/png"
);
document
.
location
.
href
=
strData
.
replace
(
"image/png"
,
strDownloadMime
)
}
//obsolete
function
setComponentButton
(
comp_name
){
document
.
getElementById
(
comp_name
);
}
//obsolete
function
changeSwitchImage
(
source
,
target
){
pr
(
"**** changeSwitchImage() does NOTHING ****"
)
// if(target=="social") {
// setComponentButton("social",true);
// setComponentButton("semantic",false);
// setComponentButton("sociosemantic",false);
// }
// if(target=="semantic") {
// setComponentButton("social",false);
// setComponentButton("semantic",true);
// setComponentButton("sociosemantic",false);
// }
// if(target=="sociosemantic") {
// setComponentButton("social",false);
// setComponentButton("semantic",false);
// setComponentButton("sociosemantic",true);
// }
// fullurl = returnBaseUrl()+"img/trans/";
// if(source=="fromHtml"){
// if(document.getElementById("switchbutton").src==fullurl+"showKeywords.png"){
// document.getElementById("switchbutton").src=fullurl+"showScholars.png";
// }
// else {
// document.getElementById("switchbutton").src=fullurl+"showKeywords.png";
// }
// }
// else {
// if(target=="social") document.getElementById("switchbutton").src=fullurl+"showKeywords.png";
// if(target=="semantic") document.getElementById("switchbutton").src=fullurl+"showScholars.png";
// }
//pr($("#names").text());
}
//obsolete
function
switchSelection
(){
if
(
swclickActual
==
"social"
){
//If we are seeing the Social Graph, this implies that the left panel
//is showing Keywords, so we have to invert names and opossites
}
if
(
swclickActual
==
"semantic"
){
//If we are seeing the Semantic Graph, this implies that the left panel
//is showing Scholars, so we have to invert names and opossites
}
}
tinawebJS/js/sigma.forceatlas2.js
View file @
7a520bf1
...
...
@@ -1111,68 +1111,6 @@ sigma.publicPrototype.startForceAtlas2 = function() {
//if(!this.forceatlas2) {
if
(
fa2enabled
)
{
// // -- UPDATING THE DEGREE --
// for (var i in this._core.graph.nodesIndex) {
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
// }
// for (var i in this._core.graph.nodes) {
// if(!this._core.graph.nodes[i].hidden) {
// this._core.graph.nodes[i].degree = 0;
// this._core.graph.nodesIndex[this._core.graph.nodes[i].id].degree = 0;
// }
// }
// for (var e in this._core.graph.edges) {
// edge = this._core.graph.edges[e];
// if(!edge.hidden) {
// nodeIDS = edge.source.id;
// nodeIDT = edge.target.id;
// this._core.graph.nodesIndex[nodeIDS].degree++;
// this._core.graph.nodesIndex[nodeIDT].degree++;
// }
// }
// for (var i in this._core.graph.nodes) {
// if(!this._core.graph.nodes[i].hidden && this._core.graph.nodes[i].degree>0) {
// if(this._core.graph.nodes[i].x < minx) minx = this._core.graph.nodes[i].x
// if(this._core.graph.nodes[i].x > maxx) maxx = this._core.graph.nodes[i].x
// if(this._core.graph.nodes[i].y < miny) miny = this._core.graph.nodes[i].y
// if(this._core.graph.nodes[i].y > maxy) maxy = this._core.graph.nodes[i].y
// }
// }
// var ybuffer = miny;
// for (var i in this._core.graph.nodesIndex) {
// if(this._core.graph.nodesIndex[i].degree==0) {
// // this._core.graph.nodesIndex[i].color = "#000000"
// this._core.graph.nodesIndex[i].x = minx-10
// this._core.graph.nodesIndex[i].y = ybuffer
// this._core.graph.nodesIndex[i].displayX = minx-10
// this._core.graph.nodesIndex[i].displayY = ybuffer
// // this._core.graph.nodesIndex[i].hidden = true;
// // this._core.graph.nodesIndex[i].fixed = true;
// ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// pr(ybuffer)
// }
// // this._core.graph.nodesIndex[i].hidden = true;
// pr(i+" -> "+this._core.graph.nodesIndex[i].degree)
// }
// // -- / UPDATING THE DEGREE --
// pr("minx: "+minx)
// pr("maxx: "+maxx)
// pr("miny: "+miny)
// pr("maxy: "+maxy)
// pr("")
var
V
=
10
;
var
E
=
100
;
...
...
@@ -1203,7 +1141,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
// fixing anomaly in forceatlas2
$
.
doTimeout
(
250
,
function
(){
if
(
partialGraph
.
forceatlas2
.
active
&&
partialGraph
.
forceatlas2
.
count
==
0
)
{
pr
(
"SUPER
TECHNIQUE
!!"
)
pr
(
"SUPER
JUTSU
!!"
)
partialGraph
.
startForceAtlas2
();
return
;
}
...
...
@@ -1222,84 +1160,4 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
partialGraph
.
refresh
();
if
(
minimap
)
$
(
"#overviewzone"
).
show
();
/*
// calc dimensions of connected subgraphs
minx=1000.0;
maxx=0.0;
miny=1000.0;
maxy=0.0;
for (var i in this._core.graph.nodes) {
if(!this._core.graph.nodes[i].hidden && this._core.graph.nodes[i].degree>0) {
if(this._core.graph.nodes[i].x < minx) minx = this._core.graph.nodes[i].x
if(this._core.graph.nodes[i].x > maxx) maxx = this._core.graph.nodes[i].x
if(this._core.graph.nodes[i].y < miny) miny = this._core.graph.nodes[i].y
if(this._core.graph.nodes[i].y > maxy) maxy = this._core.graph.nodes[i].y
}
}
// var ybuffer = miny;
// for (var i in this._core.graph.nodesIndex) {
// // if (swMacro && this._core.graph.nodesIndex[i].degree>0) {
// // Nodes[i].x = this._core.graph.nodesIndex[i].x;
// // Nodes[i].y = this._core.graph.nodesIndex[i].y;
// // }
// if(this._core.graph.nodesIndex[i].degree==0) {
// pr(this._core.graph.nodesIndex[i].label);
// this._core.graph.nodesIndex[i].x = minx-10
// this._core.graph.nodesIndex[i].y = ybuffer
// ybuffer = ybuffer + Math.pow(this._core.graph.nodesIndex[i].displaySize,2);
// }
// }
// pr("minx: "+minx)
// pr("maxx: "+maxx)
// pr("miny: "+miny)
// pr("maxy: "+maxy)
// pr("")
Ox = (minx+maxx)/2;
Oy = (miny+maxy)/2;
Ax = minx;
Ay = miny;
// var ctx = partialGraph._core.domElements.mouse.getContext('2d');
// ctx.globalCompositeOperation = "source-over";
// ctx.clearRect(0, 0, partialGraph._core.domElements.nodes.width, partialGraph._core.domElements.nodes.height);
// draw1Circle(ctx,minx,miny,"aqua") // point A
// draw1Circle(ctx,maxx,miny,"blue") // point B
// draw1Circle(ctx,minx,maxy,"coral") //point C
// draw1Circle(ctx,maxx,maxy,"darkorange") // point D
// draw1Circle(ctx, Ox , Oy ,"red") // Center
var R = Math.sqrt( Math.pow((Ox-Ax), 2) + Math.pow((Oy-Ay), 2) );
R = R * 1.2;
stepDeg = 2/parseFloat(isolatedBCauseFilter);
var mult = 1;
for (var i in this._core.graph.nodes) {
if(this._core.graph.nodes[i].degree==0) {
this._core.graph.nodes[i].hidden=false;
this._core.graph.nodes[i].x = Ox + R*Math.cos(Math.PI*stepDeg*mult);
this._core.graph.nodes[i].y = Oy + R*Math.sin(Math.PI*stepDeg*mult);
mult++;
}
}
*/
};
tinawebJS/js/sigma.parseCustom.js
View file @
7a520bf1
...
...
@@ -703,7 +703,6 @@ function extractFromJson(data,seed){
Edges
[
indice
]
=
edge
;
if
(
edge
.
label
==
"nodes1"
){
// edge.hidden=false;
if
(
isUndef
(
nodes1
[
source
]))
{
nodes1
[
source
]
=
{
...
...
@@ -721,7 +720,7 @@ function extractFromJson(data,seed){
nodes1
[
target
].
neighbours
.
push
(
source
);
// social edges = 1
Edges
[
indice
].
bweight
=
edgesNodes
[
i
].
w
;
//realweight
as
in bigraph-weight
Edges
[
indice
].
bweight
=
edgesNodes
[
i
].
w
;
//realweight
just
in bigraph-weight
edge
.
weight
=
1
;
partialGraph
.
addEdge
(
indice
,
source
,
target
,
edge
);
...
...
@@ -729,7 +728,6 @@ function extractFromJson(data,seed){
if
(
edge
.
label
==
"nodes2"
){
// edge.hidden=true;
if
(
isUndef
(
nodes2
[
source
]))
{
nodes2
[
source
]
=
{
...
...
@@ -751,10 +749,8 @@ function extractFromJson(data,seed){
if
(
edge
.
label
==
"bipartite"
){
// edge.hidden=true;
s
=
edge
.
sourceID
// // Source is Document
if
(
Nodes
[
s
].
type
==
catSoc
)
{
...
...
@@ -794,6 +790,5 @@ function extractFromJson(data,seed){
}
}
//edge.hidden=false/**///should be commented
}
}
tinawebJS/js/sigmaUtils.js
View file @
7a520bf1
...
...
@@ -114,18 +114,22 @@ function exactfind(label) {
return
null
;
}
//to general utils (not used btw)
function
cloneObject
(
source
)
{
for
(
i
in
source
)
{
if
(
typeof
source
[
i
]
==
'source'
)
{
this
[
i
]
=
new
cloneObject
(
source
[
i
]);
}
else
{
this
[
i
]
=
source
[
i
];
}
function
getNodeLabels
(
elems
){
var
labelss
=
[]
for
(
var
i
in
elems
){
var
id
=
(
!
isUndef
(
elems
[
i
].
key
))?
elems
[
i
].
key
:
i
labelss
.
push
(
Nodes
[
id
].
label
)
}
return
labelss
}
function
getNodeIDs
(
elems
){
return
Object
.
keys
(
elems
)
}
function
getSelections
(){
params
=
[];
for
(
var
i
in
selections
){
...
...
@@ -287,44 +291,6 @@ function clustersBy(daclass) {
partialGraph
.
draw
();
}
function
hex2rga
(
sent_hex
)
{
result
=
[]
hex
=
(
sent_hex
.
charAt
(
0
)
===
"#"
?
sent_hex
.
substr
(
1
)
:
sent_hex
);
// check if 6 letters are provided
if
(
hex
.
length
===
6
)
{
result
=
calculateFull
(
hex
);
return
result
;
}
else
if
(
hex
.
length
===
3
)
{
result
=
calculatePartial
(
hex
);
return
result
;
}
}
function
calculateFull
(
hex
)
{
var
r
=
parseInt
(
hex
.
substring
(
0
,
2
),
16
);
var
g
=
parseInt
(
hex
.
substring
(
2
,
4
),
16
);
var
b
=
parseInt
(
hex
.
substring
(
4
,
6
),
16
);
return
[
r
,
g
,
b
];
}
// function for calculating 3 letters hex value
function
calculatePartial
(
hex
)
{
var
r
=
parseInt
(
hex
.
substring
(
0
,
1
)
+
hex
.
substring
(
0
,
1
),
16
);
var
g
=
parseInt
(
hex
.
substring
(
1
,
2
)
+
hex
.
substring
(
1
,
2
),
16
);
var
b
=
parseInt
(
hex
.
substring
(
2
,
3
)
+
hex
.
substring
(
2
,
3
),
16
);
return
[
r
,
g
,
b
];
}
function
componentToHex
(
c
)
{
var
hex
=
c
.
toString
(
16
);
return
hex
.
length
==
1
?
"0"
+
hex
:
hex
;
}
function
rgbToHex
(
r
,
g
,
b
)
{
return
"#"
+
componentToHex
(
r
)
+
componentToHex
(
g
)
+
componentToHex
(
b
);
}
//just for fun
function
makeEdgeWeightUndef
()
{
...
...
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