package com.ruoyi.web.util;
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;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.*;
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;
/**
* Represents a canvas on which BPMN 2.0 constructs can be drawn. Some of the icons used are licensed under a Creative Commons Attribution 2.5 License, see
* http://www.famfamfam.com/lab/icons/silk/
*
* @author Joram Barrez
*/
public class CustomProcessDiagramCanvas {
protected static final Logger LOGGER = LoggerFactory.getLogger(CustomProcessDiagramCanvas.class);
public enum SHAPE_TYPE {
Rectangle, Rhombus, Ellipse
}
// Predefined sized
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 = 11;
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 HIGHLIGHT_COLOR = Color.RED;
protected static Color HIGHLIGHT_COLOR = Color.GREEN;
protected static Color LABEL_COLOR = new Color(112, 146, 190);
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 = null;
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
protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(3.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.createGraphics();
if ("png".equalsIgnoreCase(imageType) == false) {
this.g.setBackground(new Color(255, 255, 255, 0))
没有合适的资源?快使用搜索试试~ 我知道了~
RuoYi-activitiRuoYi-activitiRuoYi-activiti
共2292个文件
html:454个
js:388个
class:351个
需积分: 5 15 下载量 169 浏览量
2022-06-24
18:02:07
上传
评论
收藏 159.19MB ZIP 举报
温馨提示
RuoYi-activitiRuoYi-activitiRuoYi-activiti
资源详情
资源评论
资源推荐
收起资源包目录
RuoYi-activitiRuoYi-activitiRuoYi-activiti (2292个子文件)
purchase.bpmn 16KB
purchase.bpmn 16KB
leave.bpmn 10KB
leave.bpmn 10KB
meeting.bpmn 3KB
meeting.bpmn 3KB
CHANGES 3KB
CHANGES 3KB
ExcelUtil.class 39KB
CustomProcessDiagramCanvas.class 37KB
CustomProcessDiagramGenerator.class 25KB
DemoTableController.class 17KB
FlowMonitorController.class 16KB
GenTableServiceImpl.class 15KB
Convert.class 13KB
HTMLFilter.class 13KB
DemoFormController.class 13KB
SysUserServiceImpl.class 13KB
JSONObject.class 12KB
ShiroConfig.class 12KB
SysUserController.class 12KB
DemoOperateController.class 12KB
TaskController.class 11KB
GenController.class 11KB
FlowController.class 11KB
SysMenuServiceImpl.class 11KB
ReflectUtils.class 11KB
VelocityUtils.class 10KB
ModelManageController.class 9KB
SysRoleServiceImpl.class 9KB
SysRoleController.class 9KB
SysUser.class 9KB
SysDeptServiceImpl.class 9KB
StringUtils.class 9KB
LogAspect.class 9KB
HttpUtils.class 9KB
SysDictTypeServiceImpl.class 8KB
ActivitiTracingChart.class 8KB
Server.class 8KB
LeaveapplyController.class 8KB
PurchaseController.class 8KB
SysJobController.class 8KB
GenTable.class 8KB
SysDeptController.class 7KB
GenTableColumn.class 7KB
DynamicFlowController.class 7KB
SysIndexController.class 7KB
SysProfileController.class 7KB
SysMenuController.class 7KB
CommonController.class 6KB
SysDictTypeController.class 6KB
UserRealm.class 6KB
UUID.class 6KB
MyBatisConfig.class 6KB
MeetingController.class 6KB
KickoutSessionFilter.class 6KB
ModelController.class 6KB
SysOperLog.class 6KB
FileUtils.class 6KB
OnlineWebSessionManager.class 6KB
SysJobServiceImpl.class 6KB
FileUploadUtils.class 6KB
ScheduleUtils.class 6KB
GenUtils.class 6KB
SysPostController.class 5KB
JobInvokeUtil.class 5KB
BaseController.class 5KB
SysConfigController.class 5KB
SysConfigServiceImpl.class 5KB
SysMenu.class 5KB
SysRole.class 5KB
SysDictDataController.class 5KB
SysDictData.class 5KB
SysJob.class 5KB
DateUtils.class 5KB
DruidConfig.class 5KB
GlobalExceptionHandler.class 5KB
PermissionService.class 5KB
SysJobLogController.class 4KB
SysDept.class 4KB
LeaveapplyServiceImpl.class 4KB
CacheUtils.class 4KB
ServletUtils.class 4KB
PurchaseServiceImpl.class 4KB
SysPostServiceImpl.class 4KB
DataScopeAspect.class 4KB
TestController.class 4KB
MeetingServiceImpl.class 4KB
DictUtils.class 4KB
LogUtils.class 4KB
JSON.class 4KB
SysLoginService.class 4KB
SysUserOnlineController.class 4KB
SysOperlogController.class 4KB
SysNoticeController.class 4KB
SysUserOnlineServiceImpl.class 4KB
SysPasswordService.class 4KB
OnlineSessionFilter.class 4KB
SysLogininforController.class 4KB
SpringSessionValidationScheduler.class 4KB
共 2292 条
- 1
- 2
- 3
- 4
- 5
- 6
- 23
热心市民-陈先生
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 数据结构课程设计-全国交通出行咨询模拟系统C语言实现源码.zip
- cef-binary-109.0.1+gcd5e37a+chromium-109.0.5414.8-windows32
- 基于C语言的全国交通咨询系统模拟源码.zip
- 炫酷代码雨,超级炫酷哦!!!
- 基于物联网MQTT协议的智能停车场管理系统
- POETIZE个人博客系统源码 - 最美博客
- 基于深度学习的行人检测系统源码+项目说明(YoloV3+Tensorflow).zip
- 区块链系统:以比特币为基础
- 直接插入排序(Insertion Sort)是一种简单直观的排序算法.txt
- Python实现基于深度学习的预测区域电力负荷模型源码+项目说明(高分项目).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0