官方文档:https://drawio-app.com/import-from-csv-to-drawio/
public class BaseLineObj { /** * Builder to build {@link BaseLineObj}. */ public static final class Builder { private Integer flowId; private Integer queueLevel; private Builder() { } /** * Builder method of the builder. * * @return built class */ public BaseLineObj build() { return new BaseLineObj(this); } /** * Builder method for flowId parameter. * * @param flowId * field to set * @return builder */ public Builder withFlowId(Integer flowId) { this.flowId = flowId; return this; } /** * Builder method for queueLevel parameter. * * @param queueLevel * field to set * @return builder */ public Builder withQueueLevel(Integer queueLevel) { this.queueLevel = queueLevel; return this; } } private Integer flowId; private Integer queueLevel; /** * */ public BaseLineObj() { super(); } private BaseLineObj(Builder builder) { this.flowId = builder.flowId; this.queueLevel = builder.queueLevel; } /** * Creates builder to build {@link BaseLineObj}. * * @return created builder */ public static Builder builder() { return new Builder(); } /* * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } BaseLineObj other = (BaseLineObj) obj; if (flowId == null) { if (other.flowId != null) { return false; } } else if (!flowId.equals(other.flowId)) { return false; } return true; } /** * @return the flowId */ public Integer getFlowId() { return flowId; } /** * @return the queueLevel */ public Integer getQueueLevel() { return queueLevel; } /* * (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((flowId == null) ? 0 : flowId.hashCode()); return result; } /** * @param flowId * the flowId to set */ public void setFlowId(Integer flowId) { this.flowId = flowId; } /** * @param queueLevel * the queueLevel to set */ public void setQueueLevel(Integer queueLevel) { this.queueLevel = queueLevel; } /* * (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return GsonUtils.toJSON(this); } }
public class CSVFormatRecord { /** * Builder to build {@link CSVFormatRecord}. */ public static final class Builder { private String id; private String step; private String fill; private String stroke; private String shape; private String refs; private Builder() { } /** * Builder method of the builder. * * @return built class */ public CSVFormatRecord build() { return new CSVFormatRecord(this); } /** * Builder method for fill parameter. * * @param fill * field to set * @return builder */ public Builder withFill(String fill) { this.fill = fill; return this; } /** * Builder method for id parameter. * * @param id * field to set * @return builder */ public Builder withId(String id) { this.id = id; return this; } /** * Builder method for refs parameter. * * @param refs * field to set * @return builder */ public Builder withRefs(String refs) { this.refs = refs; return this; } /** * Builder method for shape parameter. * * @param shape * field to set * @return builder */ public Builder withShape(String shape) { this.shape = shape; return this; } /** * Builder method for step parameter. * * @param step * field to set * @return builder */ public Builder withStep(String step) { this.step = step; return this; } /** * Builder method for stroke parameter. * * @param stroke * field to set * @return builder */ public Builder withStroke(String stroke) { this.stroke = stroke; return this; } } private String id; private String step; private String fill; private String stroke; private String shape; private String refs; /** * */ public CSVFormatRecord() { super(); } private CSVFormatRecord(Builder builder) { this.id = builder.id; this.step = builder.step; this.fill = builder.fill; this.stroke = builder.stroke; this.shape = builder.shape; this.refs = builder.refs; } /** * Creates builder to build {@link CSVFormatRecord}. * * @return created builder */ public static Builder builder() { return new Builder(); } /* * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CSVFormatRecord other = (CSVFormatRecord) obj; if (fill == null) { if (other.fill != null) { return false; } } else if (!fill.equals(other.fill)) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } if (refs == null) { if (other.refs != null) { return false; } } else if (!refs.equals(other.refs)) { return false; } if (shape == null) { if (other.shape != null) { return false; } } else if (!shape.equals(other.shape)) { return false; } if (step == null) { if (other.step != null) { return false; } } else if (!step.equals(other.step)) { return false; } if (stroke == null) { if (other.stroke != null) { return false; } } else if (!stroke.equals(other.stroke)) { return false; } return true; } /** * @return the fill */ public String getFill() { return fill; } /** * @return the id */ public String getId() { return id; } /** * @return the refs */ public String getRefs() { return refs; } /** * @return the shape */ public String getShape() { return shape; } /** * @return the step */ public String getStep() { return step; } /** * @return the stroke */ public String getStroke() { return stroke; } /* * (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((fill == null) ? 0 : fill.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((refs == null) ? 0 : refs.hashCode()); result = prime * result + ((shape == null) ? 0 : shape.hashCode()); result = prime * result + ((step == null) ? 0 : step.hashCode()); result = prime * result + ((stroke == null) ? 0 : stroke.hashCode()); return result; } /** * @param fill * the fill to set */ public void setFill(String fill) { this.fill = fill; } /** * @param id * the id to set */ public void setId(String id) { this.id = id; } /** * @param refs * the refs to set */ public void setRefs(String refs) { this.refs = refs; } /** * @param shape * the shape to set */ public void setShape(String shape) { this.shape = shape; } /** * @param step * the step to set */ public void setStep(String step) { this.step = step; } /** * @param stroke * the stroke to set */ public void setStroke(String stroke) { this.stroke = stroke; } public String toGraphCSV() { Preconditions.checkNotNull(id, "id is null"); Preconditions.checkNotNull(step, "step is null"); Preconditions.checkNotNull(fill, "fill is null"); Preconditions.checkNotNull(stroke, "stroke is null"); Preconditions.checkNotNull(shape, "shape is null"); Preconditions.checkNotNull(refs, "refs is null"); return Joiner.on(",").join(id, step, fill, stroke, shape, refs); } /* * (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return GsonUtils.toJSON(this); } }
package test; import org.apache.commons.collections.CollectionUtils; import org.jgrapht.Graphs; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.DirectedAcyclicGraph; import org.kanpiaoxue.code.KeyValue; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; /** * @ClassName: Test1 * @author kanpiaoxue * @version 1.0 * @CreateTime: 2019/11/11 20:17:31 * @Description: */ public class Test1 { private static final KeyValue<String, String> CURRENT_NODE_COLOR = new KeyValue<String, String>("#fff2cc", "#d6b656"); private static final KeyValue<String, String> DEFAULT_NODE_COLOR = new KeyValue<String, String>("#dae8fc", "#6c8ebf"); private static final Map<Integer, KeyValue<String, String>> COLOR_MAP = Maps.newHashMap(); static { COLOR_MAP.put(1, DEFAULT_NODE_COLOR); COLOR_MAP.put(2, new KeyValue<String, String>("#d5e8d4", "#82b366")); COLOR_MAP.put(3, new KeyValue<String, String>("#f8cecc", "#b85450")); } private static List<String> CSV_HEADER = Lists.newArrayList(); static { CSV_HEADER.add("## Hello World"); CSV_HEADER.add("# label: %step%"); CSV_HEADER.add("# style: shape=%shape%;fillColor=%fill%;strokeColor=%stroke%;"); CSV_HEADER.add("# namespace: csvimport-"); CSV_HEADER.add( "# connect: {\"from\":\"refs\", \"to\":\"id\", \"invert\":true, \"style\":\"curved=0;endArrow=blockThin;endFill=1;\"}"); CSV_HEADER.add("# width: auto"); CSV_HEADER.add("# height: auto"); CSV_HEADER.add("# padding: 15"); CSV_HEADER.add("# ignore: id,shape,fill,stroke,refs"); CSV_HEADER.add("# nodespacing: 40"); CSV_HEADER.add("# levelspacing: 100"); CSV_HEADER.add("# edgespacing: 40"); CSV_HEADER.add("# layout: auto"); CSV_HEADER.add("## CSV starts under this line"); } private static final List<String> HEADER_LIST = Lists.newArrayList("id,step,fill,stroke,shape,refs"); /** * * @param args * @author kanpiaoxue * @CreateTime: 2019/05/20 10:43:16 */ public static void main(String[] args) throws Exception { test07(); } public static void test07() throws Exception { BaseLineObj currentNode = BaseLineObj.builder().withFlowId(4).withQueueLevel(3).build(); List<String> datas = buildDatas(currentNode); List<String> list = Lists.newArrayList(); list.addAll(CSV_HEADER); list.addAll(HEADER_LIST); list.addAll(datas); System.out.println(Joiner.on("\n").skipNulls().join(list)); } private static DirectedAcyclicGraph<BaseLineObj, DefaultEdge> buildDAG() { DirectedAcyclicGraph<BaseLineObj, DefaultEdge> g = new DirectedAcyclicGraph<BaseLineObj, DefaultEdge>(DefaultEdge.class); BaseLineObj o1 = BaseLineObj.builder().withFlowId(1).withQueueLevel(3).build(); BaseLineObj o2 = BaseLineObj.builder().withFlowId(2).withQueueLevel(3).build(); BaseLineObj o3 = BaseLineObj.builder().withFlowId(3).withQueueLevel(3).build(); BaseLineObj o4 = BaseLineObj.builder().withFlowId(4).withQueueLevel(2).build(); BaseLineObj o5 = BaseLineObj.builder().withFlowId(5).withQueueLevel(2).build(); BaseLineObj o6 = BaseLineObj.builder().withFlowId(6).withQueueLevel(1).build(); BaseLineObj o7 = BaseLineObj.builder().withFlowId(7).withQueueLevel(1).build(); g.addVertex(o1); g.addVertex(o2); g.addVertex(o3); g.addVertex(o4); g.addVertex(o5); g.addVertex(o6); g.addVertex(o7); g.addEdge(o1, o2); g.addEdge(o1, o3); g.addEdge(o2, o4); g.addEdge(o5, o4); g.addEdge(o4, o6); g.addEdge(o6, o7); g.addEdge(o1, o7); return g; } private static List<String> buildDatas(BaseLineObj current) { DirectedAcyclicGraph<BaseLineObj, DefaultEdge> g = buildDAG(); List<CSVFormatRecord> datas = g.vertexSet().stream().map(o -> { List<BaseLineObj> successorListOf = Graphs.successorListOf(g, o); String refs = processRefs(successorListOf, BaseLineObj::getFlowId); KeyValue<String, String> kv = current.equals(o) ? CURRENT_NODE_COLOR : processBaseLineColor(o.getQueueLevel()); String fill = kv.getKey(); String stroke = kv.getValue(); return CSVFormatRecord.builder().withId(o.getFlowId().toString()) .withStep(String.format("\"flowId:%s,level:%s\"", o.getFlowId(), o.getQueueLevel())) .withFill(fill).withStroke(stroke).withShape("rectangle").withRefs(refs).build(); }).collect(Collectors.toList()); List<String> rs = datas.stream().map(CSVFormatRecord::toGraphCSV).collect(Collectors.toList()); return rs; } private static KeyValue<String, String> processBaseLineColor(Integer queueLevel) { KeyValue<String, String> obj = COLOR_MAP.get(queueLevel); if (Objects.isNull(obj)) { return DEFAULT_NODE_COLOR; } return obj; } private static <E> String processRefs(List<E> list, Function<? super E, ? extends Integer> mapper) { if (CollectionUtils.isEmpty(list)) { return ""; } String tmp = Joiner.on(",").skipNulls().join(list.stream().map(mapper).collect(Collectors.toList())); if (1 == list.size()) { return tmp; } return String.format("\"%s\"", tmp); } }
输出结果 写道
## Hello World
# label: %step%
# style: shape=%shape%;fillColor=%fill%;strokeColor=%stroke%;
# namespace: csvimport-
# connect: {"from":"refs", "to":"id", "invert":true, "style":"curved=0;endArrow=blockThin;endFill=1;"}
# width: auto
# height: auto
# padding: 15
# ignore: id,shape,fill,stroke,refs
# nodespacing: 40
# levelspacing: 100
# edgespacing: 40
# layout: auto
## CSV starts under this line
id,step,fill,stroke,shape,refs
1,"flowId:1,level:3",#f8cecc,#b85450,rectangle,
2,"flowId:2,level:3",#f8cecc,#b85450,rectangle,1
3,"flowId:3,level:3",#f8cecc,#b85450,rectangle,1
4,"flowId:4,level:2",#fff2cc,#d6b656,rectangle,"2,5"
5,"flowId:5,level:2",#d5e8d4,#82b366,rectangle,
6,"flowId:6,level:1",#dae8fc,#6c8ebf,rectangle,4
7,"flowId:7,level:1",#dae8fc,#6c8ebf,rectangle,"6,1"
# label: %step%
# style: shape=%shape%;fillColor=%fill%;strokeColor=%stroke%;
# namespace: csvimport-
# connect: {"from":"refs", "to":"id", "invert":true, "style":"curved=0;endArrow=blockThin;endFill=1;"}
# width: auto
# height: auto
# padding: 15
# ignore: id,shape,fill,stroke,refs
# nodespacing: 40
# levelspacing: 100
# edgespacing: 40
# layout: auto
## CSV starts under this line
id,step,fill,stroke,shape,refs
1,"flowId:1,level:3",#f8cecc,#b85450,rectangle,
2,"flowId:2,level:3",#f8cecc,#b85450,rectangle,1
3,"flowId:3,level:3",#f8cecc,#b85450,rectangle,1
4,"flowId:4,level:2",#fff2cc,#d6b656,rectangle,"2,5"
5,"flowId:5,level:2",#d5e8d4,#82b366,rectangle,
6,"flowId:6,level:1",#dae8fc,#6c8ebf,rectangle,4
7,"flowId:7,level:1",#dae8fc,#6c8ebf,rectangle,"6,1"
按照官网 https://drawio-app.com/import-from-csv-to-drawio/ 的描述,将上面输出的内容到 https://www.draw.io/ 里面,
Click on 菜单:Arrange > Insert > Advanced > CSV.
进行操作即可。
如果觉得图形布局不够好看,可以操作菜单:Arrange > Layout
相关推荐
【资源说明】 基于微信小程序的校园论坛;微信小程序;云开发;云数据库;云储存;云函数;纯JS无后台;全部资料+详细文档+高分项目.zip 【备注】 1、该项目是个人高分项目源码,已获导师指导认可通过,答辩评审分达到95分 2、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 3、本项目适合计算机相关专业(人工智能、通信工程、自动化、电子信息、物联网等)的在校学生、老师或者企业员工下载使用,也可作为毕业设计、课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 4、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
单电阻采样 基于单电阻采样的相电流重构算法 keil完整工程。 单电阻采样 f103的单电阻,完整工程,带文档,带硬件资料。 f3平台的单电阻完整工程,代码详细注释。 还有微芯的单电阻smo代码加文档 具体如截图请看下
jQuery左侧导航右侧tab页面切换
哈希查找
五相电机邻近四矢量SVPWM模型_MATLAB_Simulink仿真模型包括: (1)原理说明文档(重要):包括扇区判断、矢量作用时间计算、矢量作用顺序及切时间计算、PWM波的生成; (2)输出部分仿真波形及仿真说明文档; (3)完整版仿真模型:Simulink仿真模型; 注意,只包含五相电机邻近四矢量SVPWM算法,并非五相电机双闭环矢量控制,如果想要五相电机双闭环矢量控制资料,另一个链接。 资料介绍过程十分详细
法码滋.exe法码滋2.exe法码滋3.exe
项目包含完整前后端源码和数据库文件,均测试可正常运行 环境说明: 开发语言:Java 框架:ssm,mybatis JDK版本:JDK1.8 数据库:mysql 5.7 数据库工具:Navicat11 开发软件:eclipse/idea Maven包:Maven3.3 部署容器:tomcat7
算法允许用户在图像上自行划定标签,并对这些区域内的图像进行肤色检测和处理;最后在一个PyQt窗口中显示处理后的三张图片,分别为带标签图片,二值化图片,膨胀后图片。
内容概要: 本资料包含了一系列用于庆祝浪漫节日的创意代码,主要包括爱心代码和圣诞树代码。这些代码可以生成视觉上吸引人的图案和动画,用于在屏幕上展示爱心和圣诞树,增加节日气氛。爱心代码可以用于表达爱意,而圣诞树代码则适合在圣诞节期间使用,为用户带来节日的欢乐和视觉享受。 适用人群: 本资料适用于以下人群: 程序员和开发者,他们希望在项目中添加节日元素或为特别场合创造个性化的视觉效果。 网页设计师,他们需要为网站或应用程序添加节日主题的装饰。 技术爱好者和DIY爱好者,他们喜欢通过编程来庆祝节日或为朋友和家人制作特别的礼物。 实现:可直接运行python程序。
1. 患者信息与隔离状态管理 患者基本信息录入:对于疑似、确诊或密切接触者患者,系统记录其基本信息,包括姓名、年龄、性别、联系方式、住址等。 疫情风险评估:通过问卷或医务人员评估,系统对患者进行风险评估,判断是否需要隔离、隔离的级别(如轻症、中症、重症等)。 隔离状态管理:记录患者的隔离状态(如隔离中、已解除隔离、转入ICU等),并能够实时更新隔离状态变化。 隔离病房分配:根据患者的病情、感染风险和病房资源,系统自动分配适当的隔离病房或床位,避免交叉感染。 2. 隔离病房与环境管理 病房信息管理:系统对每个隔离病房进行实时监控,包括病房的床位使用情况、设备设施、清洁消毒状况等,确保每个病房的隔离效果。 空气流通与环境消毒管理:记录隔离病房的空气流通情况、消毒记录、物品消耗等,确保符合疫情防控要求。 设备与物资分配:针对隔离病房的特殊需求,系统可以自动化管理医疗设备(如氧气、呼吸机等)与防护物资(如口罩、手套、防护服等)的分配与库存管理。 3. 医护人员防护与工作管理 医护人员排班与防护管理:为隔离病房的医护人员进行特殊排班,避免交叉感染,并根据需要分配适当的防护装备,如全身防护服、N9
适配文章:https://editor.csdn.net/md?not_checkout=1&spm=1011.2415.3001.6217&articleId=144663667 富芮坤FR8003作为主机连接FR8003二:官方代码主从的UUID和att_idx
内容概要:文章介绍了USB PD协议单口控制器DP3145D的技术特点、主要功能和应用场景。DP3145D支持USB Type-C和USB Power Delivery(PD)3.1协议,具备多种配置选项,最高输出功率45W。它集成了CV环路光耦驱动电路、反馈网络电阻以及多项保护措施,适用于ACDC适配器等USB充电设备。 适合人群:电子工程师、电源产品设计师和技术研究人员。 使用场景及目标:主要用于设计和开发支持USB PD协议的ACDC适配器和充电设备,实现高效、安全的充电解决方案。 阅读建议:重点关注DP3145D的具体技术参数、功能特点和典型应用实例,结合自身需求进行产品选型和设计。
VBA视频教程 05
基于Spring Boot框架的网上蛋糕销售系统_30z8r428_231-wx.zip
matlab
蜡笔小新-去掉动效.zip
1221额的2的2的2额
济宁市2005-2024年近20年的历史气象数据,每3小时更新一次数据,参数包含气温、气压、降水量、云层、能见度、风向、湿度等,几万条数据
8.40 最新版本Saturn_PCB_Toolkit安装包,,eda 设计 PCB设计辅助工具,软件功能强大,单端线阻抗、差分线阻抗到串扰分析等多种计算工具
NotImplementedError.md