package com.kalvin.kvf.modules.workflow.ext;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import org.activiti.bpmn.model.AssociationDirection;
import org.activiti.bpmn.model.GraphicInfo;
import org.activiti.engine.ActivitiException;
import org.activiti.image.exception.ActivitiImageException;
import org.activiti.image.util.ReflectUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* activiti6流程图绘制
* Create by Kalvin on 2020/4/30.
*/
public class CustomProcessDiagramCanvas {
protected static final Logger LOGGER = LoggerFactory.getLogger(CustomProcessDiagramCanvas.class);
public enum SHAPE_TYPE {
Rectangle, Rhombus, Ellipse
}
protected static final int ARROW_WIDTH = 5;
protected static final int CONDITIONAL_INDICATOR_WIDTH = 16;
protected static final int DEFAULT_INDICATOR_WIDTH = 10;
protected static final int MARKER_WIDTH = 12;
protected static final int FONT_SIZE = 12;
protected static final int FONT_SPACING = 2;
protected static final int TEXT_PADDING = 3;
protected static final int ANNOTATION_TEXT_PADDING = 7;
protected static final int LINE_HEIGHT = FONT_SIZE + FONT_SPACING;
/**
* Colors
*/
protected static Color TASK_BOX_COLOR = new Color(249, 249, 249);
protected static Color SUBPROCESS_BOX_COLOR = new Color(255, 255, 255);
protected static Color EVENT_COLOR = new Color(255, 255, 255);
protected static Color CONNECTION_COLOR = new Color(88, 88, 88);
protected static Color CONDITIONAL_INDICATOR_COLOR = new Color(255, 255, 255);
protected static Color RUNNING_HIGHLIGHT_COLOR = Color.RED;
protected static Color HIGHLIGHT_COLOR = Color.GREEN;
protected static Color LABEL_COLOR = new Color(112, 146, 190);
// protected static Color LABEL_COLOR = Color.blue;
protected static Color TASK_BORDER_COLOR = new Color(187, 187, 187);
protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88);
protected static Color SUBPROCESS_BORDER_COLOR = new Color(0, 0, 0);
// Fonts
protected static Font LABEL_FONT = new Font("微软雅黑", Font.ITALIC, 11);
protected static Font ANNOTATION_FONT = new Font("Arial", Font.PLAIN, FONT_SIZE);
protected static Font TASK_FONT = new Font("Arial", Font.PLAIN, FONT_SIZE);
// Strokes
//TODO 边框宽度修改
//protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(3.0f);
protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(2.0f);
protected static Stroke GATEWAY_TYPE_STROKE = new BasicStroke(3.0f);
protected static Stroke END_EVENT_STROKE = new BasicStroke(3.0f);
protected static Stroke MULTI_INSTANCE_STROKE = new BasicStroke(1.3f);
protected static Stroke EVENT_SUBPROCESS_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{1.0f}, 0.0f);
protected static Stroke NON_INTERRUPTING_EVENT_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{4.0f, 3.0f}, 0.0f);
protected static Stroke HIGHLIGHT_FLOW_STROKE = new BasicStroke(1.3f);
protected static Stroke ANNOTATION_STROKE = new BasicStroke(2.0f);
protected static Stroke ASSOCIATION_STROKE = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{2.0f, 2.0f}, 0.0f);
// icons
protected static int ICON_PADDING = 5;
protected static BufferedImage USERTASK_IMAGE;
protected static BufferedImage SCRIPTTASK_IMAGE;
protected static BufferedImage SERVICETASK_IMAGE;
protected static BufferedImage RECEIVETASK_IMAGE;
protected static BufferedImage SENDTASK_IMAGE;
protected static BufferedImage MANUALTASK_IMAGE;
protected static BufferedImage BUSINESS_RULE_TASK_IMAGE;
protected static BufferedImage SHELL_TASK_IMAGE;
protected static BufferedImage MULE_TASK_IMAGE;
protected static BufferedImage CAMEL_TASK_IMAGE;
protected static BufferedImage TIMER_IMAGE;
protected static BufferedImage COMPENSATE_THROW_IMAGE;
protected static BufferedImage COMPENSATE_CATCH_IMAGE;
protected static BufferedImage ERROR_THROW_IMAGE;
protected static BufferedImage ERROR_CATCH_IMAGE;
protected static BufferedImage MESSAGE_THROW_IMAGE;
protected static BufferedImage MESSAGE_CATCH_IMAGE;
protected static BufferedImage SIGNAL_CATCH_IMAGE;
protected static BufferedImage SIGNAL_THROW_IMAGE;
protected int canvasWidth = -1;
protected int canvasHeight = -1;
protected int minX = -1;
protected int minY = -1;
protected BufferedImage processDiagram;
protected Graphics2D g;
protected FontMetrics fontMetrics;
protected boolean closed;
protected ClassLoader customClassLoader;
protected String activityFontName = "Arial";
protected String labelFontName = "Arial";
/**
* Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have
* white space there. Everything beneath these minimum values will be cropped. It's also possible to pass a specific font name and a class loader for the icon images.
*/
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, ClassLoader customClassLoader) {
this.canvasWidth = width;
this.canvasHeight = height;
this.minX = minX;
this.minY = minY;
if (activityFontName != null) {
this.activityFontName = activityFontName;
}
if (labelFontName != null) {
this.labelFontName = labelFontName;
}
this.customClassLoader = customClassLoader;
initialize(imageType);
}
/**
* Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have
* white space there (eg Signavio). Everything beneath these minimum values will be cropped.
*
* @param minX Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
* @param minY Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
*/
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
this.canvasWidth = width;
this.canvasHeight = height;
this.minX = minX;
this.minY = minY;
initialize(imageType);
}
public void initialize(String imageType) {
if ("png".equalsIgnoreCase(imageType)) {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);
} else {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
}
this.g = processDiagram.cr
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
spring boot+activiti+shiro+layui+Mysql权限管理系统源码,系统经多次测试,运行无误,大家放心下载
资源推荐
资源详情
资源评论
收起资源包目录
spring boot+activiti+shiro+layui+Mysql权限管理系统源码 (2000个子文件)
$PRODUCT_WORKSPACE_FILE$ 1KB
jquery.calendar 259B
jquery.calendar 259B
CHANGES 3KB
CHANGES 3KB
CustomProcessDiagramCanvas.class 39KB
CustomProcessDiagramGenerator.class 28KB
WorkFlowServiceImpl.class 25KB
ProcessKit.class 21KB
ProcessEngineImpl.class 17KB
WorkflowController.class 15KB
HTMLFilter.class 14KB
GenConfigVO.class 11KB
AuxiliaryKit.class 11KB
FormServiceImpl.class 11KB
IProcessImageImpl.class 11KB
User.class 9KB
GenController.class 9KB
MenuServiceImpl.class 9KB
MyDoneVO.class 9KB
FlowData.class 9KB
UserRoleServiceImpl.class 8KB
RoleServiceImpl.class 8KB
UserController.class 8KB
MyApplyVO.class 8KB
Menu.class 7KB
GenServiceImpl.class 7KB
CodeGenerator2.class 7KB
BinaryUploader.class 7KB
TableColumnDTO.class 7KB
MyTodoVO.class 6KB
CodeGenerator.class 6KB
DeptServiceImpl.class 6KB
DictServiceImpl.class 6KB
ConfigManager.class 6KB
Dept.class 6KB
ProcessModelVO.class 6KB
RedisConfig.class 6KB
UserServiceImpl.class 6KB
Log.class 6KB
Form.class 6KB
JumpAnyWhereCmd.class 6KB
ShiroConfig.class 6KB
Dict.class 5KB
ActionEnter.class 5KB
ActionAspect.class 5KB
CommonController.class 5KB
Job.class 5KB
CommentVO.class 5KB
ImageHunter.class 5KB
Role.class 5KB
ColumnConfigDTO.class 5KB
UserRealm.class 5KB
FormConfigVO$Field.class 5KB
ProcessQueryVO.class 5KB
StorageManager.class 5KB
ScheduleKit.class 5KB
RoleController.class 5KB
MenuController.class 4KB
bootstrap.css 118KB
bootstrap.css 118KB
bootstrap.min.css 98KB
bootstrap.min.css 98KB
easyui.css 74KB
easyui.css 74KB
layui.css 73KB
layui.css 73KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 71KB
easyui.css 69KB
easyui.css 69KB
easyui.css 67KB
easyui.css 67KB
ueditor.css 43KB
ueditor.css 43KB
font-awesome.css 37KB
font-awesome.css 37KB
ueditor.min.css 34KB
ueditor.min.css 34KB
font-awesome.min.css 30KB
font-awesome.min.css 30KB
style-common.css 25KB
style-common.css 25KB
video-js.css 21KB
video-js.css 21KB
formSelects-v4.css 18KB
formSelects-v4.css 18KB
image.css 18KB
image.css 18KB
bootstrap-theme.css 15KB
bootstrap-theme.css 15KB
video.css 15KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
reg183
- 粉丝: 1811
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功