端到端功能 节点展开与闭合功能优化
This commit is contained in:
parent
0e50564887
commit
ac1abfc792
Binary file not shown.
@ -6,6 +6,7 @@ import com.actionsoft.apps.coe.method.process.subprocess.graph.component.Abstrac
|
|||||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.component.AbstractDefinitionHandle;
|
import com.actionsoft.apps.coe.method.process.subprocess.graph.component.AbstractDefinitionHandle;
|
||||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.DefinitionThreadUnSafe;
|
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.DefinitionThreadUnSafe;
|
||||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.SubProcessNodeDefineUtil;
|
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.SubProcessNodeDefineUtil;
|
||||||
|
import com.actionsoft.apps.coe.method.process.subprocess.mode.ScopeShapeMonitor;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||||
@ -34,6 +35,7 @@ public class GraphNodeCloseHandle {
|
|||||||
private JSONObject scopeLimitationShape; // 范围标注框
|
private JSONObject scopeLimitationShape; // 范围标注框
|
||||||
private AbstractDefinitionHandle definitionHandle; // 当前总图 define 处理器
|
private AbstractDefinitionHandle definitionHandle; // 当前总图 define 处理器
|
||||||
private AbstractDefinitionHandle subProcessNodeDefineHandle; // 子流程节点 define 处理器
|
private AbstractDefinitionHandle subProcessNodeDefineHandle; // 子流程节点 define 处理器
|
||||||
|
private ScopeShapeMonitor scopeShapeMonitor; // 范围选择框及其内部元素监视器
|
||||||
|
|
||||||
public GraphNodeCloseHandle(String repositoryId, String shapeId, String endToEndProcessDefineStr) throws AWSException{
|
public GraphNodeCloseHandle(String repositoryId, String shapeId, String endToEndProcessDefineStr) throws AWSException{
|
||||||
this.repositoryId = repositoryId;
|
this.repositoryId = repositoryId;
|
||||||
@ -51,6 +53,8 @@ public class GraphNodeCloseHandle {
|
|||||||
|
|
||||||
scopeLimitationShape = definitionHandle.getShapeByKey(shapeId);
|
scopeLimitationShape = definitionHandle.getShapeByKey(shapeId);
|
||||||
|
|
||||||
|
scopeShapeMonitor = new ScopeShapeMonitor(definitionHandle, subProcessNodeDefineHandle);
|
||||||
|
|
||||||
} catch (AWSException e) {
|
} catch (AWSException e) {
|
||||||
throw new AWSException(e);
|
throw new AWSException(e);
|
||||||
}
|
}
|
||||||
@ -67,6 +71,8 @@ public class GraphNodeCloseHandle {
|
|||||||
// 1、处理范围选择框及其内部节点
|
// 1、处理范围选择框及其内部节点
|
||||||
removeScopeShapeAndInRangeEle();
|
removeScopeShapeAndInRangeEle();
|
||||||
|
|
||||||
|
scopeShapeMonitor.buildScopeShapeMonitors();
|
||||||
|
|
||||||
// 2、处理总图中的节点与连线
|
// 2、处理总图中的节点与连线
|
||||||
handleEndToEndGraphNodeAndLinker();
|
handleEndToEndGraphNodeAndLinker();
|
||||||
|
|
||||||
@ -91,12 +97,14 @@ public class GraphNodeCloseHandle {
|
|||||||
removeEndToEndGraphOldLinker();
|
removeEndToEndGraphOldLinker();
|
||||||
// 5、构建新的连线
|
// 5、构建新的连线
|
||||||
NodeCloseLinkerRender linkerRender = new NodeCloseLinkerRender(vertexBounding, closeAdjMatrix);
|
NodeCloseLinkerRender linkerRender = new NodeCloseLinkerRender(vertexBounding, closeAdjMatrix);
|
||||||
JSONArray linkers = linkerRender.toAssembleLinker(direction, shapeId);
|
JSONArray linkers = linkerRender.toAssembleLinker(direction);
|
||||||
for (Object o : linkers) {
|
for (Object o : linkers) {
|
||||||
JSONObject linker = (JSONObject) o;
|
JSONObject linker = (JSONObject) o;
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scopeShapeMonitor.updateScopeShapeInnerEle();
|
||||||
|
|
||||||
// 6、更新画布的大小
|
// 6、更新画布的大小
|
||||||
// 确定画布的宽度与高度
|
// 确定画布的宽度与高度
|
||||||
double w = Arrays.stream(vertexBounding).mapToDouble(position -> position[0]).max().orElse(0.0);
|
double w = Arrays.stream(vertexBounding).mapToDouble(position -> position[0]).max().orElse(0.0);
|
||||||
@ -123,26 +131,51 @@ public class GraphNodeCloseHandle {
|
|||||||
JSONObject ele = elements.getJSONObject(key);
|
JSONObject ele = elements.getJSONObject(key);
|
||||||
if ("linker".equals(ele.getString("name"))) continue;
|
if ("linker".equals(ele.getString("name"))) continue;
|
||||||
if (ele.getString("id").equals(subProcessNode.getString("id"))) continue;
|
if (ele.getString("id").equals(subProcessNode.getString("id"))) continue;
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeInRange(key)) continue;
|
||||||
JSONObject eleProps = ele.getJSONObject("props");
|
JSONObject eleProps = ele.getJSONObject("props");
|
||||||
if ("vertically".equals(direction)){ // 垂直布局
|
if ("vertically".equals(direction)){ // 垂直布局
|
||||||
if (x + scope[2] < eleProps.getDoubleValue("x")) {
|
if (x + scope[2] < eleProps.getDoubleValue("x")) {
|
||||||
|
double xMoveDistance = -scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W;
|
||||||
eleProps.put("x", eleProps.getDoubleValue("x") - scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W);
|
eleProps.put("x", eleProps.getDoubleValue("x") - scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W);
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorXInfo(key, true, xMoveDistance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (y +scope[3] < eleProps.getDoubleValue("y")){
|
if (y +scope[3] < eleProps.getDoubleValue("y")){
|
||||||
|
double yMoveDistance = -scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H;
|
||||||
eleProps.put("y", eleProps.getDoubleValue("y") - scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H);
|
eleProps.put("y", eleProps.getDoubleValue("y") - scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H);
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorYInfo(key, true, yMoveDistance);
|
||||||
|
}
|
||||||
}else if (y < eleProps.getDoubleValue("y") && eleProps.getDoubleValue("y") < y + scope[3]){
|
}else if (y < eleProps.getDoubleValue("y") && eleProps.getDoubleValue("y") < y + scope[3]){
|
||||||
eleProps.put("y", y);
|
eleProps.put("y", y);
|
||||||
|
double yMoveDistance = y - eleProps.getDoubleValue("y");
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorYInfo(key, true, yMoveDistance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else { // 横向布局
|
}else { // 横向布局
|
||||||
if (x + scope[2] < eleProps.getDoubleValue("x")){ // 节点在范围框右侧的节点
|
if (x + scope[2] < eleProps.getDoubleValue("x")){ // 节点在范围框右侧的节点
|
||||||
|
double xMoveDistance = -scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W;
|
||||||
eleProps.put("x", eleProps.getDoubleValue("x") - scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W);
|
eleProps.put("x", eleProps.getDoubleValue("x") - scope[2] + SubProcessConst.SUB_PROCESS_SHAPE_W);
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorXInfo(key, true, xMoveDistance);
|
||||||
|
}
|
||||||
}else if (x < eleProps.getDoubleValue("x")
|
}else if (x < eleProps.getDoubleValue("x")
|
||||||
&& eleProps.getDoubleValue("x") < x + scope[2]
|
&& eleProps.getDoubleValue("x") < x + scope[2]
|
||||||
&& y + scope[3] < eleProps.getDoubleValue("y")){
|
&& y + scope[3] < eleProps.getDoubleValue("y")){
|
||||||
eleProps.put("x", x);
|
eleProps.put("x", x);
|
||||||
|
double xMoveDistance = x - eleProps.getDoubleValue("x");
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorXInfo(key, true, xMoveDistance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (y + scope[3] < eleProps.getDoubleValue("y")){ // 节点在范围框下方的节点
|
if (y + scope[3] < eleProps.getDoubleValue("y")){ // 节点在范围框下方的节点
|
||||||
|
double yMoveDistance = -scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H;
|
||||||
eleProps.put("y", eleProps.getDoubleValue("y") - scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H);
|
eleProps.put("y", eleProps.getDoubleValue("y") - scope[3] + SubProcessConst.SUB_PROCESS_SHAPE_H);
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
|
scopeShapeMonitor.updateMonitorYInfo(key, true, yMoveDistance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +190,7 @@ public class GraphNodeCloseHandle {
|
|||||||
Set<String> eleKeys = new HashSet<>();
|
Set<String> eleKeys = new HashSet<>();
|
||||||
for (String key : elements.keySet()) {
|
for (String key : elements.keySet()) {
|
||||||
JSONObject ele = elements.getJSONObject(key);
|
JSONObject ele = elements.getJSONObject(key);
|
||||||
if ("linker".equals(ele.getString("name"))){
|
if ("linker".equals(ele.getString("name")) && !scopeShapeMonitor.checkShapeIsScopeInRange(key)){
|
||||||
eleKeys.add(key);
|
eleKeys.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,6 +210,7 @@ public class GraphNodeCloseHandle {
|
|||||||
List<JSONObject> linkerList = new ArrayList<>();
|
List<JSONObject> linkerList = new ArrayList<>();
|
||||||
JSONObject endToEndProcessElements = definitionHandle.getElements();
|
JSONObject endToEndProcessElements = definitionHandle.getElements();
|
||||||
for (String key : endToEndProcessElements.keySet()) {
|
for (String key : endToEndProcessElements.keySet()) {
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeInRange(key)) continue;
|
||||||
JSONObject ele = endToEndProcessElements.getJSONObject(key);
|
JSONObject ele = endToEndProcessElements.getJSONObject(key);
|
||||||
if ("linker".equals(ele.getString("name"))) {
|
if ("linker".equals(ele.getString("name"))) {
|
||||||
linkerList.add(ele);
|
linkerList.add(ele);
|
||||||
@ -287,13 +321,11 @@ class NodeCloseLinkerRender{
|
|||||||
private List<String> nodeIds; // 图形节点ID集合
|
private List<String> nodeIds; // 图形节点ID集合
|
||||||
private double[][] vertexPosition; // 所有节点的坐标
|
private double[][] vertexPosition; // 所有节点的坐标
|
||||||
private NodeCloseAdjMatrix closeAdjMatrix; // 节点矩阵
|
private NodeCloseAdjMatrix closeAdjMatrix; // 节点矩阵
|
||||||
// private JSONObject scopeLimitationShape; // 范围标注框
|
|
||||||
|
|
||||||
public NodeCloseLinkerRender(double[][] vertexPosition, NodeCloseAdjMatrix closeAdjMatrix) {
|
public NodeCloseLinkerRender(double[][] vertexPosition, NodeCloseAdjMatrix closeAdjMatrix) {
|
||||||
this.nodeIds = closeAdjMatrix.getNodeIds();
|
this.nodeIds = closeAdjMatrix.getNodeIds();
|
||||||
this.vertexPosition = vertexPosition;
|
this.vertexPosition = vertexPosition;
|
||||||
this.closeAdjMatrix = closeAdjMatrix;
|
this.closeAdjMatrix = closeAdjMatrix;
|
||||||
// this.scopeLimitationShape = scopeLimitationShape;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,9 +334,8 @@ class NodeCloseLinkerRender{
|
|||||||
* @param shapeId 当前待展开节点ID
|
* @param shapeId 当前待展开节点ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONArray toAssembleLinker(String direction, String shapeId){
|
public JSONArray toAssembleLinker(String direction){
|
||||||
JSONArray linkers = new JSONArray();
|
JSONArray linkers = new JSONArray();
|
||||||
int index = nodeIds.indexOf(shapeId);
|
|
||||||
for (int i = 0; i < vertexPosition.length; i++) {
|
for (int i = 0; i < vertexPosition.length; i++) {
|
||||||
double[] fromBounding = vertexPosition[i];
|
double[] fromBounding = vertexPosition[i];
|
||||||
List<Integer> nextNodeIndex = closeAdjMatrix.getNeighbors(i);
|
List<Integer> nextNodeIndex = closeAdjMatrix.getNeighbors(i);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class GraphNodeExpandHandle {
|
|||||||
private JSONObject scopeLimitationShape; // 范围标注框
|
private JSONObject scopeLimitationShape; // 范围标注框
|
||||||
private AbstractDefinitionHandle definitionHandle; // 当前总图 define 处理器
|
private AbstractDefinitionHandle definitionHandle; // 当前总图 define 处理器
|
||||||
private AbstractDefinitionHandle subProcessNodeDefineHandle; // 子流程节点 define 处理器
|
private AbstractDefinitionHandle subProcessNodeDefineHandle; // 子流程节点 define 处理器
|
||||||
private ScopeShapeMonitor scopeShapeMonitor;
|
private ScopeShapeMonitor scopeShapeMonitor; // 范围选择框及其内部元素监视器
|
||||||
|
|
||||||
private double[] scopeLimitationShapeBeforePoi; // 范围选择框在子流程文件中的坐标
|
private double[] scopeLimitationShapeBeforePoi; // 范围选择框在子流程文件中的坐标
|
||||||
|
|
||||||
@ -229,40 +229,41 @@ public class GraphNodeExpandHandle {
|
|||||||
if ("linker".equals(ele.getString("name"))) continue; // 连线先不处理
|
if ("linker".equals(ele.getString("name"))) continue; // 连线先不处理
|
||||||
JSONObject props = ele.getJSONObject("props");
|
JSONObject props = ele.getJSONObject("props");
|
||||||
if (ele.getString("id").equals(scopeLimitationShape.getString("id"))) continue;
|
if (ele.getString("id").equals(scopeLimitationShape.getString("id"))) continue;
|
||||||
|
if (scopeShapeMonitor.checkShapeIsScopeInRange(key)) continue;
|
||||||
if ("vertically".equals(direction)){
|
if ("vertically".equals(direction)){
|
||||||
if (props.getDoubleValue("x") > scopeShapeX && !scopeShapeMonitor.checkShapeIsScopeInRange(key)) { // 当前元素在待展开节点的右侧
|
if (props.getDoubleValue("x") > scopeShapeX) { // 当前元素在待展开节点的右侧
|
||||||
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
||||||
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
||||||
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
scopeShapeMonitor.updateMonitorRightInfo(key, true, rightMoveDistance);
|
scopeShapeMonitor.updateMonitorXInfo(key, true, rightMoveDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.getDoubleValue("y") >= scopeShapeY && !scopeShapeMonitor.checkShapeIsScopeInRange(key)) { // 当前元素在待展开节点的下侧
|
if (props.getDoubleValue("y") >= scopeShapeY) { // 当前元素在待展开节点的下侧
|
||||||
double bottomMoveDistance = scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H;
|
double bottomMoveDistance = scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H;
|
||||||
props.put("y", props.getDoubleValue("y") + bottomMoveDistance);
|
props.put("y", props.getDoubleValue("y") + bottomMoveDistance);
|
||||||
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
scopeShapeMonitor.updateMonitorBottomInfo(key, true, bottomMoveDistance);
|
scopeShapeMonitor.updateMonitorYInfo(key, true, bottomMoveDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (props.getDoubleValue("x") > scopeShapeX && !scopeShapeMonitor.checkShapeIsScopeInRange(key)) { // 当前元素在待展开节点的右侧
|
if (props.getDoubleValue("x") > scopeShapeX) { // 当前元素在待展开节点的右侧
|
||||||
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
||||||
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
||||||
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
scopeShapeMonitor.updateMonitorRightInfo(key, true, rightMoveDistance);
|
scopeShapeMonitor.updateMonitorXInfo(key, true, rightMoveDistance);
|
||||||
}
|
}
|
||||||
}else if (props.getDoubleValue("x") == scopeShapeX && props.getDoubleValue("y") > scopeShapeY && !scopeShapeMonitor.checkShapeIsScopeInRange(key)) { // 当前元素与待展开节点在一列上 且在下侧
|
}else if (props.getDoubleValue("x") == scopeShapeX && props.getDoubleValue("y") > scopeShapeY) { // 当前元素与待展开节点在一列上 且在下侧
|
||||||
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
double rightMoveDistance = scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W;
|
||||||
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
||||||
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
scopeShapeMonitor.updateMonitorRightInfo(key, true, rightMoveDistance);
|
scopeShapeMonitor.updateMonitorXInfo(key, true, rightMoveDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.getDoubleValue("y") > scopeShapeY && !scopeShapeMonitor.checkShapeIsScopeInRange(key)) { // 当前元素在待展开节点的下侧
|
if (props.getDoubleValue("y") > scopeShapeY) { // 当前元素在待展开节点的下侧
|
||||||
double bottomMoveDistance = scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H;
|
double bottomMoveDistance = scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H;
|
||||||
props.put("y", props.getDoubleValue("y") + bottomMoveDistance);
|
props.put("y", props.getDoubleValue("y") + bottomMoveDistance);
|
||||||
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
if (scopeShapeMonitor.checkShapeIsScopeShape(key)){
|
||||||
scopeShapeMonitor.updateMonitorBottomInfo(key, true, bottomMoveDistance);
|
scopeShapeMonitor.updateMonitorYInfo(key, true, bottomMoveDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,13 +58,13 @@ public class ScopeShapeMonitor {
|
|||||||
* @param rightMoveDistance 右移动距离
|
* @param rightMoveDistance 右移动距离
|
||||||
* @throws AWSException
|
* @throws AWSException
|
||||||
*/
|
*/
|
||||||
public void updateMonitorRightInfo(String scopeShapeId, boolean isRightMove, double rightMoveDistance) throws AWSException{
|
public void updateMonitorXInfo(String scopeShapeId, boolean isXMove, double xMoveDistance) throws AWSException{
|
||||||
if (scopeShapeMonitorMap == null) return;
|
if (scopeShapeMonitorMap == null) return;
|
||||||
if (!scopeShapeMonitorMap.containsKey(scopeShapeId))
|
if (!scopeShapeMonitorMap.containsKey(scopeShapeId))
|
||||||
throw new AWSException("【参数异常】当前范围框监视器不包含图形ID【" + scopeShapeId + "】");
|
throw new AWSException("【参数异常】当前范围框监视器不包含图形ID【" + scopeShapeId + "】");
|
||||||
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeId);
|
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeId);
|
||||||
monitorInfo.setRightMove(isRightMove);
|
monitorInfo.setxMove(isXMove);
|
||||||
monitorInfo.setRightMoveDistance(rightMoveDistance);
|
monitorInfo.setxMoveDistance(xMoveDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,13 +74,13 @@ public class ScopeShapeMonitor {
|
|||||||
* @param bottomMoveDistance 下移距离
|
* @param bottomMoveDistance 下移距离
|
||||||
* @throws AWSException
|
* @throws AWSException
|
||||||
*/
|
*/
|
||||||
public void updateMonitorBottomInfo(String scopeShapeId, boolean isBottomMove, double bottomMoveDistance) throws AWSException{
|
public void updateMonitorYInfo(String scopeShapeId, boolean isYMove, double yMoveDistance) throws AWSException{
|
||||||
if (scopeShapeMonitorMap == null) return;
|
if (scopeShapeMonitorMap == null) return;
|
||||||
if (!scopeShapeMonitorMap.containsKey(scopeShapeId))
|
if (!scopeShapeMonitorMap.containsKey(scopeShapeId))
|
||||||
throw new AWSException("【参数异常】当前范围框监视器不包含图形ID【" + scopeShapeId + "】");
|
throw new AWSException("【参数异常】当前范围框监视器不包含图形ID【" + scopeShapeId + "】");
|
||||||
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeId);
|
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeId);
|
||||||
monitorInfo.setBottomMove(isBottomMove);
|
monitorInfo.setyMove(isYMove);
|
||||||
monitorInfo.setBottomMoveDistance(bottomMoveDistance);
|
monitorInfo.setyMoveDistance(yMoveDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,46 +124,43 @@ public class ScopeShapeMonitor {
|
|||||||
for (String scopeShapeKey : scopeShapeMonitorMap.keySet()) {
|
for (String scopeShapeKey : scopeShapeMonitorMap.keySet()) {
|
||||||
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeKey);
|
MonitorInfo monitorInfo = scopeShapeMonitorMap.get(scopeShapeKey);
|
||||||
Set<String> inRangeShapeIdSet = monitorInfo.getInRangeShapeIdSet();
|
Set<String> inRangeShapeIdSet = monitorInfo.getInRangeShapeIdSet();
|
||||||
if (monitorInfo.isRightMove()){
|
for (String key : inRangeShapeIdSet) {
|
||||||
double rightMoveDistance = monitorInfo.getRightMoveDistance();
|
JSONObject shape = definitionHandle.getShapeByKey(key);
|
||||||
for (String key : inRangeShapeIdSet) {
|
if (monitorInfo.isxMove()){ // x轴上发生移动
|
||||||
JSONObject shape = definitionHandle.getShapeByKey(key);
|
double xMoveDIstance = monitorInfo.getxMoveDistance();
|
||||||
if ("linker".equals(shape.getString("name"))){
|
if ("linker".equals(shape.getString("name"))){
|
||||||
JSONObject from = shape.getJSONObject("from");
|
JSONObject from = shape.getJSONObject("from");
|
||||||
from.put("x", from.getDoubleValue("x") + rightMoveDistance);
|
from.put("x", from.getDoubleValue("x") + xMoveDIstance);
|
||||||
JSONObject to = shape.getJSONObject("to");
|
JSONObject to = shape.getJSONObject("to");
|
||||||
to.put("x", to.getDoubleValue("x") + rightMoveDistance);
|
to.put("x", to.getDoubleValue("x") + xMoveDIstance);
|
||||||
|
|
||||||
JSONArray points = shape.getJSONArray("points");
|
JSONArray points = shape.getJSONArray("points");
|
||||||
for (Object o : points) {
|
for (Object o : points) {
|
||||||
JSONObject point = (JSONObject) o;
|
JSONObject point = (JSONObject) o;
|
||||||
point.put("x", point.getDoubleValue("x") + rightMoveDistance);
|
point.put("x", point.getDoubleValue("x") + xMoveDIstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
JSONObject props = definitionHandle.getShapeByProps(key);
|
JSONObject props = definitionHandle.getShapeByProps(key);
|
||||||
props.put("x", props.getDoubleValue("x") + rightMoveDistance);
|
props.put("x", props.getDoubleValue("x") + xMoveDIstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (monitorInfo.isyMove()){ // y轴上发生移动
|
||||||
if (monitorInfo.isBottomMove()){
|
double yMoveDistance = monitorInfo.getyMoveDistance();
|
||||||
double bottomMoveDistance = monitorInfo.getBottomMoveDistance();
|
|
||||||
for (String key : inRangeShapeIdSet) {
|
|
||||||
JSONObject shape = definitionHandle.getShapeByKey(key);
|
|
||||||
if ("linker".equals(shape.getString("name"))){
|
if ("linker".equals(shape.getString("name"))){
|
||||||
JSONObject from = shape.getJSONObject("from");
|
JSONObject from = shape.getJSONObject("from");
|
||||||
from.put("y", from.getDoubleValue("y") + bottomMoveDistance);
|
from.put("y", from.getDoubleValue("y") + yMoveDistance);
|
||||||
JSONObject to = shape.getJSONObject("to");
|
JSONObject to = shape.getJSONObject("to");
|
||||||
to.put("y", to.getDoubleValue("y") + bottomMoveDistance);
|
to.put("y", to.getDoubleValue("y") + yMoveDistance);
|
||||||
|
|
||||||
JSONArray points = shape.getJSONArray("points");
|
JSONArray points = shape.getJSONArray("points");
|
||||||
for (Object o : points) {
|
for (Object o : points) {
|
||||||
JSONObject point = (JSONObject) o;
|
JSONObject point = (JSONObject) o;
|
||||||
point.put("y", point.getDoubleValue("y") + bottomMoveDistance);
|
point.put("y", point.getDoubleValue("y") + yMoveDistance);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
JSONObject props = definitionHandle.getShapeByProps(key);
|
JSONObject props = definitionHandle.getShapeByProps(key);
|
||||||
props.put("y", props.getDoubleValue("y") + bottomMoveDistance);
|
props.put("y", props.getDoubleValue("y") + yMoveDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,52 +172,52 @@ public class ScopeShapeMonitor {
|
|||||||
class MonitorInfo {
|
class MonitorInfo {
|
||||||
|
|
||||||
private String scopeShapeId; // 当前虚线范围框的图形ID
|
private String scopeShapeId; // 当前虚线范围框的图形ID
|
||||||
private boolean isRightMove; // 范围框是否右移
|
private boolean xMove; // 范围框发生左移或者右移
|
||||||
private double rightMoveDistance; // 右移动距离
|
private double xMoveDistance; // 左移或者右移动距离
|
||||||
private boolean isBottomMove; // 范围框是否下移
|
private boolean yMove; // 范围框发生上移或者下移
|
||||||
private double bottomMoveDistance; // 下移距离
|
private double yMoveDistance; // 上移或者下移距离
|
||||||
|
|
||||||
private Set<String> inRangeShapeIdSet; // 范围内的图形与连线的ID集合
|
private Set<String> inRangeShapeIdSet; // 范围内的图形与连线的ID集合
|
||||||
|
|
||||||
public MonitorInfo(String scopeShapeId, boolean isRightMove, double rightMoveDistance, boolean isBottomMove, double bottomMoveDistance, Set<String> inRangeShapeIdSet) {
|
public MonitorInfo(String scopeShapeId, boolean xMove, double xMoveDistance, boolean yMove, double yMoveDistance, Set<String> inRangeShapeIdSet) {
|
||||||
this.scopeShapeId = scopeShapeId;
|
this.scopeShapeId = scopeShapeId;
|
||||||
this.isRightMove = isRightMove;
|
this.xMove = xMove;
|
||||||
this.rightMoveDistance = rightMoveDistance;
|
this.xMoveDistance = xMoveDistance;
|
||||||
this.isBottomMove = isBottomMove;
|
this.yMove = yMove;
|
||||||
this.bottomMoveDistance = bottomMoveDistance;
|
this.yMoveDistance = yMoveDistance;
|
||||||
this.inRangeShapeIdSet = inRangeShapeIdSet;
|
this.inRangeShapeIdSet = inRangeShapeIdSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRightMove() {
|
public boolean isxMove() {
|
||||||
return isRightMove;
|
return xMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getRightMoveDistance() {
|
public void setxMove(boolean xMove) {
|
||||||
return rightMoveDistance;
|
this.xMove = xMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBottomMove() {
|
public double getxMoveDistance() {
|
||||||
return isBottomMove;
|
return xMoveDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getBottomMoveDistance() {
|
public void setxMoveDistance(double xMoveDistance) {
|
||||||
return bottomMoveDistance;
|
this.xMoveDistance = xMoveDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightMove(boolean rightMove) {
|
public boolean isyMove() {
|
||||||
isRightMove = rightMove;
|
return yMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightMoveDistance(double rightMoveDistance) {
|
public void setyMove(boolean yMove) {
|
||||||
this.rightMoveDistance = rightMoveDistance;
|
this.yMove = yMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBottomMove(boolean bottomMove) {
|
public double getyMoveDistance() {
|
||||||
isBottomMove = bottomMove;
|
return yMoveDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBottomMoveDistance(double bottomMoveDistance) {
|
public void setyMoveDistance(double yMoveDistance) {
|
||||||
this.bottomMoveDistance = bottomMoveDistance;
|
this.yMoveDistance = yMoveDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getInRangeShapeIdSet() {
|
public Set<String> getInRangeShapeIdSet() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user