端到端功能 图生成前置处理 节点根据被指向的连线数量进行排序
This commit is contained in:
parent
a9ea67c8da
commit
1a0a4cd15f
Binary file not shown.
@ -225,7 +225,7 @@ public class GraphLayout {
|
||||
if (unIsPosition.size() == 1){
|
||||
position[rearNodeIndex][0] = position[nodeIndex][0]; // 当前节点的如果为第一个后置节点 则 坐标x的值一致
|
||||
}else {
|
||||
position[rearNodeIndex][0] = position[nodeIndex][0] + shapeW + (unIsPosition.size() - 1) * horizInterval; // 非第一个后置节点的坐标x = 上一个节点的坐标x + 图形宽度 + 第几个后置节点 * 横向间隔
|
||||
position[rearNodeIndex][0] = realTimeX + shapeW + (unIsPosition.size() - 1) * horizInterval; // 非第一个后置节点的坐标x = 上一个节点的坐标x + 图形宽度 + 第几个后置节点 * 横向间隔
|
||||
realTimeX = position[rearNodeIndex][0];
|
||||
}
|
||||
isPosition[rearNodeIndex] = true;
|
||||
|
||||
@ -113,6 +113,8 @@ public class VertexPreHandle {
|
||||
* 如果未在选择的范围内 则忽略
|
||||
*
|
||||
* 同时处理节点的前后置关系
|
||||
*
|
||||
* 同时根据当前节点被指向的线条数量排序 由低到高
|
||||
* @param processIdList
|
||||
* @param nodeIndexMap
|
||||
* @return 按照节点前置流程数量 从小到大排序
|
||||
@ -120,15 +122,23 @@ public class VertexPreHandle {
|
||||
*/
|
||||
public List<Node> excludeLearAndRearNode(List<String> processIdList, Map<String, Integer> nodeIndexMap) throws AWSException {
|
||||
List<Node> nodeList = new ArrayList<>();
|
||||
Map<String, Integer> pointsMap = new HashMap<>();
|
||||
for (int i = 0; i < processIdList.size(); i++) {
|
||||
Node node = new Node(processIdList.get(i));
|
||||
Node node = new Node(processIdList.get(i), PALRepositoryCache.getCache().get(processIdList.get(i)).getName());
|
||||
// 前置流程
|
||||
List<DesignerShapeRelationModel> leadProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.LEAD_PROCESS_ATTR_ID);
|
||||
List<Node> leadNodeList = new ArrayList<>();
|
||||
leadProcessList.stream().forEach(model -> {
|
||||
if (processIdList.contains(model.getRelationFileId())){
|
||||
Node leadNode = new Node(model.getRelationFileId());
|
||||
Node leadNode = new Node(model.getRelationFileId(), PALRepositoryCache.getCache().get(model.getRelationFileId()).getName());
|
||||
leadNodeList.add(leadNode);
|
||||
|
||||
// 当前节点被指向的线条数+1
|
||||
if (pointsMap.containsKey(node.getId())) {
|
||||
pointsMap.put(node.getId(), pointsMap.get(node.getId()).intValue() + 1);
|
||||
} else {
|
||||
pointsMap.put(node.getId(), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
node.setLeadNodeList(leadNodeList);
|
||||
@ -137,8 +147,14 @@ public class VertexPreHandle {
|
||||
List<Node> rearNodeList = new ArrayList<>();
|
||||
rearProcessList.stream().forEach(model -> {
|
||||
if (processIdList.contains(model.getRelationFileId())){
|
||||
Node rearNode = new Node(model.getRelationFileId());
|
||||
Node rearNode = new Node(model.getRelationFileId(), PALRepositoryCache.getCache().get(model.getRelationFileId()).getName());
|
||||
rearNodeList.add(rearNode);
|
||||
|
||||
if (pointsMap.containsKey(model.getRelationFileId())) {
|
||||
pointsMap.put(model.getRelationFileId(), pointsMap.get(model.getRelationFileId()).intValue() + 1);
|
||||
} else {
|
||||
pointsMap.put(model.getRelationFileId(), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
node.setRearNodeList(rearNodeList);
|
||||
@ -147,6 +163,12 @@ public class VertexPreHandle {
|
||||
nodeIndexMap.put(node.getId(), nodeList.size() - 1);
|
||||
}
|
||||
|
||||
for (Node node : nodeList) {
|
||||
if (pointsMap.containsKey(node.getId())){
|
||||
node.setPoints(pointsMap.get(node.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(nodeList);
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
@ -10,14 +10,20 @@ import java.util.Objects;
|
||||
public class Node implements Comparable<Node> {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private List<Node> leadNodeList;
|
||||
private List<Node> rearNodeList;
|
||||
|
||||
private int points; // 被指向的线条数
|
||||
|
||||
public Node(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Node(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@ -26,6 +32,14 @@ public class Node implements Comparable<Node> {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<Node> getLeadNodeList() {
|
||||
return leadNodeList;
|
||||
}
|
||||
@ -42,6 +56,14 @@ public class Node implements Comparable<Node> {
|
||||
this.rearNodeList = rearNodeList;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(int points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@ -57,6 +79,6 @@ public class Node implements Comparable<Node> {
|
||||
|
||||
@Override
|
||||
public int compareTo(Node node) {
|
||||
return Integer.compare(this.leadNodeList.size(), node.getLeadNodeList().size());
|
||||
return Integer.compare(this.points, node.points);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user