Commit 1a5aab1a authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-graph-explorer-node-slider' of...

Merge branch 'dev-graph-explorer-node-slider' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents d59e6118 6984c0c5
...@@ -367,49 +367,50 @@ transformGraph controls graph = SigmaxT.Graph {nodes: newNodes, edges: newEdges} ...@@ -367,49 +367,50 @@ transformGraph controls graph = SigmaxT.Graph {nodes: newNodes, edges: newEdges}
$ SigmaxT.neighbouringEdges graph (fst controls.selectedNodeIds) $ SigmaxT.neighbouringEdges graph (fst controls.selectedNodeIds)
hasSelection = not $ Set.isEmpty (fst controls.selectedNodeIds) hasSelection = not $ Set.isEmpty (fst controls.selectedNodeIds)
--newNodes = Seq.map (nodeSizeFilter <<< nodeMarked) nodes newEdges' = Seq.filter edgeFilter $ Seq.map (
--newEdges = Seq.map (edgeConfluenceFilter <<< edgeWeightFilter <<< edgeShowFilter <<< edgeMarked) edges edgeHideWeight <<< edgeHideConfluence <<< edgeShowFilter <<< edgeMarked
newEdges' = Seq.filter edgeFilter $ Seq.map (edgeShowFilter <<< edgeMarked) edges ) edges
newNodes = Seq.filter nodeFilter $ Seq.map (nodeMarked) nodes newNodes = Seq.filter nodeFilter $ Seq.map (nodeMarked <<< nodeHideSize) nodes
newEdges = Seq.filter (edgeInGraph $ Set.fromFoldable $ Seq.map _.id newNodes) newEdges' newEdges = Seq.filter (edgeInGraph $ Set.fromFoldable $ Seq.map _.id newNodes) newEdges'
edgeFilter e = edgeConfluenceFilter e && edgeFilter e = true
edgeWeightFilter e nodeFilter n = nodeRemovedFilter n
--edgeShowFilter e
nodeFilter n = nodeSizeFilter n && nodeSizeFilter :: Record SigmaxT.Node -> Boolean
nodeRemovedFilter n
--nodeSizeFilter node@{ size } =
-- if Range.within (fst controls.nodeSize) size then
-- node
-- else
-- node { hidden = true }
nodeSizeFilter node@{ size } = Range.within (fst controls.nodeSize) size nodeSizeFilter node@{ size } = Range.within (fst controls.nodeSize) size
nodeRemovedFilter node@{ id } = not $ Set.member id $ fst controls.removedNodeIds nodeRemovedFilter node@{ id } = not $ Set.member id $ fst controls.removedNodeIds
--edgeConfluenceFilter edge@{ confluence } = edgeConfluenceFilter :: Record SigmaxT.Edge -> Boolean
-- if Range.within (fst controls.edgeConfluence) confluence then
-- edge
-- else
-- edge { hidden = true }
edgeConfluenceFilter edge@{ confluence } = Range.within (fst controls.edgeConfluence) confluence edgeConfluenceFilter edge@{ confluence } = Range.within (fst controls.edgeConfluence) confluence
edgeWeightFilter :: Record SigmaxT.Edge -> Boolean
edgeWeightFilter edge@{ weightIdx } = Range.within (fst controls.edgeWeight) $ toNumber weightIdx
edgeHideConfluence :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideConfluence edge@{ confluence } =
if Range.within (fst controls.edgeConfluence) confluence then
edge
else
edge { hidden = true }
edgeHideWeight :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeHideWeight edge@{ weightIdx } =
if Range.within (fst controls.edgeWeight) $ toNumber weightIdx then
edge
else
edge { hidden = true }
edgeShowFilter :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeShowFilter edge = edgeShowFilter edge =
if (SigmaxT.edgeStateHidden $ fst controls.showEdges) then if (SigmaxT.edgeStateHidden $ fst controls.showEdges) then
edge { hidden = true } edge { hidden = true }
else else
edge edge
--edgeWeightFilter edge@{ weight } =
-- if Range.within (fst controls.edgeWeight) weight then
-- edge
-- else
-- edge { hidden = true }
edgeWeightFilter :: Record SigmaxT.Edge -> Boolean
edgeWeightFilter edge@{ weightIdx } = Range.within (fst controls.edgeWeight) $ toNumber weightIdx
edgeInGraph :: SigmaxT.NodeIds -> Record SigmaxT.Edge -> Boolean edgeInGraph :: SigmaxT.NodeIds -> Record SigmaxT.Edge -> Boolean
edgeInGraph nodeIds e = (Set.member e.source nodeIds) && (Set.member e.target nodeIds) edgeInGraph nodeIds e = (Set.member e.source nodeIds) && (Set.member e.target nodeIds)
edgeMarked :: Record SigmaxT.Edge -> Record SigmaxT.Edge
edgeMarked edge@{ id, sourceNode } = do edgeMarked edge@{ id, sourceNode } = do
let isSelected = Set.member id selectedEdgeIds let isSelected = Set.member id selectedEdgeIds
case Tuple hasSelection isSelected of case Tuple hasSelection isSelected of
...@@ -417,8 +418,17 @@ transformGraph controls graph = SigmaxT.Graph {nodes: newNodes, edges: newEdges} ...@@ -417,8 +418,17 @@ transformGraph controls graph = SigmaxT.Graph {nodes: newNodes, edges: newEdges}
Tuple true true -> edge { color = sourceNode.color } Tuple true true -> edge { color = sourceNode.color }
Tuple true false -> edge { color = "rgba(221, 221, 221, 0.5)" } Tuple true false -> edge { color = "rgba(221, 221, 221, 0.5)" }
_ -> edge _ -> edge
nodeMarked :: Record SigmaxT.Node -> Record SigmaxT.Node
nodeMarked node@{ id } = nodeMarked node@{ id } =
if Set.member id (fst controls.selectedNodeIds) then if Set.member id (fst controls.selectedNodeIds) then
node { borderColor = "#000", type = "selected" } node { borderColor = "#000", type = "selected" }
else else
node node
nodeHideSize :: Record SigmaxT.Node -> Record SigmaxT.Node
nodeHideSize node@{ size } =
if Range.within (fst controls.nodeSize) size then
node
else
node { hidden = true }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment