Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
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
Grégoire Locqueville
purescript-gargantext
Commits
b2295d5d
Commit
b2295d5d
authored
Nov 08, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] ccircle renderer for circles with contour
parent
78868657
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
2 deletions
+88
-2
Layout.purs
src/Gargantext/Components/GraphExplorer/Layout.purs
+2
-1
Sigma.js
src/Gargantext/Hooks/Sigmax/Sigma.js
+10
-1
sigmajs-circle-with-contour.js
src/external-deps/sigmajs-circle-with-contour.js
+76
-0
No files found.
src/Gargantext/Components/GraphExplorer/Layout.purs
View file @
b2295d5d
...
@@ -343,7 +343,8 @@ modeGraphType Types.Authors = "square"
...
@@ -343,7 +343,8 @@ modeGraphType Types.Authors = "square"
modeGraphType Types.Institutes = "equilateral"
modeGraphType Types.Institutes = "equilateral"
modeGraphType Types.Sources = "star"
modeGraphType Types.Sources = "star"
--modeGraphType Types.Terms = "def"
--modeGraphType Types.Terms = "def"
modeGraphType Types.Terms = "circle"
--modeGraphType Types.Terms = "circle"
modeGraphType Types.Terms = "ccircle"
--------------------------------------------------------------
--------------------------------------------------------------
...
...
src/Gargantext/Hooks/Sigmax/Sigma.js
View file @
b2295d5d
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
Graph
from
'graphology'
;
import
Graph
from
'graphology'
;
import
Sigma
from
'sigma'
;
import
Sigma
from
'sigma'
;
import
{
takeScreenshot
}
from
'../../src/external-deps/sigmajs-screenshot.js'
;
import
{
takeScreenshot
}
from
'../../src/external-deps/sigmajs-screenshot.js'
;
import
CircleNodeProgram
from
'sigma/rendering/webgl/programs/node.fast'
;
import
ContourCircleNodeProgram
from
'../../src/external-deps/sigmajs-circle-with-contour.js'
;
let
sigma
=
Sigma
.
Sigma
;
let
sigma
=
Sigma
.
Sigma
;
console
.
log
(
'imported sigma'
,
Sigma
);
console
.
log
(
'imported sigma'
,
Sigma
);
...
@@ -164,7 +166,14 @@ let sigmaMouseSelector = function(sigma, options) {
...
@@ -164,7 +166,14 @@ let sigmaMouseSelector = function(sigma, options) {
function
_sigma
(
left
,
right
,
el
,
opts
)
{
function
_sigma
(
left
,
right
,
el
,
opts
)
{
try
{
try
{
let
graph
=
new
Graph
();
let
graph
=
new
Graph
();
let
s
=
new
sigma
(
graph
,
el
,
opts
.
settigns
);
const
settings
=
{
nodeProgramClasses
:
{
circle
:
CircleNodeProgram
.
default
,
// TODO why default? It seems that import should be fixed
ccircle
:
ContourCircleNodeProgram
},
...
opts
.
settings
};
let
s
=
new
sigma
(
graph
,
el
,
settings
);
console
.
log
(
'[_sigma] initializing sigma with el'
,
el
,
'opts'
,
opts
.
settings
,
'sigma'
,
s
);
console
.
log
(
'[_sigma] initializing sigma with el'
,
el
,
'opts'
,
opts
.
settings
,
'sigma'
,
s
);
console
.
log
(
'[_sigma] labelRenderedSizeThreshold'
,
opts
.
settings
.
labelRenderedSizeThreshold
);
console
.
log
(
'[_sigma] labelRenderedSizeThreshold'
,
opts
.
settings
.
labelRenderedSizeThreshold
);
sigmaMouseSelector
(
s
);
sigmaMouseSelector
(
s
);
...
...
src/external-deps/sigmajs-circle-with-contour.js
0 → 100644
View file @
b2295d5d
// Based on sigma.js/src/rendering/webgl/programs/node.fast.ts
import
{
NodeDisplayData
}
from
"sigma/types"
;
import
{
floatColor
}
from
"sigma/utils"
;
import
vertexShaderSource
from
"sigma/rendering/webgl/shaders/node.fast.vert.glsl"
;
import
fragmentShaderSource
from
"sigma/rendering/webgl/shaders/node.fast.frag.glsl"
;
import
{
AbstractNodeProgram
}
from
"sigma/rendering/webgl/programs/common/node"
;
import
{
RenderParams
}
from
"sigma/rendering/webgl/programs/common/program"
;
import
CircleNodeProgram
from
'sigma/rendering/webgl/programs/node.fast'
;
const
POINTS
=
2
;
const
ATTRIBUTES
=
4
;
/*
export default class NodeContourFastProgram extends AbstractNodeProgram {
//constructor(gl : WebGLRenderingContext) {
constructor(gl) {
super(gl, vertexShaderSource, fragmentShaderSource, POINTS, ATTRIBUTES);
this.bind();
}
*/
export
default
class
NodeContourFastProgram
extends
CircleNodeProgram
{
//process(data: NodeDisplayData, hidden: boolean, offset: number): void {
process
(
data
,
hidden
,
offset
)
{
const
array
=
this
.
array
;
let
i
=
offset
*
POINTS
*
ATTRIBUTES
;
if
(
hidden
)
{
// contour
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
// circle
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
array
[
i
++
]
=
0
;
return
;
}
const
color
=
floatColor
(
data
.
color
);
const
black
=
floatColor
(
'black'
);
// contour
array
[
i
++
]
=
data
.
x
;
array
[
i
++
]
=
data
.
y
;
array
[
i
++
]
=
data
.
size
+
1
;
array
[
i
++
]
=
black
;
// circle
array
[
i
++
]
=
data
.
x
;
array
[
i
++
]
=
data
.
y
;
array
[
i
++
]
=
data
.
size
;
array
[
i
]
=
color
;
}
//render(params: RenderParams): void {
render
(
params
)
{
if
(
this
.
hasNothingToRender
())
return
;
const
gl
=
this
.
gl
;
const
program
=
this
.
program
;
gl
.
useProgram
(
program
);
gl
.
uniform1f
(
this
.
ratioLocation
,
1
/
Math
.
sqrt
(
params
.
ratio
));
gl
.
uniform1f
(
this
.
scaleLocation
,
params
.
scalingRatio
);
gl
.
uniformMatrix3fv
(
this
.
matrixLocation
,
false
,
params
.
matrix
);
gl
.
drawArrays
(
gl
.
POINTS
,
0
,
this
.
array
.
length
/
ATTRIBUTES
);
}
}
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