Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Christnowx
Gephi
提交
751e3a7b
G
Gephi
项目概览
Christnowx
/
Gephi
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gephi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
751e3a7b
编写于
11月 26, 2015
作者:
E
Eduardo Ramos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Datalab: fix when merging nodes
上级
942885d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
12 deletion
+24
-12
modules/DataLaboratoryAPI/src/main/java/org/gephi/datalab/impl/GraphElementsControllerImpl.java
...a/org/gephi/datalab/impl/GraphElementsControllerImpl.java
+24
-12
未找到文件。
modules/DataLaboratoryAPI/src/main/java/org/gephi/datalab/impl/GraphElementsControllerImpl.java
浏览文件 @
751e3a7b
...
...
@@ -206,9 +206,9 @@ public class GraphElementsControllerImpl implements GraphElementsController {
if
(
selectedNode
==
null
)
{
selectedNode
=
nodes
[
0
];
//Use first node as selected node if null
}
//Create empty new node:
Node
newNode
=
createNode
(
""
);
Node
newNode
=
createNode
(
""
,
null
,
graph
);
//Set properties (position, size and color) using the selected node properties:
newNode
.
setX
(
selectedNode
.
x
());
...
...
@@ -221,7 +221,7 @@ public class GraphElementsControllerImpl implements GraphElementsController {
newNode
.
setG
(
selectedNode
.
g
());
newNode
.
setB
(
selectedNode
.
b
());
newNode
.
setAlpha
(
selectedNode
.
alpha
());
//Merge attributes:
AttributeColumnsController
ac
=
Lookup
.
getDefault
().
lookup
(
AttributeColumnsController
.
class
);
ac
.
mergeRowsValues
(
columns
,
mergeStrategies
,
nodes
,
selectedNode
,
newNode
);
...
...
@@ -233,19 +233,29 @@ public class GraphElementsControllerImpl implements GraphElementsController {
Edge
newEdge
;
for
(
Node
node
:
nodes
)
{
for
(
Edge
edge
:
getNodeEdges
(
node
))
{
Node
newEdgeSource
;
Node
newEdgeTarget
;
if
(
edge
.
getSource
()
==
node
)
{
newEdgeSource
=
newNode
;
if
(
nodesSet
.
contains
(
edge
.
getTarget
()))
{
newEdge
=
createEdge
(
newNode
,
newNode
,
edge
.
isDirected
())
;
//Self loop because of edge between merged nodes
newEdge
Target
=
newNode
;
//Self loop because of edge between merged nodes
}
else
{
newEdge
=
createEdge
(
newNode
,
edge
.
getTarget
(),
edge
.
isDirected
()
);
newEdge
Target
=
edge
.
getTarget
(
);
}
}
else
{
newEdgeTarget
=
newNode
;
if
(
nodesSet
.
contains
(
edge
.
getSource
()))
{
newEdge
=
createEdge
(
newNode
,
newNode
,
edge
.
isDirected
())
;
//Self loop because of edge between merged nodes
newEdge
Source
=
newNode
;
//Self loop because of edge between merged nodes
}
else
{
newEdge
=
createEdge
(
edge
.
getSource
(),
newNode
,
edge
.
isDirected
()
);
newEdge
Source
=
edge
.
getSource
(
);
}
}
if
(
graph
.
getEdge
(
newEdgeSource
,
newEdgeTarget
)
!=
null
)
{
//This edge already exists
continue
;
}
newEdge
=
createEdge
(
newEdgeSource
,
newEdgeTarget
,
edge
.
isDirected
(),
graph
);
if
(
newEdge
!=
null
)
{
//Edge may not be created if repeated
//Copy edge attributes:
...
...
@@ -356,14 +366,16 @@ public class GraphElementsControllerImpl implements GraphElementsController {
}
private
Node
buildNode
(
Graph
graph
,
String
label
)
{
Node
newNode
=
graph
.
getModel
().
factory
().
newNode
();
newNode
.
setSize
(
DEFAULT_NODE_SIZE
);
newNode
.
setLabel
(
label
);
return
newNode
;
return
buildNode
(
graph
,
label
,
null
);
}
private
Node
buildNode
(
Graph
graph
,
String
label
,
String
id
)
{
Node
newNode
=
graph
.
getModel
().
factory
().
newNode
(
id
);
Node
newNode
;
if
(
id
!=
null
)
{
newNode
=
graph
.
getModel
().
factory
().
newNode
(
id
);
}
else
{
newNode
=
graph
.
getModel
().
factory
().
newNode
();
}
newNode
.
setSize
(
DEFAULT_NODE_SIZE
);
newNode
.
setLabel
(
label
);
return
newNode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录