pal删除重复类
This commit is contained in:
parent
73d7cd0b23
commit
960b0976ad
Binary file not shown.
@ -1,50 +0,0 @@
|
||||
package com.actionsoft.apps.coe.pal.pal.repository.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class DiagramUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 设置画布大小
|
||||
* @param elements
|
||||
*/
|
||||
public static void setDiagramHeightWidth(JSONObject definition, JSONObject elements) {
|
||||
// 获取最大宽高,给100长度富余
|
||||
JSONObject maxHW = getMaxPositionXY(elements);
|
||||
int maxX = maxHW.getInteger("maxX") + 150;
|
||||
int maxH = maxHW.getInteger("maxY") + 150;
|
||||
JSONObject page = definition.getJSONObject("page");
|
||||
int pageW = page.getInteger("width");
|
||||
int pageH = page.getInteger("height");
|
||||
page.put("width", pageW > maxX ? pageW : maxX);
|
||||
page.put("height", pageH > maxH ? pageH : maxH);
|
||||
definition.put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JSONObject getMaxPositionXY(JSONObject elements) {
|
||||
int maxX = -99999;
|
||||
int maxY = -99999;
|
||||
Iterator<String> it = elements.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
JSONObject shape = elements.getJSONObject(key);
|
||||
String shapeName = shape.getString("name");
|
||||
if(!"linker".equals(shapeName)) {
|
||||
JSONObject props = shape.getJSONObject("props");
|
||||
int x = props.getInteger("x");
|
||||
int y = props.getInteger("y");
|
||||
maxX = maxX < x ? x : maxX;
|
||||
maxY = maxY < y ? y : maxY;
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("maxX", maxX);
|
||||
result.put("maxY", maxY);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user