介绍一下我实现的设计器中节点之间连接线条的方法:
首先实现的效果是,节点的上下左右四个中点(锚点),所有到节点的连线都会在这四个点上,两个节点之间的连线按照最短的一条来画线。
确定了需要实现的效果,接下来就是实现。给Node类提供得到四个锚点的方法:
public static var TOP_CENTER:Number = 0;
public static var BOTTOM_CENTER:Number = 1;
public static var LEFT_CENTER:Number = 2;
public static var RIGHT_CENTER:Number = 3;
public static var MID:Number = 4;
public function getPoint(type:Number , isIn : Boolean = true):Point{
var p:Point = null;
switch(type){
case Node.TOP_CENTER:
p = new Point(this.x + this.width /2 , this.y);
break;
case Node.BOTTOM_CENTER:
p = new Point(this.x + this.width/2 ,this.y+this.height);
break;
case Node.LEFT_CENTER:
p = new Point(this.x ,this.y+this.height/2);
break;
case Node.RIGHT_CENTER:
p = new Point(this.x+this.width ,this.y+this.height/2);
break;
case Node.MID:
p=new Point(this.x + this.width /2 ,this.y+ this.height/2);
break;
default:
p = null;
}
}
Line类中得到节点中最近的两个锚点:
public function convertPonint(ispolyline:Boolean = false):void{
var tempSp:Point = new Point();
var tempEp:Point = new Point();
var tempLength:Number = 0;
var startNodePoint:Number = -1;
var endNodePoint:Number = -1;
for(var i:Number = 0 ; i < 4 ; i++){
if(this.startNode == null){
break;
}
var s:Point = this.startNode.getPoint(i);
for(var j:Number = 0 ; j <4 ; j++){
if(this.endNode == null){
break;
}
var e:Point = this.endNode.getPoint(j);
var x:Number = (e.x - s.x) * (e.x - s.x);
var y:Number = (e.y - s.y) * (e.y - s.y);
var v:Number = Math.round(Math.sqrt(x+y));
if(tempLength == 0 || tempLength > v){
tempLength = v;
tempSp = s;
tempEp = e;
startNodePoint = i;
endNodePoint = j;
}
}
}
this.sp = tempSp;
this.ep = tempEp;
convertPointWay(startNodePoint,endNodePoint);
}
根据转换后的坐标进行划线。
分享到:
相关推荐
Activiti流程设计器--actiBPM使用经验 Activiti流程设计器是一种流程设计工具,用于设计和实现业务流程。actiBPM是Activiti流程设计器的插件,提供了更加强大的流程设计功能。然而,在使用actiBPM时,经常遇到中文...
Activiti6-流程跟踪监控图-节点-流程线高亮显示-支持通过、不通过、驳回、退回 支持内容: 已完成节点高亮显示、当前执行中节点红色显示 支持一个节点多条流出线,包括通过、不通过、驳回、退回,按照已执行操作正确...
赠送jar包:activiti-engine-5.21.0.jar; 赠送原API文档:activiti-engine-5.21.0-javadoc.jar; 赠送源代码:activiti-engine-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-engine-5.21.0.pom; 包含...
赠送jar包:activiti-bpmn-model-5.21.0.jar; 赠送原API文档:activiti-bpmn-model-5.21.0-javadoc.jar; 赠送源代码:activiti-bpmn-model-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-bpmn-model-...
idea可扩展的activiti流程设计器camunda-modeler-3.0.0-win-x64.zip,可代替actiBPM插件,使用介绍https://blog.csdn.net/Arsenalzjx/article/details/96288482
activiti-spring-boot-starter-7.1.0.M1
actiBPM 是一个基于 IntelliJ IDEA 的 Activiti 流程设计器插件,它扩展了 IDEA 的功能,为开发者提供了在 IDE 内直接编辑 BPMN2.0 流程图的能力。 在使用 actiBPM 插件时,可能会遇到一个常见的问题,即中文乱码。...
activiti-spring-boot-starter-basic-6.0.0适配springboot2.1.2
赠送jar包:activiti-json-converter-5.21.0.jar; 赠送原API文档:activiti-json-converter-5.21.0-javadoc.jar; 赠送源代码:activiti-json-converter-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
activiti-bpmn-converter-5.18.0-sources.jar
赠送jar包:activiti-common-rest-5.21.0.jar; 赠送原API文档:activiti-common-rest-5.21.0-javadoc.jar; 赠送源代码:activiti-common-rest-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-common-rest-...
赠送jar包:activiti-json-converter-5.21.0.jar; 赠送原API文档:activiti-json-converter-5.21.0-javadoc.jar; 赠送源代码:activiti-json-converter-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
赠送jar包:activiti-image-generator-5.21.0.jar; 赠送原API文档:activiti-image-generator-5.21.0-javadoc.jar; 赠送源代码:activiti-image-generator-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
NULL 博文链接:https://cooperay.iteye.com/blog/1409863
activiti-bpmn-converter-5.16.4.jar
赠送jar包:activiti-image-generator-5.21.0.jar; 赠送原API文档:activiti-image-generator-5.21.0-javadoc.jar; 赠送源代码:activiti-image-generator-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
忙活了一个星期左右,查找各种资料,终于将Activiti的流程设计器分离出来,与SpringMVC,spring整合了起来,先把工程分享出来,等有时间了在慢慢讲解具体的整合步骤。工程下载之后直接可以运行,只需要改一下数据库...
赠送jar包:activiti-process-validation-5.21.0.jar; 赠送原API文档:activiti-process-validation-5.21.0-javadoc.jar; 赠送源代码:activiti-process-validation-5.21.0-sources.jar; 赠送Maven依赖信息文件:...
Activiti的Eclipse插件activiti-designer安装资料包,包含activiti-designer-5.18.0.zip、org.eclipse.emf.transaction_1.4.0.201306111400.jar、org.eclipse.emf.validation.ui_1.7.0.201403111711.jar、org....