流程图创建图片时箭头异常问题处理
This commit is contained in:
parent
b5372b1120
commit
02e87d2141
Binary file not shown.
@ -1182,4 +1182,45 @@ public class CoeDesignerShapeAPIManager {
|
|||||||
return definition.toString();
|
return definition.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理连线箭头问题
|
||||||
|
* @param define
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String updateLinkArrow(String define) {
|
||||||
|
JSONObject definition = JSONObject.parseObject(define);
|
||||||
|
JSONObject elements = definition.getJSONObject("elements");
|
||||||
|
Map<String, Map<String, PALMethodAttributeModel>> shapeAttrMap = new HashMap<>();
|
||||||
|
Iterator<String> it = elements.keySet().iterator();
|
||||||
|
|
||||||
|
while (it.hasNext()) {
|
||||||
|
String shapeId = it.next();
|
||||||
|
JSONObject shape = elements.getJSONObject(shapeId);
|
||||||
|
String shapeName = shape.getString("name");
|
||||||
|
if ("linker".equals(shapeName)) {
|
||||||
|
JSONArray points = shape.getJSONArray("points");
|
||||||
|
if (points == null) {
|
||||||
|
points = new JSONArray();
|
||||||
|
}
|
||||||
|
if (points.isEmpty()) {
|
||||||
|
JSONObject from = shape.getJSONObject("from");
|
||||||
|
JSONObject to = shape.getJSONObject("to");
|
||||||
|
if (from != null && to != null) {
|
||||||
|
int fromX = from.getInteger("x");
|
||||||
|
int fromY = from.getInteger("y");
|
||||||
|
int toX = to.getInteger("x");
|
||||||
|
int toY = to.getInteger("y");
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("x", ((double) (fromX + toX)) /2);
|
||||||
|
obj.put("y", ((double) (fromY + toY)) /2);
|
||||||
|
points.add(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shape.put("points", points);
|
||||||
|
elements.put(shapeId, shape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return definition.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.actionsoft.apps.coe.pal.pal.repository.designer.io.image;
|
package com.actionsoft.apps.coe.pal.pal.repository.designer.io.image;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||||
import com.actionsoft.bpms.bpmn.modeler.util.draw.ChartGraphics;
|
import com.actionsoft.bpms.bpmn.modeler.util.draw.ChartGraphics;
|
||||||
import com.actionsoft.bpms.util.UtilFile;
|
import com.actionsoft.bpms.util.UtilFile;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||||
@ -33,10 +35,12 @@ public class CoeDesignerImage {
|
|||||||
//保存图片
|
//保存图片
|
||||||
ChartGraphics brush = new ChartGraphics();
|
ChartGraphics brush = new ChartGraphics();
|
||||||
if (bigImage) {
|
if (bigImage) {
|
||||||
|
// 处理连线箭头问题
|
||||||
|
String define = CoeDesignerShapeAPIManager.getInstance().updateLinkArrow(model.getDefinition());
|
||||||
String pathname =model.getPath()+model.getUUID()+".png";
|
String pathname =model.getPath()+model.getUUID()+".png";
|
||||||
byte[] desginerImg = null;
|
byte[] desginerImg = null;
|
||||||
try {
|
try {
|
||||||
desginerImg = brush.draw(model.getDefinition(), null, null); // 获得原图
|
desginerImg = brush.draw(define, null, null); // 获得原图
|
||||||
create(pathname, desginerImg);
|
create(pathname, desginerImg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user