端到端功能 节点展开 阶段性代码提交
This commit is contained in:
parent
c2a4fed841
commit
89e1b82652
Binary file not shown.
@ -130,9 +130,9 @@ public class SubProcessController {
|
||||
}
|
||||
|
||||
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.shape_expand")
|
||||
public String shapeExpand(UserContext uc, String repositoryId, String shapeId, String direction){
|
||||
public String shapeExpand(UserContext uc, String repositoryId, String shapeId){
|
||||
SubProcessWeb processWeb = new SubProcessWeb(uc);
|
||||
return processWeb.shapeNodeExpand(repositoryId, shapeId, direction);
|
||||
return processWeb.shapeNodeExpand(repositoryId, shapeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public class GraphNodeExpandHandle {
|
||||
* @throws Exception
|
||||
* @return 节点展开后的模型存储信息
|
||||
*/
|
||||
public String handleNodeExpand(String direction) throws Exception{
|
||||
public String handleNodeExpand() throws Exception{
|
||||
|
||||
// Thread t1 = new Thread(() -> {
|
||||
// // 1、总图节点以及连线处理
|
||||
@ -164,7 +164,7 @@ public class GraphNodeExpandHandle {
|
||||
// t2.join();
|
||||
|
||||
// 1、总图节点以及连线处理
|
||||
handleEndToEndGraphNodeAndLinker(direction);
|
||||
handleEndToEndGraphNodeAndLinker();
|
||||
|
||||
// 2、子流程节点内部元素处理
|
||||
handleRelationModelNodePosition();
|
||||
@ -187,7 +187,7 @@ public class GraphNodeExpandHandle {
|
||||
* 6、删除旧有连线关系
|
||||
* 7、构建新的连线关系
|
||||
*/
|
||||
private void handleEndToEndGraphNodeAndLinker(String direction){
|
||||
private void handleEndToEndGraphNodeAndLinker(){
|
||||
// 1、删除当前要展开的节点
|
||||
removeEndToEndGraphElements(shapeId);
|
||||
|
||||
@ -200,18 +200,30 @@ public class GraphNodeExpandHandle {
|
||||
// 4、构建邻接矩阵
|
||||
NodeExpandAdjMatrix expandAdjMatrix = buildEndToEndGraphAdjMatrix();
|
||||
expandAdjMatrix.buildAdjMatrix();
|
||||
// expandAdjMatrix.printAdjMatrix();
|
||||
// 5、删除节点展开前的连线
|
||||
removeEndToEndGraphOldLinker();
|
||||
// 6、获取所有节点坐标
|
||||
JSONObject elements = endToEndProcessDefine.getJSONObject("elements");
|
||||
double[][] vertexPosition = expandAdjMatrix.getVertexPosition(elements);
|
||||
// 7、构建新的连线
|
||||
JSONObject processProperties = endToEndProcessDefine.getJSONObject("processProperties");
|
||||
String direction = processProperties.getString("direction");
|
||||
NodeExpandLinkerRender linkerRender = new NodeExpandLinkerRender(vertexPosition, expandAdjMatrix, scopeLimitationShape);
|
||||
JSONArray linkers = linkerRender.toAssembleLinker(direction, shapeId);
|
||||
for (Object o : linkers) {
|
||||
JSONObject linker = (JSONObject) o;
|
||||
addEndToEndGraphElements(linker);
|
||||
}
|
||||
|
||||
// 8、更新画布的大小
|
||||
// 确定画布的宽度与高度
|
||||
double w = Arrays.stream(vertexPosition).mapToDouble(position -> position[0]).max().orElse(0.0);
|
||||
double h = Arrays.stream(vertexPosition).mapToDouble(position -> position[1]).max().orElse(0.0);
|
||||
|
||||
JSONObject page = endToEndProcessDefine.getJSONObject("page");
|
||||
page.put("width", w + 300);
|
||||
page.put("height", h + 300);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,7 +556,7 @@ class NodeExpandLinkerRender{
|
||||
|
||||
private double[][] calculationLinkerPointInVertLayOut(double[] fromPoi, double[] toPoi, boolean currentExpandNodeIsStart, boolean currentExpandNodeIsEnd) {
|
||||
double fromX = fromPoi[0],fromY = fromPoi[1],toX = toPoi[0],toY = toPoi[1];
|
||||
double scopeShapeW = scopeLimitationShape.getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getDoubleValue("h");
|
||||
double scopeShapeW = scopeLimitationShape.getJSONObject("props").getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getJSONObject("props").getDoubleValue("h");
|
||||
if (fromY == toY){ // 水平 分析可知 水平方向上不会出现 从左到右直连的情况 只有 右边节点右侧锚点出 向上走 左折 连到左侧节点上方锚点
|
||||
double[] startPoi = new double[]{fromX + (currentExpandNodeIsStart ? scopeShapeW : SubProcessConst.SUB_PROCESS_SHAPE_W), fromY + (currentExpandNodeIsStart ? scopeShapeH : SubProcessConst.SUB_PROCESS_SHAPE_H) / 2};
|
||||
double[] turnPoi1 = new double[]{fromX + (currentExpandNodeIsStart ? scopeShapeW : SubProcessConst.SUB_PROCESS_SHAPE_W) + SubProcessConst.SHAPE_HORIZ_INTERVAL / 2, fromY + (currentExpandNodeIsStart ? scopeShapeH : SubProcessConst.SUB_PROCESS_SHAPE_H) / 2};
|
||||
@ -612,7 +624,7 @@ class NodeExpandLinkerRender{
|
||||
|
||||
private double[][] calculationLinkerPointInHorizLayOut(double[] fromPoi, double[] toPoi, boolean currentExpandNodeIsStart, boolean currentExpandNodeIsEnd) {
|
||||
double fromX = fromPoi[0],fromY = fromPoi[1],toX = toPoi[0],toY = toPoi[1];
|
||||
double scopeShapeW = scopeLimitationShape.getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getDoubleValue("h");
|
||||
double scopeShapeW = scopeLimitationShape.getJSONObject("props").getDoubleValue("w"), scopeShapeH = scopeLimitationShape.getJSONObject("props").getDoubleValue("h");
|
||||
if (fromY == toY) { // 水平 方向上 存在从左向右直连的情况 但不存在从右向左直连的情况 水平方向上 从左向右 应是 右出 向上 左折 向下
|
||||
return fromX < toX
|
||||
? new double[][]
|
||||
|
||||
@ -150,4 +150,15 @@ public class GraphRender {
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(this.baseModel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局方向添加到流程属性中
|
||||
* 方便后续节点展开时用到
|
||||
* @param direction
|
||||
*/
|
||||
public void addDirectionToProcessProperties(String direction){
|
||||
JSONObject defineJsonObj = JSONObject.parseObject(this.baseModel.getDefinition());
|
||||
JSONObject processProperties = defineJsonObj.getJSONObject("processProperties");
|
||||
processProperties.put("direction", direction);
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,10 +309,10 @@ public class SubProcessWeb extends ActionWeb {
|
||||
* @param shapeId 待展开的子流程节点ID
|
||||
* @param direction 布局方向
|
||||
*/
|
||||
public String shapeNodeExpand(String repositoryId, String shapeId, String direction){
|
||||
public String shapeNodeExpand(String repositoryId, String shapeId){
|
||||
try {
|
||||
GraphNodeExpandHandle nodeExpandHandle = new GraphNodeExpandHandle(repositoryId, shapeId);
|
||||
String define = nodeExpandHandle.handleNodeExpand(direction);
|
||||
String define = nodeExpandHandle.handleNodeExpand();
|
||||
ResponseObject ro = ResponseObject.newOkResponse("展开成功");
|
||||
ro.setData(define);
|
||||
return ro.toString();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user